update SPIRV-CROSS to latest

SHA: ff61890722a91e97c44940494be5b6eed0d5ff5b
This commit is contained in:
Mathias Agopian
2021-05-21 17:15:08 -07:00
committed by Mathias Agopian
parent 331332fab0
commit cd01ad06fd
603 changed files with 24778 additions and 1985 deletions

View File

@@ -346,7 +346,7 @@ void GLSLPostProcessor::fullOptimization(const TShader& tShader,
if (tShader.getStage() == EShLangFragment && glslOptions.es) {
for (auto i : config.glsl.subpassInputToColorLocation) {
glslCompiler.remap_ext_framebuffer_fetch(i.first, i.second);
glslCompiler.remap_ext_framebuffer_fetch(i.first, i.second, true);
}
}

View File

@@ -0,0 +1,54 @@
name: CI
on:
push:
branches: [ master ]
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build:
name: "Build ${{ matrix.platform }}"
strategy:
matrix:
platform: [windows-latest, ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-latest]
env:
PARALLEL: -j 2
runs-on: "${{ matrix.platform }}"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Pull glslang / SPIRV-Tools
shell: bash
working-directory: ${{github.workspace}}
run: ./checkout_glslang_spirv_tools.sh
- name: Build glslang / SPIRV-Tools
shell: bash
working-directory: ${{github.workspace}}
run: ./build_glslang_spirv_tools.sh Release
- name: Configure SPIRV-Cross
shell: bash
run: |
mkdir build
cd build
cmake .. -DSPIRV_CROSS_WERROR=ON -DSPIRV_CROSS_MISC_WARNINGS=ON -DSPIRV_CROSS_SHARED=ON -DCMAKE_INSTALL_PREFIX=output -DCMAKE_BUILD_TYPE=Release -DSPIRV_CROSS_ENABLE_TESTS=ON
- name: Build SPIRV-Cross
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake --build . --config Release
cmake --build . --config Release --target install
- name: Test SPIRV-Cross
shell: bash
working-directory: ${{github.workspace}}/build
run: ctest --verbose -C Release

View File

@@ -1,4 +1,4 @@
# Copyright 2016-2020 Google Inc.
# Copyright 2016-2021 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,8 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 2.8)
#
# At your option, you may choose to accept this material under either:
# 1. The Apache License, Version 2.0, found at <http://www.apache.org/licenses/LICENSE-2.0>, or
# 2. The MIT License, found at <http://opensource.org/licenses/MIT>.
# SPDX-License-Identifier: Apache-2.0 OR MIT.
#
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
# Avoid a warning if parent project sets VERSION in project().
if (${CMAKE_VERSION} VERSION_GREATER "3.0.1")
@@ -133,7 +141,8 @@ if (CMAKE_COMPILER_IS_GNUCXX OR ((${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") AND
set(spirv-cross-link-flags "${spirv-cross-link-flags} -fsanitize=thread")
endif()
elseif (MSVC)
set(spirv-compiler-options ${spirv-compiler-options} /wd4267 /wd4996)
# AppVeyor spuriously fails in debug build on older MSVC without /bigobj.
set(spirv-compiler-options ${spirv-compiler-options} /wd4267 /wd4996 $<$<CONFIG:DEBUG>:/bigobj>)
endif()
macro(extract_headers out_abs file_list)
@@ -323,7 +332,7 @@ if (SPIRV_CROSS_STATIC)
endif()
set(spirv-cross-abi-major 0)
set(spirv-cross-abi-minor 42)
set(spirv-cross-abi-minor 47)
set(spirv-cross-abi-patch 0)
if (SPIRV_CROSS_SHARED)

View File

@@ -2,7 +2,7 @@
SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages.
[![Build Status](https://travis-ci.org/KhronosGroup/SPIRV-Cross.svg?branch=master)](https://travis-ci.org/KhronosGroup/SPIRV-Cross)
[![CI](https://github.com/KhronosGroup/SPIRV-Cross/actions/workflows/main.yml/badge.svg)](https://github.com/KhronosGroup/SPIRV-Cross/actions/workflows/main.yml)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/KhronosGroup/SPIRV-Cross?svg=true&branch=master)](https://ci.appveyor.com/project/HansKristian-Work/SPIRV-Cross)
## Features
@@ -161,12 +161,12 @@ for (i = 0; i < count; i++)
}
// Modify options.
spvc_compiler_create_compiler_options(context, &options);
spvc_compiler_create_compiler_options(compiler_glsl, &options);
spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_GLSL_VERSION, 330);
spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES, SPVC_FALSE);
spvc_compiler_install_compiler_options(compiler_glsl, options);
spvc_compiler_compile(compiler, &result);
spvc_compiler_compile(compiler_glsl, &result);
printf("Cross-compiled source: %s\n", result);
// Frees all memory we allocated so far.
@@ -418,7 +418,8 @@ Reserved identifiers currently assumed by the implementation are (in pseudo-rege
- _$digit+_.+, e.g. `_100_tmp`, `_2_foobar`. `_2Bar` is **not** reserved.
- gl_- prefix
- spv- prefix
- SPIRV_Cross prefix
- SPIRV_Cross prefix. This prefix is generally used for interface variables where app needs to provide data for workaround purposes.
This identifier will not be rewritten, but be aware of potential collisions.
- Double underscores (reserved by all target languages).
Members of structs also have a reserved identifier:

View File

@@ -1,8 +1,8 @@
#!/bin/bash
GLSLANG_REV=4dcc12d1a441b29d5901bc708bb1343d29d6459f
SPIRV_TOOLS_REV=0a1fb588cd365f7737cb121fdd64553923e0cef6
SPIRV_HEADERS_REV=060627f0b0d2fa8581b5acb939f46e3b9e500593
GLSLANG_REV=3de5cfe50edecd001e6d703555284d9b10b3dd57
SPIRV_TOOLS_REV=f3ccb633dfd7c5de1f9f0a2d2e9d7a25f2478206
SPIRV_HEADERS_REV=f027d53ded7e230e008d37c8b47ede7cd308e19d
if [ -z $PROTOCOL ]; then
PROTOCOL=git

View File

@@ -38,6 +38,8 @@ source_set("spirv_cross_sources") {
"../spirv_cross_util.hpp",
"../spirv_glsl.cpp",
"../spirv_glsl.hpp",
"../spirv_hlsl.cpp",
"../spirv_hlsl.hpp",
"../spirv_msl.cpp",
"../spirv_msl.hpp",
"../spirv_parser.cpp",
@@ -46,7 +48,9 @@ source_set("spirv_cross_sources") {
"../spirv_reflect.hpp",
]
cflags = [ "-fno-exceptions" ]
if (!is_win) {
cflags = [ "-fno-exceptions" ]
}
if (is_clang) {
cflags_cc = [

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Arm Limited
* Copyright 2015-2021 Arm Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,13 @@
* limitations under the License.
*/
/*
* At your option, you may choose to accept this material under either:
* 1. The Apache License, Version 2.0, found at <http://www.apache.org/licenses/LICENSE-2.0>, or
* 2. The MIT License, found at <http://opensource.org/licenses/MIT>.
* SPDX-License-Identifier: Apache-2.0 OR MIT.
*/
#include "spirv_cpp.hpp"
#include "spirv_cross_util.hpp"
#include "spirv_glsl.hpp"
@@ -31,6 +38,11 @@
#include <unordered_map>
#include <unordered_set>
#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
#endif
#ifdef HAVE_SPIRV_CROSS_GIT_VERSION
#include "gitversion.h"
#endif
@@ -213,8 +225,27 @@ struct CLIParser
#pragma warning(disable : 4996)
#endif
static vector<uint32_t> read_spirv_file_stdin()
{
#ifdef _WIN32
setmode(fileno(stdin), O_BINARY);
#endif
vector<uint32_t> buffer;
uint32_t tmp[256];
size_t ret;
while ((ret = fread(tmp, sizeof(uint32_t), 256, stdin)))
buffer.insert(buffer.end(), tmp, tmp + ret);
return buffer;
}
static vector<uint32_t> read_spirv_file(const char *path)
{
if (path[0] == '-' && path[1] == '\0')
return read_spirv_file_stdin();
FILE *file = fopen(path, "rb");
if (!file)
{
@@ -254,6 +285,61 @@ static bool write_string_to_file(const char *path, const char *string)
#pragma warning(pop)
#endif
static void print_resources(const Compiler &compiler, spv::StorageClass storage,
const SmallVector<BuiltInResource> &resources)
{
fprintf(stderr, "%s\n", storage == StorageClassInput ? "builtin inputs" : "builtin outputs");
fprintf(stderr, "=============\n\n");
for (auto &res : resources)
{
bool active = compiler.has_active_builtin(res.builtin, storage);
const char *basetype = "?";
auto &type = compiler.get_type(res.value_type_id);
switch (type.basetype)
{
case SPIRType::Float: basetype = "float"; break;
case SPIRType::Int: basetype = "int"; break;
case SPIRType::UInt: basetype = "uint"; break;
default: break;
}
uint32_t array_size = 0;
bool array_size_literal = false;
if (!type.array.empty())
{
array_size = type.array.front();
array_size_literal = type.array_size_literal.front();
}
string type_str = basetype;
if (type.vecsize > 1)
type_str += std::to_string(type.vecsize);
if (array_size)
{
if (array_size_literal)
type_str += join("[", array_size, "]");
else
type_str += join("[", array_size, " (spec constant ID)]");
}
string builtin_str;
switch (res.builtin)
{
case spv::BuiltInPosition: builtin_str = "Position"; break;
case spv::BuiltInPointSize: builtin_str = "PointSize"; break;
case spv::BuiltInCullDistance: builtin_str = "CullDistance"; break;
case spv::BuiltInClipDistance: builtin_str = "ClipDistance"; break;
case spv::BuiltInTessLevelInner: builtin_str = "TessLevelInner"; break;
case spv::BuiltInTessLevelOuter: builtin_str = "TessLevelOuter"; break;
default: builtin_str = string("builtin #") + to_string(res.builtin);
}
fprintf(stderr, "Builtin %s (%s) (active: %s).\n", builtin_str.c_str(), type_str.c_str(), active ? "yes" : "no");
}
fprintf(stderr, "=============\n\n");
}
static void print_resources(const Compiler &compiler, const char *tag, const SmallVector<Resource> &resources)
{
fprintf(stderr, "%s\n", tag);
@@ -444,6 +530,8 @@ static void print_resources(const Compiler &compiler, const ShaderResources &res
print_resources(compiler, "push", res.push_constant_buffers);
print_resources(compiler, "counters", res.atomic_counters);
print_resources(compiler, "acceleration structures", res.acceleration_structures);
print_resources(compiler, spv::StorageClassInput, res.builtin_inputs);
print_resources(compiler, spv::StorageClassOutput, res.builtin_outputs);
}
static void print_push_constant_resources(const Compiler &compiler, const SmallVector<Resource> &res)
@@ -566,10 +654,16 @@ struct CLIArguments
uint32_t msl_r32ui_linear_texture_alignment = 4;
uint32_t msl_r32ui_alignment_constant_id = 65535;
bool msl_texture_1d_as_2d = false;
bool msl_ios_use_simdgroup_functions = false;
bool msl_emulate_subgroups = false;
uint32_t msl_fixed_subgroup_size = 0;
bool msl_force_sample_rate_shading = false;
const char *msl_combined_sampler_suffix = nullptr;
bool glsl_emit_push_constant_as_ubo = false;
bool glsl_emit_ubo_as_plain_uniforms = false;
bool glsl_force_flattened_io_blocks = false;
SmallVector<pair<uint32_t, uint32_t>> glsl_ext_framebuffer_fetch;
bool glsl_ext_framebuffer_fetch_noncoherent = false;
bool vulkan_glsl_disable_ext_samplerless_texture_functions = false;
bool emit_line_directives = false;
bool enable_storage_image_qualifier_deduction = true;
@@ -586,6 +680,8 @@ struct CLIArguments
SmallVector<VariableTypeRemap> variable_type_remaps;
SmallVector<InterfaceVariableRename> interface_variable_renames;
SmallVector<HLSLVertexAttributeRemap> hlsl_attr_remap;
SmallVector<std::pair<uint32_t, uint32_t>> masked_stage_outputs;
SmallVector<BuiltIn> masked_stage_builtins;
string entry;
string entry_stage;
@@ -660,6 +756,7 @@ static void print_help_glsl()
"\t[--glsl-emit-ubo-as-plain-uniforms]:\n\t\tInstead of emitting UBOs, emit them as plain uniform structs.\n"
"\t[--glsl-remap-ext-framebuffer-fetch input-attachment color-location]:\n\t\tRemaps an input attachment to use GL_EXT_shader_framebuffer_fetch.\n"
"\t\tgl_LastFragData[location] is read from. The attachment to read from must be declared as an output in the shader.\n"
"\t[--glsl-ext-framebuffer-fetch-noncoherent]:\n\t\tUses noncoherent qualifier for framebuffer fetch.\n"
"\t[--vulkan-glsl-disable-ext-samplerless-texture-functions]:\n\t\tDo not allow use of GL_EXT_samperless_texture_functions, even in Vulkan GLSL.\n"
"\t\tUse of texelFetch and similar might have to create dummy samplers to work around it.\n"
"\t[--combined-samplers-inherit-bindings]:\n\t\tInherit binding information from the textures when building combined image samplers from separate textures and samplers.\n"
@@ -779,7 +876,17 @@ static void print_help_msl()
"\t[--msl-r32ui-linear-texture-align-constant-id <id>]:\n\t\tThe function constant ID to use for the linear texture alignment.\n"
"\t\tOn MSL 1.2 or later, you can override the alignment by setting this function constant.\n"
"\t[--msl-texture-1d-as-2d]:\n\t\tEmit Image variables of dimension Dim1D as texture2d.\n"
"\t\tIn Metal, 1D textures do not support all features that 2D textures do. Use this option if your code relies on these features.\n");
"\t\tIn Metal, 1D textures do not support all features that 2D textures do. Use this option if your code relies on these features.\n"
"\t[--msl-ios-use-simdgroup-functions]:\n\t\tUse simd_*() functions for subgroup ops instead of quad_*().\n"
"\t\tRecent Apple GPUs support SIMD-groups larger than a quad. Use this option to take advantage of this support.\n"
"\t[--msl-emulate-subgroups]:\n\t\tAssume subgroups of size 1.\n"
"\t\tIntended for Vulkan Portability implementations where Metal support for SIMD-groups is insufficient for true subgroups.\n"
"\t[--msl-fixed-subgroup-size <size>]:\n\t\tAssign a constant <size> to the SubgroupSize builtin.\n"
"\t\tIntended for Vulkan Portability implementations where VK_EXT_subgroup_size_control is not supported or disabled.\n"
"\t\tIf 0, assume variable subgroup size as actually exposed by Metal.\n"
"\t[--msl-force-sample-rate-shading]:\n\t\tForce fragment shaders to run per sample.\n"
"\t\tThis adds a [[sample_id]] parameter if none is already present.\n"
"\t[--msl-combined-sampler-suffix <suffix>]:\n\t\tUses a custom suffix for combined samplers.\n");
// clang-format on
}
@@ -801,6 +908,11 @@ static void print_help_common()
"\t\tGLSL: Rewrites [0, w] Z range (D3D/Metal/Vulkan) to GL-style [-w, w].\n"
"\t\tHLSL/MSL: Rewrites [-w, w] Z range (GL) to D3D/Metal/Vulkan-style [0, w].\n"
"\t[--flip-vert-y]:\n\t\tInverts gl_Position.y (or equivalent) at the end of a vertex shader. This is equivalent to using negative viewport height.\n"
"\t[--mask-stage-output-location <location> <component>]:\n"
"\t\tIf a stage output variable with matching location and component is active, optimize away the variable if applicable.\n"
"\t[--mask-stage-output-builtin <Position|PointSize|ClipDistance|CullDistance>]:\n"
"\t\tIf a stage output variable with matching builtin is active, "
"optimize away the variable if it can affect cross-stage linking correctness.\n"
);
// clang-format on
}
@@ -829,7 +941,7 @@ static void print_help()
// clang-format off
fprintf(stderr, "Usage: spirv-cross <...>\n"
"\nBasic:\n"
"\t[SPIR-V file]\n"
"\t[SPIR-V file] (- is stdin)\n"
"\t[--output <output path>]: If not provided, prints output to stdout.\n"
"\t[--dump-resources]:\n\t\tPrints a basic reflection of the SPIR-V module along with other output.\n"
"\t[--help]:\n\t\tPrints this help message.\n"
@@ -1021,6 +1133,10 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
msl_opts.r32ui_linear_texture_alignment = args.msl_r32ui_linear_texture_alignment;
msl_opts.r32ui_alignment_constant_id = args.msl_r32ui_alignment_constant_id;
msl_opts.texture_1D_as_2D = args.msl_texture_1d_as_2d;
msl_opts.ios_use_simdgroup_functions = args.msl_ios_use_simdgroup_functions;
msl_opts.emulate_subgroups = args.msl_emulate_subgroups;
msl_opts.fixed_subgroup_size = args.msl_fixed_subgroup_size;
msl_opts.force_sample_rate_shading = args.msl_force_sample_rate_shading;
msl_comp->set_msl_options(msl_opts);
for (auto &v : args.msl_discrete_descriptor_sets)
msl_comp->add_discrete_descriptor_set(v);
@@ -1033,6 +1149,8 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
msl_comp->add_inline_uniform_block(v.first, v.second);
for (auto &v : args.msl_shader_inputs)
msl_comp->add_msl_shader_input(v);
if (args.msl_combined_sampler_suffix)
msl_comp->set_combined_sampler_suffix(args.msl_combined_sampler_suffix);
}
else if (args.hlsl)
compiler.reset(new CompilerHLSL(move(spirv_parser.get_parsed_ir())));
@@ -1055,6 +1173,11 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
compiler->set_variable_type_remap_callback(move(remap_cb));
}
for (auto &masked : args.masked_stage_outputs)
compiler->mask_stage_output_by_location(masked.first, masked.second);
for (auto &masked : args.masked_stage_builtins)
compiler->mask_stage_output_by_builtin(masked);
for (auto &rename : args.entry_point_rename)
compiler->rename_entry_point(rename.old_name, rename.new_name, rename.execution_model);
@@ -1162,7 +1285,7 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
compiler->set_common_options(opts);
for (auto &fetch : args.glsl_ext_framebuffer_fetch)
compiler->remap_ext_framebuffer_fetch(fetch.first, fetch.second);
compiler->remap_ext_framebuffer_fetch(fetch.first, fetch.second, !args.glsl_ext_framebuffer_fetch_noncoherent);
// Set HLSL specific options.
if (args.hlsl)
@@ -1298,6 +1421,7 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
if (args.dump_resources)
{
compiler->update_active_builtins();
print_resources(*compiler, res);
print_push_constant_resources(*compiler, res.push_constant_buffers);
print_spec_constants(*compiler);
@@ -1351,6 +1475,9 @@ static int main_inner(int argc, char *argv[])
uint32_t color_attachment = parser.next_uint();
args.glsl_ext_framebuffer_fetch.push_back({ input_index, color_attachment });
});
cbs.add("--glsl-ext-framebuffer-fetch-noncoherent", [&args](CLIParser &) {
args.glsl_ext_framebuffer_fetch_noncoherent = true;
});
cbs.add("--vulkan-glsl-disable-ext-samplerless-texture-functions",
[&args](CLIParser &) { args.vulkan_glsl_disable_ext_samplerless_texture_functions = true; });
cbs.add("--disable-storage-image-qualifier-deduction",
@@ -1449,6 +1576,14 @@ static int main_inner(int argc, char *argv[])
cbs.add("--msl-r32ui-linear-texture-align-constant-id",
[&args](CLIParser &parser) { args.msl_r32ui_alignment_constant_id = parser.next_uint(); });
cbs.add("--msl-texture-1d-as-2d", [&args](CLIParser &) { args.msl_texture_1d_as_2d = true; });
cbs.add("--msl-ios-use-simdgroup-functions", [&args](CLIParser &) { args.msl_ios_use_simdgroup_functions = true; });
cbs.add("--msl-emulate-subgroups", [&args](CLIParser &) { args.msl_emulate_subgroups = true; });
cbs.add("--msl-fixed-subgroup-size",
[&args](CLIParser &parser) { args.msl_fixed_subgroup_size = parser.next_uint(); });
cbs.add("--msl-force-sample-rate-shading", [&args](CLIParser &) { args.msl_force_sample_rate_shading = true; });
cbs.add("--msl-combined-sampler-suffix", [&args](CLIParser &parser) {
args.msl_combined_sampler_suffix = parser.next_string();
});
cbs.add("--extension", [&args](CLIParser &parser) { args.extensions.push_back(parser.next_string()); });
cbs.add("--rename-entry-point", [&args](CLIParser &parser) {
auto old_name = parser.next_string();
@@ -1518,7 +1653,33 @@ static int main_inner(int argc, char *argv[])
cbs.add("--no-support-nonzero-baseinstance", [&](CLIParser &) { args.support_nonzero_baseinstance = false; });
cbs.add("--emit-line-directives", [&args](CLIParser &) { args.emit_line_directives = true; });
cbs.add("--mask-stage-output-location", [&](CLIParser &parser) {
uint32_t location = parser.next_uint();
uint32_t component = parser.next_uint();
args.masked_stage_outputs.push_back({ location, component });
});
cbs.add("--mask-stage-output-builtin", [&](CLIParser &parser) {
BuiltIn masked_builtin = BuiltInMax;
std::string builtin = parser.next_string();
if (builtin == "Position")
masked_builtin = BuiltInPosition;
else if (builtin == "PointSize")
masked_builtin = BuiltInPointSize;
else if (builtin == "CullDistance")
masked_builtin = BuiltInCullDistance;
else if (builtin == "ClipDistance")
masked_builtin = BuiltInClipDistance;
else
{
print_help();
exit(EXIT_FAILURE);
}
args.masked_stage_builtins.push_back(masked_builtin);
});
cbs.default_handler = [&args](const char *value) { args.input = value; };
cbs.add("-", [&args](CLIParser &) { args.input = "-"; });
cbs.error_handler = [] { print_help(); };
CLIParser parser{ move(cbs), argc - 1, argv + 1 };

View File

@@ -8,7 +8,7 @@ struct SPIRV_Cross_Output
int2 Size : SV_Target0;
};
uint2 SPIRV_Cross_textureSize(Texture2D<float4> Tex, uint Level, out uint Param)
uint2 spvTextureSize(Texture2D<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(Level, ret.x, ret.y, Param);
@@ -19,7 +19,7 @@ void frag_main()
{
uint _19_dummy_parameter;
uint _20_dummy_parameter;
Size = int2(SPIRV_Cross_textureSize(uTexture, uint(0), _19_dummy_parameter)) + int2(SPIRV_Cross_textureSize(uTexture, uint(1), _20_dummy_parameter));
Size = int2(spvTextureSize(uTexture, uint(0), _19_dummy_parameter)) + int2(spvTextureSize(uTexture, uint(1), _20_dummy_parameter));
}
SPIRV_Cross_Output main()

View File

@@ -29,15 +29,18 @@ void frag_main()
#line 16 "test.frag"
FragColor = 4.0f;
}
#line 19 "test.frag"
for (int _127 = 0; float(_127) < (40.0f + vColor); )
{
#line 21 "test.frag"
FragColor += 0.20000000298023223876953125f;
#line 22 "test.frag"
FragColor += 0.300000011920928955078125f;
#line 19 "test.frag"
_127 += (int(vColor) + 5);
continue;
}
#line 25 "test.frag"
switch (int(vColor))
{
case 0:
@@ -64,7 +67,10 @@ void frag_main()
}
for (;;)
{
#line 42 "test.frag"
FragColor += (10.0f + vColor);
#line 43 "test.frag"
#line 42 "test.frag"
#line 43 "test.frag"
if (FragColor < 100.0f)
{
@@ -74,6 +80,7 @@ void frag_main()
break;
}
}
#line 48 "test.frag"
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@@ -5,12 +5,12 @@ struct SPIRV_Cross_Output
float4 FragColor : SV_Target0;
};
uint64_t SPIRV_Cross_packUint2x32(uint2 value)
uint64_t spvPackUint2x32(uint2 value)
{
return (uint64_t(value.y) << 32) | uint64_t(value.x);
}
uint2 SPIRV_Cross_unpackUint2x32(uint64_t value)
uint2 spvUnpackUint2x32(uint64_t value)
{
uint2 Unpacked;
Unpacked.x = uint(value & 0xffffffff);
@@ -20,7 +20,7 @@ uint2 SPIRV_Cross_unpackUint2x32(uint64_t value)
void frag_main()
{
uint2 unpacked = SPIRV_Cross_unpackUint2x32(SPIRV_Cross_packUint2x32(uint2(18u, 52u)));
uint2 unpacked = spvUnpackUint2x32(spvPackUint2x32(uint2(18u, 52u)));
FragColor = float4(float(unpacked.x), float(unpacked.y), 1.0f, 1.0f);
}

View File

@@ -5,7 +5,7 @@ ByteAddressBuffer _20 : register(t1);
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
float2x2 SPIRV_Cross_Inverse(float2x2 m)
float2x2 spvInverse(float2x2 m)
{
float2x2 adj; // The adjoint matrix (inverse after dividing by determinant)
@@ -25,29 +25,29 @@ float2x2 SPIRV_Cross_Inverse(float2x2 m)
}
// Returns the determinant of a 2x2 matrix.
float SPIRV_Cross_Det2x2(float a1, float a2, float b1, float b2)
float spvDet2x2(float a1, float a2, float b1, float b2)
{
return a1 * b2 - b1 * a2;
}
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
float3x3 SPIRV_Cross_Inverse(float3x3 m)
float3x3 spvInverse(float3x3 m)
{
float3x3 adj; // The adjoint matrix (inverse after dividing by determinant)
// Create the transpose of the cofactors, as the classical adjoint of the matrix.
adj[0][0] = SPIRV_Cross_Det2x2(m[1][1], m[1][2], m[2][1], m[2][2]);
adj[0][1] = -SPIRV_Cross_Det2x2(m[0][1], m[0][2], m[2][1], m[2][2]);
adj[0][2] = SPIRV_Cross_Det2x2(m[0][1], m[0][2], m[1][1], m[1][2]);
adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]);
adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]);
adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]);
adj[1][0] = -SPIRV_Cross_Det2x2(m[1][0], m[1][2], m[2][0], m[2][2]);
adj[1][1] = SPIRV_Cross_Det2x2(m[0][0], m[0][2], m[2][0], m[2][2]);
adj[1][2] = -SPIRV_Cross_Det2x2(m[0][0], m[0][2], m[1][0], m[1][2]);
adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]);
adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]);
adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]);
adj[2][0] = SPIRV_Cross_Det2x2(m[1][0], m[1][1], m[2][0], m[2][1]);
adj[2][1] = -SPIRV_Cross_Det2x2(m[0][0], m[0][1], m[2][0], m[2][1]);
adj[2][2] = SPIRV_Cross_Det2x2(m[0][0], m[0][1], m[1][0], m[1][1]);
adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]);
adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]);
adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]);
// Calculate the determinant as a combination of the cofactors of the first row.
float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]);
@@ -58,37 +58,37 @@ float3x3 SPIRV_Cross_Inverse(float3x3 m)
}
// Returns the determinant of a 3x3 matrix.
float SPIRV_Cross_Det3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
{
return a1 * SPIRV_Cross_Det2x2(b2, b3, c2, c3) - b1 * SPIRV_Cross_Det2x2(a2, a3, c2, c3) + c1 * SPIRV_Cross_Det2x2(a2, a3, b2, b3);
return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3);
}
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
float4x4 SPIRV_Cross_Inverse(float4x4 m)
float4x4 spvInverse(float4x4 m)
{
float4x4 adj; // The adjoint matrix (inverse after dividing by determinant)
// Create the transpose of the cofactors, as the classical adjoint of the matrix.
adj[0][0] = SPIRV_Cross_Det3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]);
adj[0][1] = -SPIRV_Cross_Det3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]);
adj[0][2] = SPIRV_Cross_Det3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]);
adj[0][3] = -SPIRV_Cross_Det3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]);
adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]);
adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]);
adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]);
adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]);
adj[1][0] = -SPIRV_Cross_Det3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]);
adj[1][1] = SPIRV_Cross_Det3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]);
adj[1][2] = -SPIRV_Cross_Det3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]);
adj[1][3] = SPIRV_Cross_Det3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]);
adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]);
adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]);
adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]);
adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]);
adj[2][0] = SPIRV_Cross_Det3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]);
adj[2][1] = -SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]);
adj[2][2] = SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]);
adj[2][3] = -SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]);
adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]);
adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]);
adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]);
adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]);
adj[3][0] = -SPIRV_Cross_Det3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]);
adj[3][1] = SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]);
adj[3][2] = -SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]);
adj[3][3] = SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]);
adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]);
adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]);
adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]);
adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]);
// Calculate the determinant as a combination of the cofactors of the first row.
float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]);
@@ -101,16 +101,16 @@ float4x4 SPIRV_Cross_Inverse(float4x4 m)
void comp_main()
{
float2x2 _23 = asfloat(uint2x2(_20.Load2(0), _20.Load2(8)));
float2x2 _24 = SPIRV_Cross_Inverse(_23);
float2x2 _24 = spvInverse(_23);
_15.Store2(0, asuint(_24[0]));
_15.Store2(8, asuint(_24[1]));
float3x3 _29 = asfloat(uint3x3(_20.Load3(16), _20.Load3(32), _20.Load3(48)));
float3x3 _30 = SPIRV_Cross_Inverse(_29);
float3x3 _30 = spvInverse(_29);
_15.Store3(16, asuint(_30[0]));
_15.Store3(32, asuint(_30[1]));
_15.Store3(48, asuint(_30[2]));
float4x4 _35 = asfloat(uint4x4(_20.Load4(64), _20.Load4(80), _20.Load4(96), _20.Load4(112)));
float4x4 _36 = SPIRV_Cross_Inverse(_35);
float4x4 _36 = spvInverse(_35);
_15.Store4(64, asuint(_36[0]));
_15.Store4(80, asuint(_36[1]));
_15.Store4(96, asuint(_36[2]));

View File

@@ -15,21 +15,21 @@ struct SPIRV_Cross_Output
uint FP16Out : SV_Target1;
};
uint SPIRV_Cross_packHalf2x16(float2 value)
uint spvPackHalf2x16(float2 value)
{
uint2 Packed = f32tof16(value);
return Packed.x | (Packed.y << 16);
}
float2 SPIRV_Cross_unpackHalf2x16(uint value)
float2 spvUnpackHalf2x16(uint value)
{
return f16tof32(uint2(value & 0xffff, value >> 16));
}
void frag_main()
{
FP32Out = SPIRV_Cross_unpackHalf2x16(FP16);
FP16Out = SPIRV_Cross_packHalf2x16(FP32);
FP32Out = spvUnpackHalf2x16(FP16);
FP16Out = spvPackHalf2x16(FP32);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@@ -3,12 +3,15 @@ struct UBO_1_1
float4 v[64];
};
ConstantBuffer<UBO_1_1> ubos[] : register(b0, space3);
ByteAddressBuffer ssbos[] : register(t0, space4);
ConstantBuffer<UBO_1_1> ubos[] : register(b2, space9);
RWByteAddressBuffer ssbos[] : register(u3, space10);
Texture2D<float4> uSamplers[] : register(t0, space0);
SamplerState uSamps[] : register(s0, space2);
Texture2D<float4> uCombinedSamplers[] : register(t0, space1);
SamplerState _uCombinedSamplers_sampler[] : register(s0, space1);
SamplerState uSamps[] : register(s1, space3);
Texture2D<float4> uCombinedSamplers[] : register(t4, space2);
SamplerState _uCombinedSamplers_sampler[] : register(s4, space2);
Texture2DMS<float4> uSamplersMS[] : register(t0, space1);
RWTexture2D<float> uImages[] : register(u5, space7);
RWTexture2D<uint> uImagesU32[] : register(u5, space8);
static int vIndex;
static float4 FragColor;
@@ -25,17 +28,70 @@ struct SPIRV_Cross_Output
float4 FragColor : SV_Target0;
};
uint2 spvTextureSize(Texture2D<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(Level, ret.x, ret.y, Param);
return ret;
}
uint2 spvTextureSize(Texture2DMS<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(ret.x, ret.y, Param);
return ret;
}
uint2 spvImageSize(RWTexture2D<float> Tex, out uint Param)
{
uint2 ret;
Tex.GetDimensions(ret.x, ret.y);
Param = 0u;
return ret;
}
void frag_main()
{
int _23 = vIndex + 10;
int _34 = vIndex + 40;
FragColor = uSamplers[NonUniformResourceIndex(_23)].Sample(uSamps[NonUniformResourceIndex(_34)], vUV);
FragColor = uCombinedSamplers[NonUniformResourceIndex(_23)].Sample(_uCombinedSamplers_sampler[NonUniformResourceIndex(_23)], vUV);
int _66 = vIndex + 20;
FragColor += ubos[NonUniformResourceIndex(_66)].v[_34];
int _84 = vIndex + 50;
int _22 = vIndex + 10;
int _32 = vIndex + 40;
FragColor = uSamplers[NonUniformResourceIndex(_22)].Sample(uSamps[NonUniformResourceIndex(_32)], vUV);
int _49 = _22;
FragColor = uCombinedSamplers[NonUniformResourceIndex(_49)].Sample(_uCombinedSamplers_sampler[NonUniformResourceIndex(_49)], vUV);
int _65 = vIndex + 20;
int _69 = _32;
FragColor += ubos[NonUniformResourceIndex(_65)].v[_69];
int _83 = vIndex + 50;
int _88 = vIndex + 60;
FragColor += asfloat(ssbos[NonUniformResourceIndex(_84)].Load4(_88 * 16 + 0));
FragColor += asfloat(ssbos[NonUniformResourceIndex(_83)].Load4(_88 * 16 + 16));
int _100 = vIndex + 70;
ssbos[NonUniformResourceIndex(_88)].Store4(_100 * 16 + 16, asuint(20.0f.xxxx));
int2 _111 = int2(vUV);
FragColor = uSamplers[NonUniformResourceIndex(_49)].Load(int3(_111, 0));
int _116 = vIndex + 100;
uint _122;
ssbos[_116].InterlockedAdd(0, 100u, _122);
float _136_tmp = uSamplers[NonUniformResourceIndex(_22)].CalculateLevelOfDetail(uSamps[NonUniformResourceIndex(_32)], vUV);
float2 _136 = _136_tmp.xx;
float _143_tmp = uCombinedSamplers[NonUniformResourceIndex(_49)].CalculateLevelOfDetail(_uCombinedSamplers_sampler[NonUniformResourceIndex(_49)], vUV);
float2 _143 = _143_tmp.xx;
float2 _149 = FragColor.xy + (_136 + _143);
FragColor = float4(_149.x, _149.y, FragColor.z, FragColor.w);
int _157;
spvTextureSize(uSamplers[NonUniformResourceIndex(_65)], 0u, _157);
FragColor.x += float(int(_157));
int _174;
spvTextureSize(uSamplersMS[NonUniformResourceIndex(_65)], 0u, _174);
FragColor.y += float(int(_174));
uint _185_dummy_parameter;
float2 _189 = FragColor.xy + float2(int2(spvTextureSize(uSamplers[NonUniformResourceIndex(_65)], uint(0), _185_dummy_parameter)));
FragColor = float4(_189.x, _189.y, FragColor.z, FragColor.w);
FragColor += uImages[NonUniformResourceIndex(_83)][_111].xxxx;
uint _212_dummy_parameter;
float2 _216 = FragColor.xy + float2(int2(spvImageSize(uImages[NonUniformResourceIndex(_65)], _212_dummy_parameter)));
FragColor = float4(_216.x, _216.y, FragColor.z, FragColor.w);
uImages[NonUniformResourceIndex(_88)][_111] = 50.0f.x;
uint _242;
InterlockedAdd(uImagesU32[NonUniformResourceIndex(_100)][_111], 40u, _242);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@@ -11,12 +11,12 @@ struct SPIRV_Cross_Output
float FragColor : SV_Target0;
};
float SPIRV_Cross_Reflect(float i, float n)
float spvReflect(float i, float n)
{
return i - 2.0 * dot(n, i) * n;
}
float SPIRV_Cross_Refract(float i, float n, float eta)
float spvRefract(float i, float n, float eta)
{
float NoI = n * i;
float NoI2 = NoI * NoI;
@@ -33,8 +33,8 @@ float SPIRV_Cross_Refract(float i, float n, float eta)
void frag_main()
{
FragColor = SPIRV_Cross_Refract(vRefract.x, vRefract.y, vRefract.z);
FragColor += SPIRV_Cross_Reflect(vRefract.x, vRefract.y);
FragColor = spvRefract(vRefract.x, vRefract.y, vRefract.z);
FragColor += spvReflect(vRefract.x, vRefract.y);
FragColor += refract(vRefract.xy, vRefract.yz, vRefract.z).y;
FragColor += reflect(vRefract.xy, vRefract.zy).y;
}

View File

@@ -8,7 +8,7 @@ struct SPIRV_Cross_Output
int2 FooOut : SV_Target0;
};
uint2 SPIRV_Cross_textureSize(Texture2D<float4> Tex, uint Level, out uint Param)
uint2 spvTextureSize(Texture2D<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(Level, ret.x, ret.y, Param);
@@ -18,7 +18,7 @@ uint2 SPIRV_Cross_textureSize(Texture2D<float4> Tex, uint Level, out uint Param)
void frag_main()
{
uint _23_dummy_parameter;
FooOut = int2(SPIRV_Cross_textureSize(uTex, uint(0), _23_dummy_parameter));
FooOut = int2(spvTextureSize(uTex, uint(0), _23_dummy_parameter));
}
SPIRV_Cross_Output main()

View File

@@ -27,50 +27,50 @@ struct SPIRV_Cross_Output
uint SNORM16Out : SV_Target4;
};
uint SPIRV_Cross_packUnorm4x8(float4 value)
uint spvPackUnorm4x8(float4 value)
{
uint4 Packed = uint4(round(saturate(value) * 255.0));
return Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24);
}
float4 SPIRV_Cross_unpackUnorm4x8(uint value)
float4 spvUnpackUnorm4x8(uint value)
{
uint4 Packed = uint4(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, value >> 24);
return float4(Packed) / 255.0;
}
uint SPIRV_Cross_packSnorm4x8(float4 value)
uint spvPackSnorm4x8(float4 value)
{
int4 Packed = int4(round(clamp(value, -1.0, 1.0) * 127.0)) & 0xff;
return uint(Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24));
}
float4 SPIRV_Cross_unpackSnorm4x8(uint value)
float4 spvUnpackSnorm4x8(uint value)
{
int SignedValue = int(value);
int4 Packed = int4(SignedValue << 24, SignedValue << 16, SignedValue << 8, SignedValue) >> 24;
return clamp(float4(Packed) / 127.0, -1.0, 1.0);
}
uint SPIRV_Cross_packUnorm2x16(float2 value)
uint spvPackUnorm2x16(float2 value)
{
uint2 Packed = uint2(round(saturate(value) * 65535.0));
return Packed.x | (Packed.y << 16);
}
float2 SPIRV_Cross_unpackUnorm2x16(uint value)
float2 spvUnpackUnorm2x16(uint value)
{
uint2 Packed = uint2(value & 0xffff, value >> 16);
return float2(Packed) / 65535.0;
}
uint SPIRV_Cross_packSnorm2x16(float2 value)
uint spvPackSnorm2x16(float2 value)
{
int2 Packed = int2(round(clamp(value, -1.0, 1.0) * 32767.0)) & 0xffff;
return uint(Packed.x | (Packed.y << 16));
}
float2 SPIRV_Cross_unpackSnorm2x16(uint value)
float2 spvUnpackSnorm2x16(uint value)
{
int SignedValue = int(value);
int2 Packed = int2(SignedValue << 16, SignedValue) >> 16;
@@ -79,16 +79,16 @@ float2 SPIRV_Cross_unpackSnorm2x16(uint value)
void frag_main()
{
FP32Out = SPIRV_Cross_unpackUnorm4x8(UNORM8);
FP32Out = SPIRV_Cross_unpackSnorm4x8(SNORM8);
float2 _21 = SPIRV_Cross_unpackUnorm2x16(UNORM16);
FP32Out = spvUnpackUnorm4x8(UNORM8);
FP32Out = spvUnpackSnorm4x8(SNORM8);
float2 _21 = spvUnpackUnorm2x16(UNORM16);
FP32Out = float4(_21.x, _21.y, FP32Out.z, FP32Out.w);
float2 _26 = SPIRV_Cross_unpackSnorm2x16(SNORM16);
float2 _26 = spvUnpackSnorm2x16(SNORM16);
FP32Out = float4(_26.x, _26.y, FP32Out.z, FP32Out.w);
UNORM8Out = SPIRV_Cross_packUnorm4x8(FP32);
SNORM8Out = SPIRV_Cross_packSnorm4x8(FP32);
UNORM16Out = SPIRV_Cross_packUnorm2x16(FP32.xy);
SNORM16Out = SPIRV_Cross_packSnorm2x16(FP32.zw);
UNORM8Out = spvPackUnorm4x8(FP32);
SNORM8Out = spvPackSnorm4x8(FP32);
UNORM16Out = spvPackUnorm2x16(FP32.xy);
SNORM16Out = spvPackSnorm2x16(FP32.zw);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@@ -0,0 +1,40 @@
static float4 gl_Position;
static float4 vInput0;
static float4 vInput1;
static float4 vInput2;
static float4 vColor;
struct SPIRV_Cross_Input
{
float4 vInput0 : TEXCOORD0;
float4 vInput1 : TEXCOORD1;
float4 vInput2 : TEXCOORD2;
};
struct SPIRV_Cross_Output
{
precise float4 vColor : TEXCOORD0;
precise float4 gl_Position : SV_Position;
};
void vert_main()
{
float4 _20 = vInput1 * vInput2;
float4 _21 = vInput0 + _20;
gl_Position = _21;
float4 _27 = vInput0 - vInput1;
float4 _29 = _27 * vInput2;
vColor = _29;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vInput0 = stage_input.vInput0;
vInput1 = stage_input.vInput1;
vInput2 = stage_input.vInput2;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.vColor = vColor;
return stage_output;
}

View File

@@ -0,0 +1,39 @@
static float4 gl_Position;
static float4 vA;
static float4 vB;
static float4 vC;
struct SPIRV_Cross_Input
{
float4 vA : TEXCOORD0;
float4 vB : TEXCOORD1;
float4 vC : TEXCOORD2;
};
struct SPIRV_Cross_Output
{
float4 gl_Position : SV_Position;
};
void vert_main()
{
precise float4 _15 = vA * vB;
precise float4 _19 = vA + vB;
precise float4 _23 = vA - vB;
precise float4 _30 = _15 + vC;
precise float4 _34 = _15 + _19;
precise float4 _36 = _34 + _23;
precise float4 _38 = _36 + _30;
gl_Position = _38;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vA = stage_input.vA;
vB = stage_input.vB;
vC = stage_input.vC;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
return stage_output;
}

View File

@@ -1,10 +0,0 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
kernel void main0(texture2d<float, access::read_write> TargetTexture [[texture(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]])
{
TargetTexture.write((TargetTexture.read(uint2(gl_WorkGroupID.xy)).xy + float2(1.0)).xyyy, uint2((gl_WorkGroupID.xy + uint2(1u))));
}

View File

@@ -32,15 +32,18 @@ fragment main0_out main0(main0_in in [[stage_in]])
#line 16 "test.frag"
out.FragColor = 4.0;
}
#line 19 "test.frag"
for (int _127 = 0; float(_127) < (40.0 + in.vColor); )
{
#line 21 "test.frag"
out.FragColor += 0.20000000298023223876953125;
#line 22 "test.frag"
out.FragColor += 0.300000011920928955078125;
#line 19 "test.frag"
_127 += (int(in.vColor) + 5);
continue;
}
#line 25 "test.frag"
switch (int(in.vColor))
{
case 0:
@@ -67,7 +70,10 @@ fragment main0_out main0(main0_in in [[stage_in]])
}
for (;;)
{
#line 42 "test.frag"
out.FragColor += (10.0 + in.vColor);
#line 43 "test.frag"
#line 42 "test.frag"
#line 43 "test.frag"
if (out.FragColor < 100.0)
{
@@ -77,6 +83,7 @@ fragment main0_out main0(main0_in in [[stage_in]])
break;
}
}
#line 48 "test.frag"
return out;
}

View File

@@ -15,7 +15,7 @@ struct TessLevels
kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1]);
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1);
spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(sb_levels.outer1);

View File

@@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position [[position]];
@@ -10,14 +51,22 @@ struct main0_out
struct main0_patchIn
{
float2 gl_TessLevelInner [[attribute(0)]];
float4 gl_TessLevelOuter [[attribute(1)]];
float4 gl_TessLevelOuter [[attribute(0)]];
float2 gl_TessLevelInner [[attribute(1)]];
};
[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoord [[position_in_patch]])
{
main0_out out = {};
out.gl_Position = float4(((gl_TessCoord.x * patchIn.gl_TessLevelInner.x) * patchIn.gl_TessLevelOuter.x) + (((1.0 - gl_TessCoord.x) * patchIn.gl_TessLevelInner.x) * patchIn.gl_TessLevelOuter.z), ((gl_TessCoord.y * patchIn.gl_TessLevelInner.y) * patchIn.gl_TessLevelOuter.y) + (((1.0 - gl_TessCoord.y) * patchIn.gl_TessLevelInner.y) * patchIn.gl_TessLevelOuter.w), 0.0, 1.0);
spvUnsafeArray<float, 2> gl_TessLevelInner = {};
spvUnsafeArray<float, 4> gl_TessLevelOuter = {};
gl_TessLevelInner[0] = patchIn.gl_TessLevelInner.x;
gl_TessLevelInner[1] = patchIn.gl_TessLevelInner.y;
gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter.x;
gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter.y;
gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter.z;
gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter.w;
out.gl_Position = float4(((gl_TessCoord.x * gl_TessLevelInner[0]) * gl_TessLevelOuter[0]) + (((1.0 - gl_TessCoord.x) * gl_TessLevelInner[0]) * gl_TessLevelOuter[2]), ((gl_TessCoord.y * gl_TessLevelInner[1]) * gl_TessLevelOuter[1]) + (((1.0 - gl_TessCoord.y) * gl_TessLevelInner[1]) * gl_TessLevelOuter[3]), 0.0, 1.0);
return out;
}

View File

@@ -5,6 +5,7 @@ using namespace metal;
struct main0_out
{
half4 out_var_SV_Target [[user(locn0)]];
float4 gl_Position [[position]];
};

View File

@@ -26,7 +26,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 1];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 1;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1]);
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1);
spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375);
spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375);

View File

@@ -16,8 +16,7 @@ struct main0_out
struct main0_in
{
float3 Boo_a;
uint3 Boo_b;
Boo vInput;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]])
@@ -25,9 +24,8 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
Boo _26 = Boo{ gl_in[gl_InvocationID].Boo_a, gl_in[gl_InvocationID].Boo_b };
gl_out[gl_InvocationID].vVertex = _26;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
gl_out[gl_InvocationID].vVertex = gl_in[gl_InvocationID].vInput;
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(2.0);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.0);

View File

@@ -0,0 +1,99 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 m_location_0 [[color(0)]];
float4 m_location_1 [[color(1)]];
float4 m_location_2 [[color(2)]];
};
struct main0_in
{
float InC_0 [[user(locn0_1), flat]];
float InA_0 [[user(locn1), flat]];
float InC_1 [[user(locn1_1), flat]];
float2 InB_0 [[user(locn1_2), flat]];
float InA_1 [[user(locn2), flat]];
float InC_2 [[user(locn2_1), flat]];
float2 InB_1 [[user(locn2_2), flat]];
float InD [[user(locn3_1), sample_perspective]];
float InE [[user(locn4_2), center_no_perspective]];
float InF [[user(locn5_3), centroid_perspective]];
};
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
spvUnsafeArray<float, 2> A = {};
spvUnsafeArray<float2, 2> B = {};
spvUnsafeArray<float, 3> C = {};
float D = {};
spvUnsafeArray<float, 2> InA = {};
spvUnsafeArray<float2, 2> InB = {};
spvUnsafeArray<float, 3> InC = {};
InA[0] = in.InA_0;
InA[1] = in.InA_1;
InB[0] = in.InB_0;
InB[1] = in.InB_1;
InC[0] = in.InC_0;
InC[1] = in.InC_1;
InC[2] = in.InC_2;
A = InA;
B = InB;
C = InC;
D = (in.InD + in.InE) + in.InF;
out.m_location_1.x = A[0];
out.m_location_2.x = A[1];
out.m_location_1.zw = B[0];
out.m_location_2.zw = B[1];
out.m_location_0.y = C[0];
out.m_location_1.y = C[1];
out.m_location_2.y = C[2];
out.m_location_0.w = D;
return out;
}

View File

@@ -0,0 +1,23 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float4 vColor [[user(locn0)]];
float2 vTex [[user(locn1)]];
};
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]], uint gl_SampleID [[sample_id]])
{
main0_out out = {};
out.FragColor = in.vColor * uTex.sample(uTexSmplr, in.vTex);
return out;
}

View File

@@ -0,0 +1,67 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float gl_CullDistance_0 [[user(cull0)]];
float gl_CullDistance_1 [[user(cull1)]];
};
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
spvUnsafeArray<float, 2> gl_CullDistance = {};
gl_CullDistance[0] = in.gl_CullDistance_0;
gl_CullDistance[1] = in.gl_CullDistance_1;
out.FragColor = float4((1.0 - gl_CullDistance[0]) - gl_CullDistance[1]);
return out;
}

View File

@@ -11,6 +11,7 @@ struct main0_out
fragment main0_out main0(texture2d_ms_array<float> uSubpass0 [[texture(0)]], texture2d_ms_array<float> uSubpass1 [[texture(1)]], uint gl_SampleID [[sample_id]], float4 gl_FragCoord [[position]], uint gl_Layer [[render_target_array_index]])
{
main0_out out = {};
gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
out.FragColor = (uSubpass0.read(uint2(gl_FragCoord.xy), gl_Layer, 1) + uSubpass1.read(uint2(gl_FragCoord.xy), gl_Layer, 2)) + uSubpass0.read(uint2(gl_FragCoord.xy), gl_Layer, gl_SampleID);
return out;
}

View File

@@ -11,6 +11,7 @@ struct main0_out
fragment main0_out main0(texture2d_ms<float> uSubpass0 [[texture(0)]], texture2d_ms<float> uSubpass1 [[texture(1)]], uint gl_SampleID [[sample_id]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
out.FragColor = (uSubpass0.read(uint2(gl_FragCoord.xy), 1) + uSubpass1.read(uint2(gl_FragCoord.xy), 2)) + uSubpass0.read(uint2(gl_FragCoord.xy), gl_SampleID);
return out;
}

View File

@@ -11,6 +11,7 @@ struct main0_out
fragment main0_out main0(constant uint* spvViewMask [[buffer(24)]], texture2d_ms_array<float> uSubpass0 [[texture(0)]], texture2d_ms_array<float> uSubpass1 [[texture(1)]], uint gl_SampleID [[sample_id]], float4 gl_FragCoord [[position]], uint gl_ViewIndex [[render_target_array_index]])
{
main0_out out = {};
gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
gl_ViewIndex += spvViewMask[0];
out.FragColor = (uSubpass0.read(uint2(gl_FragCoord.xy), gl_ViewIndex, 1) + uSubpass1.read(uint2(gl_FragCoord.xy), gl_ViewIndex, 2)) + uSubpass0.read(uint2(gl_FragCoord.xy), gl_ViewIndex, gl_SampleID);
return out;

View File

@@ -44,10 +44,10 @@ fragment main0_out main0(main0_in in [[stage_in]], constant UBO* ubos_0 [[buffer
out.FragColor = uSamplers[_25].sample(uSamps[_37], in.vUV);
out.FragColor = uCombinedSamplers[_25].sample(uCombinedSamplersSmplr[_25], in.vUV);
int _69 = in.vIndex + 20;
out.FragColor += ubos[(_69)]->v[_37];
out.FragColor += ubos[_69]->v[_37];
int _87 = in.vIndex + 50;
int _91 = in.vIndex + 60;
out.FragColor += ssbos[(_87)]->v[_91];
out.FragColor += ssbos[_87]->v[_91];
return out;
}

View File

@@ -0,0 +1,72 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float gl_ClipDistance_0 [[user(clip0)]];
float gl_ClipDistance_1 [[user(clip1)]];
float gl_CullDistance_0 [[user(cull0)]];
float gl_CullDistance_1 [[user(cull1)]];
};
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
spvUnsafeArray<float, 2> gl_CullDistance = {};
spvUnsafeArray<float, 2> gl_ClipDistance = {};
gl_CullDistance[0] = in.gl_CullDistance_0;
gl_CullDistance[1] = in.gl_CullDistance_1;
gl_ClipDistance[0] = in.gl_ClipDistance_0;
gl_ClipDistance[1] = in.gl_ClipDistance_1;
out.FragColor = float4(gl_CullDistance[0], gl_CullDistance[1], gl_ClipDistance[0], gl_ClipDistance[1]);
return out;
}

View File

@@ -0,0 +1,19 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
fragment main0_out main0(texture2d_array<float> tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]])
{
main0_out out = {};
gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
float3 _28 = float3(gl_FragCoord.xy, float(gl_SampleID));
out.FragColor = tex.sample(texSmplr, _28.xy, uint(round(_28.z)));
return out;
}

View File

@@ -0,0 +1,24 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float foo [[user(locn0), sample_perspective]];
};
fragment main0_out main0(main0_in in [[stage_in]], texture2d_array<float> tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]])
{
main0_out out = {};
gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
float3 _26 = float3(gl_FragCoord.xy, in.foo);
out.FragColor = tex.sample(texSmplr, _26.xy, uint(round(_26.z)));
return out;
}

View File

@@ -0,0 +1,19 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
fragment main0_out main0(texture2d<float> tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]])
{
main0_out out = {};
gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
float2 gl_SamplePosition = get_sample_position(gl_SampleID);
out.FragColor = tex.sample(texSmplr, (gl_FragCoord.xy - gl_SamplePosition));
return out;
}

View File

@@ -0,0 +1,18 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
fragment main0_out main0(texture2d<float> tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]])
{
main0_out out = {};
gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
out.FragColor = tex.sample(texSmplr, gl_FragCoord.xy);
return out;
}

View File

@@ -0,0 +1,56 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
uint2 FragColor [[color(0)]];
};
inline uint spvSubgroupBallotFindLSB(uint4 ballot, uint gl_SubgroupSize)
{
uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0));
ballot &= mask;
return select(ctz(ballot.x), select(32 + ctz(ballot.y), select(64 + ctz(ballot.z), select(96 + ctz(ballot.w), uint(-1), ballot.w == 0), ballot.z == 0), ballot.y == 0), ballot.x == 0);
}
inline uint spvSubgroupBallotFindMSB(uint4 ballot, uint gl_SubgroupSize)
{
uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0));
ballot &= mask;
return select(128 - (clz(ballot.w) + 1), select(96 - (clz(ballot.z) + 1), select(64 - (clz(ballot.y) + 1), select(32 - (clz(ballot.x) + 1), uint(-1), ballot.x == 0), ballot.y == 0), ballot.z == 0), ballot.w == 0);
}
inline uint spvPopCount4(uint4 ballot)
{
return popcount(ballot.x) + popcount(ballot.y) + popcount(ballot.z) + popcount(ballot.w);
}
inline uint spvSubgroupBallotBitCount(uint4 ballot, uint gl_SubgroupSize)
{
uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0));
return spvPopCount4(ballot & mask);
}
inline uint spvSubgroupBallotInclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID)
{
uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0));
return spvPopCount4(ballot & mask);
}
inline uint spvSubgroupBallotExclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID)
{
uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0));
return spvPopCount4(ballot & mask);
}
fragment main0_out main0(uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]], uint gl_SubgroupSize [[threads_per_simdgroup]])
{
main0_out out = {};
out.FragColor.x = (((spvSubgroupBallotFindLSB(uint4(1u, 2u, 3u, 4u), gl_SubgroupSize) + spvSubgroupBallotFindMSB(uint4(1u, 2u, 3u, 4u), gl_SubgroupSize)) + spvSubgroupBallotBitCount(uint4(1u, 2u, 3u, 4u), gl_SubgroupSize)) + spvSubgroupBallotInclusiveBitCount(uint4(1u, 2u, 3u, 4u), gl_SubgroupInvocationID)) + spvSubgroupBallotExclusiveBitCount(uint4(1u, 2u, 3u, 4u), gl_SubgroupInvocationID);
return out;
}

View File

@@ -0,0 +1,188 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> pFoo;
};
struct main0_in
{
spvUnsafeArray<float4, 2> iFoo;
float4 ipFoo;
};
template<typename T, uint A>
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]])
{
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
threadgroup float4 spvStorageFoo[8][4][2];
threadgroup float4 (&Foo)[4][2] = spvStorageFoo[(gl_GlobalInvocationID.x / 4) % 8];
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
gl_out[gl_InvocationID].gl_Position = float4(1.0);
spvArrayCopyFromDeviceToThreadGroup1(Foo[gl_InvocationID], gl_in[gl_InvocationID].iFoo.elements);
if (gl_InvocationID == 0)
{
spvUnsafeArray<float4, 2> _56 = spvUnsafeArray<float4, 2>({ gl_in[0].ipFoo, gl_in[1].ipFoo });
patchOut.pFoo = _56;
}
}

View File

@@ -0,0 +1,191 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> pFoo;
};
struct main0_in
{
float4 iFoo_0 [[attribute(0)]];
float4 iFoo_1 [[attribute(1)]];
float4 ipFoo [[attribute(2)]];
};
template<typename T, uint A>
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
threadgroup float4 Foo[4][2];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
if (gl_InvocationID < spvIndirectParams[0])
gl_in[gl_InvocationID] = in;
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 4)
return;
gl_out[gl_InvocationID].gl_Position = float4(1.0);
spvUnsafeArray<float4, 2> _38 = spvUnsafeArray<float4, 2>({ gl_in[gl_InvocationID].iFoo_0, gl_in[gl_InvocationID].iFoo_1 });
spvArrayCopyFromStackToThreadGroup1(Foo[gl_InvocationID], _38.elements);
if (gl_InvocationID == 0)
{
spvUnsafeArray<float4, 2> _56 = spvUnsafeArray<float4, 2>({ gl_in[0].ipFoo, gl_in[1].ipFoo });
patchOut.pFoo = _56;
}
}

View File

@@ -0,0 +1,79 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
spvUnsafeArray<float4, 2> Foo;
float4 gl_Position;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> pFoo;
};
struct main0_in
{
spvUnsafeArray<float4, 2> iFoo;
float4 ipFoo;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]])
{
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
gl_out[gl_InvocationID].gl_Position = float4(1.0);
gl_out[gl_InvocationID].Foo = gl_in[gl_InvocationID].iFoo;
if (gl_InvocationID == 0)
{
spvUnsafeArray<float4, 2> _56 = spvUnsafeArray<float4, 2>({ gl_in[0].ipFoo, gl_in[1].ipFoo });
patchOut.pFoo = _56;
}
}

View File

@@ -0,0 +1,83 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
spvUnsafeArray<float4, 2> Foo;
float4 gl_Position;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> pFoo;
};
struct main0_in
{
float4 iFoo_0 [[attribute(0)]];
float4 iFoo_1 [[attribute(1)]];
float4 ipFoo [[attribute(2)]];
};
kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
if (gl_InvocationID < spvIndirectParams[0])
gl_in[gl_InvocationID] = in;
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 4)
return;
gl_out[gl_InvocationID].gl_Position = float4(1.0);
spvUnsafeArray<float4, 2> _38 = spvUnsafeArray<float4, 2>({ gl_in[gl_InvocationID].iFoo_0, gl_in[gl_InvocationID].iFoo_1 });
gl_out[gl_InvocationID].Foo = _38;
if (gl_InvocationID == 0)
{
spvUnsafeArray<float4, 2> _56 = spvUnsafeArray<float4, 2>({ gl_in[0].ipFoo, gl_in[1].ipFoo });
patchOut.pFoo = _56;
}
}

View File

@@ -0,0 +1,35 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct V
{
float4 a;
float4 b;
float4 c;
float4 d;
};
struct main0_out
{
float4 V_b;
float4 V_c;
float4 V_d;
float4 gl_Position;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]])
{
V _22 = {};
device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x];
if (any(gl_GlobalInvocationID >= spvStageInputSize))
return;
out.gl_Position = float4(1.0);
_22.a = float4(2.0);
_22.b = float4(3.0);
out.V_b = _22.b;
out.V_c = _22.c;
out.V_d = _22.d;
}

View File

@@ -0,0 +1,41 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct P
{
float a;
float b;
};
struct C
{
float a;
float b;
};
struct main0_out
{
float C_a;
float C_b;
float4 gl_Position;
};
struct main0_patchOut
{
float P_b;
};
kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
threadgroup P _11;
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
_11.a = 1.0;
patchOut.P_b = 2.0;
gl_out[gl_InvocationID].C_a = 3.0;
gl_out[gl_InvocationID].C_b = 4.0;
gl_out[gl_InvocationID].gl_Position = float4(1.0);
}

View File

@@ -0,0 +1,44 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct P
{
float a;
float b;
};
struct C
{
float a;
float b;
};
struct main0_out
{
float C_a;
float C_b;
float4 gl_Position;
};
struct main0_patchOut
{
float P_b;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
threadgroup P spvStorage_11[8];
threadgroup P (&_11) = spvStorage_11[(gl_GlobalInvocationID.x / 4) % 8];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
_11.a = 1.0;
patchOut.P_b = 2.0;
gl_out[gl_InvocationID].C_a = 3.0;
gl_out[gl_InvocationID].C_b = 4.0;
gl_out[gl_InvocationID].gl_Position = float4(1.0);
}

View File

@@ -0,0 +1,34 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct V
{
float4 a;
float4 b;
float4 c;
float4 d;
};
struct main0_out
{
float4 V_b [[user(locn1)]];
float4 V_c [[user(locn2)]];
float4 V_d [[user(locn3)]];
float4 gl_Position [[position]];
};
vertex main0_out main0()
{
main0_out out = {};
V _22 = {};
out.gl_Position = float4(1.0);
_22.a = float4(2.0);
_22.b = float4(3.0);
out.V_b = _22.b;
out.V_c = _22.c;
out.V_d = _22.d;
return out;
}

View File

@@ -0,0 +1,35 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct V
{
float4 a;
float4 b;
float4 c;
float4 d;
};
struct main0_out
{
float4 V_a;
float4 V_c;
float4 V_d;
float4 gl_Position;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]])
{
V _22 = {};
device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x];
if (any(gl_GlobalInvocationID >= spvStageInputSize))
return;
out.gl_Position = float4(1.0);
_22.a = float4(2.0);
_22.b = float4(3.0);
out.V_a = _22.a;
out.V_c = _22.c;
out.V_d = _22.d;
}

View File

@@ -0,0 +1,41 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct P
{
float a;
float b;
};
struct C
{
float a;
float b;
};
struct main0_out
{
float C_b;
float4 gl_Position;
};
struct main0_patchOut
{
float P_a;
float P_b;
};
kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
threadgroup C c[4];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
patchOut.P_a = 1.0;
patchOut.P_b = 2.0;
c[gl_InvocationID].a = 3.0;
gl_out[gl_InvocationID].C_b = 4.0;
gl_out[gl_InvocationID].gl_Position = float4(1.0);
}

View File

@@ -0,0 +1,44 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct P
{
float a;
float b;
};
struct C
{
float a;
float b;
};
struct main0_out
{
float C_b;
float4 gl_Position;
};
struct main0_patchOut
{
float P_a;
float P_b;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
threadgroup C spvStoragec[8][4];
threadgroup C (&c)[4] = spvStoragec[(gl_GlobalInvocationID.x / 4) % 8];
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
patchOut.P_a = 1.0;
patchOut.P_b = 2.0;
c[gl_InvocationID].a = 3.0;
gl_out[gl_InvocationID].C_b = 4.0;
gl_out[gl_InvocationID].gl_Position = float4(1.0);
}

View File

@@ -0,0 +1,34 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct V
{
float4 a;
float4 b;
float4 c;
float4 d;
};
struct main0_out
{
float4 V_a [[user(locn0)]];
float4 V_c [[user(locn2)]];
float4 V_d [[user(locn3)]];
float4 gl_Position [[position]];
};
vertex main0_out main0()
{
main0_out out = {};
V _22 = {};
out.gl_Position = float4(1.0);
_22.a = float4(2.0);
_22.b = float4(3.0);
out.V_a = _22.a;
out.V_c = _22.c;
out.V_d = _22.d;
return out;
}

View File

@@ -0,0 +1,67 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 v0 [[user(locn0)]];
float4 v1 [[user(locn1)]];
float4 gl_Position [[position]];
float gl_PointSize [[point_size]];
};
vertex main0_out main0()
{
main0_out out = {};
spvUnsafeArray<float, 2> gl_ClipDistance = {};
out.v0 = float4(1.0);
out.v1 = float4(2.0);
out.gl_Position = float4(3.0);
out.gl_PointSize = 4.0;
gl_ClipDistance[0] = 1.0;
gl_ClipDistance[1] = 0.5;
return out;
}

View File

@@ -0,0 +1,68 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 v1;
float4 gl_Position;
float gl_PointSize;
spvUnsafeArray<float, 2> gl_ClipDistance;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]])
{
float4 v0 = {};
device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x];
if (any(gl_GlobalInvocationID >= spvStageInputSize))
return;
v0 = float4(1.0);
out.v1 = float4(2.0);
out.gl_Position = float4(3.0);
out.gl_PointSize = 4.0;
out.gl_ClipDistance[0] = 1.0;
out.gl_ClipDistance[1] = 0.5;
}

View File

@@ -0,0 +1,34 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 gl_Position;
float gl_PointSize;
};
struct main0_patchOut
{
float4 v1;
};
kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
threadgroup float4 v0[4];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
v0[gl_InvocationID] = float4(1.0);
v0[gl_InvocationID].x = 2.0;
if (gl_InvocationID == 0)
{
patchOut.v1 = float4(2.0);
((device float*)&patchOut.v1)[3u] = 4.0;
}
gl_out[gl_InvocationID].gl_Position = float4(3.0);
gl_out[gl_InvocationID].gl_PointSize = 4.0;
gl_out[gl_InvocationID].gl_Position.z = 5.0;
gl_out[gl_InvocationID].gl_PointSize = 4.0;
}

View File

@@ -0,0 +1,81 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position;
float gl_PointSize;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> v1;
float4 v3;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
threadgroup float4 spvStoragev0[8][4];
threadgroup float4 (&v0)[4] = spvStoragev0[(gl_GlobalInvocationID.x / 4) % 8];
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
v0[gl_InvocationID] = float4(1.0);
v0[gl_InvocationID].z = 3.0;
if (gl_InvocationID == 0)
{
patchOut.v1[0] = float4(2.0);
((device float*)&patchOut.v1[0])[0u] = 3.0;
patchOut.v1[1] = float4(2.0);
((device float*)&patchOut.v1[1])[0u] = 5.0;
}
patchOut.v3 = float4(5.0);
gl_out[gl_InvocationID].gl_Position = float4(10.0);
gl_out[gl_InvocationID].gl_Position.z = 20.0;
gl_out[gl_InvocationID].gl_PointSize = 40.0;
}

View File

@@ -0,0 +1,78 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position;
float gl_PointSize;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> v1;
float4 v3;
};
kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
threadgroup float4 v0[4];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
v0[gl_InvocationID] = float4(1.0);
v0[gl_InvocationID].z = 3.0;
if (gl_InvocationID == 0)
{
patchOut.v1[0] = float4(2.0);
((device float*)&patchOut.v1[0])[0u] = 3.0;
patchOut.v1[1] = float4(2.0);
((device float*)&patchOut.v1[1])[0u] = 5.0;
}
patchOut.v3 = float4(5.0);
gl_out[gl_InvocationID].gl_Position = float4(10.0);
gl_out[gl_InvocationID].gl_Position.z = 20.0;
gl_out[gl_InvocationID].gl_PointSize = 40.0;
}

View File

@@ -0,0 +1,30 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 v1 [[user(locn1)]];
float4 gl_Position [[position]];
float gl_PointSize [[point_size]];
float gl_ClipDistance [[clip_distance]] [2];
float gl_ClipDistance_0 [[user(clip0)]];
float gl_ClipDistance_1 [[user(clip1)]];
};
vertex main0_out main0()
{
main0_out out = {};
float4 v0 = {};
v0 = float4(1.0);
out.v1 = float4(2.0);
out.gl_Position = float4(3.0);
out.gl_PointSize = 4.0;
out.gl_ClipDistance[0] = 1.0;
out.gl_ClipDistance[1] = 0.5;
out.gl_ClipDistance_0 = out.gl_ClipDistance[0];
out.gl_ClipDistance_1 = out.gl_ClipDistance[1];
return out;
}

View File

@@ -0,0 +1,68 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 v0;
float4 gl_Position;
float gl_PointSize;
spvUnsafeArray<float, 2> gl_ClipDistance;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]])
{
float4 v1 = {};
device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x];
if (any(gl_GlobalInvocationID >= spvStageInputSize))
return;
out.v0 = float4(1.0);
v1 = float4(2.0);
out.gl_Position = float4(3.0);
out.gl_PointSize = 4.0;
out.gl_ClipDistance[0] = 1.0;
out.gl_ClipDistance[1] = 0.5;
}

View File

@@ -0,0 +1,33 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 v0;
float4 gl_Position;
float gl_PointSize;
};
struct main0_patchOut
{
};
kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
threadgroup float4 v1;
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
gl_out[gl_InvocationID].v0 = float4(1.0);
gl_out[gl_InvocationID].v0.x = 2.0;
if (gl_InvocationID == 0)
{
v1 = float4(2.0);
((threadgroup float*)&v1)[3u] = 4.0;
}
gl_out[gl_InvocationID].gl_Position = float4(3.0);
gl_out[gl_InvocationID].gl_PointSize = 4.0;
gl_out[gl_InvocationID].gl_Position.z = 5.0;
gl_out[gl_InvocationID].gl_PointSize = 4.0;
}

View File

@@ -0,0 +1,40 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 v0;
float4 gl_Position;
float gl_PointSize;
};
struct main0_patchOut
{
float4 v3;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
threadgroup float4 spvStoragev1[8][2];
threadgroup float4 (&v1)[2] = spvStoragev1[(gl_GlobalInvocationID.x / 4) % 8];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
gl_out[gl_InvocationID].v0 = float4(1.0);
gl_out[gl_InvocationID].v0.z = 3.0;
if (gl_InvocationID == 0)
{
v1[0] = float4(2.0);
((threadgroup float*)&v1[0])[0u] = 3.0;
v1[1] = float4(2.0);
((threadgroup float*)&v1[1])[0u] = 5.0;
}
patchOut.v3 = float4(5.0);
gl_out[gl_InvocationID].gl_Position = float4(10.0);
gl_out[gl_InvocationID].gl_Position.z = 20.0;
gl_out[gl_InvocationID].gl_PointSize = 40.0;
}

View File

@@ -0,0 +1,37 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 v0;
float4 gl_Position;
float gl_PointSize;
};
struct main0_patchOut
{
float4 v3;
};
kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
threadgroup float4 v1[2];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
gl_out[gl_InvocationID].v0 = float4(1.0);
gl_out[gl_InvocationID].v0.z = 3.0;
if (gl_InvocationID == 0)
{
v1[0] = float4(2.0);
((threadgroup float*)&v1[0])[0u] = 3.0;
v1[1] = float4(2.0);
((threadgroup float*)&v1[1])[0u] = 5.0;
}
patchOut.v3 = float4(5.0);
gl_out[gl_InvocationID].gl_Position = float4(10.0);
gl_out[gl_InvocationID].gl_Position.z = 20.0;
gl_out[gl_InvocationID].gl_PointSize = 40.0;
}

View File

@@ -0,0 +1,30 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 v0 [[user(locn0)]];
float4 gl_Position [[position]];
float gl_PointSize [[point_size]];
float gl_ClipDistance [[clip_distance]] [2];
float gl_ClipDistance_0 [[user(clip0)]];
float gl_ClipDistance_1 [[user(clip1)]];
};
vertex main0_out main0()
{
main0_out out = {};
float4 v1 = {};
out.v0 = float4(1.0);
v1 = float4(2.0);
out.gl_Position = float4(3.0);
out.gl_PointSize = 4.0;
out.gl_ClipDistance[0] = 1.0;
out.gl_ClipDistance[1] = 0.5;
out.gl_ClipDistance_0 = out.gl_ClipDistance[0];
out.gl_ClipDistance_1 = out.gl_ClipDistance[1];
return out;
}

View File

@@ -0,0 +1,68 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 v0;
float4 v1;
float4 gl_Position;
spvUnsafeArray<float, 2> gl_ClipDistance;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]])
{
float gl_PointSize = {};
device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x];
if (any(gl_GlobalInvocationID >= spvStageInputSize))
return;
out.v0 = float4(1.0);
out.v1 = float4(2.0);
out.gl_Position = float4(3.0);
gl_PointSize = 4.0;
out.gl_ClipDistance[0] = 1.0;
out.gl_ClipDistance[1] = 0.5;
}

View File

@@ -0,0 +1,89 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct gl_PerVertex
{
float4 gl_Position;
float gl_PointSize;
spvUnsafeArray<float, 1> gl_ClipDistance;
spvUnsafeArray<float, 1> gl_CullDistance;
};
struct main0_out
{
float4 v0;
float4 gl_Position;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> v1;
float4 v3;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
threadgroup gl_PerVertex spvStoragegl_out_masked[8][4];
threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8];
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
gl_out[gl_InvocationID].v0 = float4(1.0);
gl_out[gl_InvocationID].v0.z = 3.0;
if (gl_InvocationID == 0)
{
patchOut.v1[0] = float4(2.0);
((device float*)&patchOut.v1[0])[0u] = 3.0;
patchOut.v1[1] = float4(2.0);
((device float*)&patchOut.v1[1])[0u] = 5.0;
}
patchOut.v3 = float4(5.0);
gl_out[gl_InvocationID].gl_Position = float4(10.0);
gl_out[gl_InvocationID].gl_Position.z = 20.0;
gl_out_masked[gl_InvocationID].gl_PointSize = 40.0;
}

View File

@@ -0,0 +1,86 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct gl_PerVertex
{
float4 gl_Position;
float gl_PointSize;
spvUnsafeArray<float, 1> gl_ClipDistance;
spvUnsafeArray<float, 1> gl_CullDistance;
};
struct main0_out
{
float4 v0;
float4 gl_Position;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> v1;
float4 v3;
};
kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
threadgroup gl_PerVertex gl_out_masked[4];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
gl_out[gl_InvocationID].v0 = float4(1.0);
gl_out[gl_InvocationID].v0.z = 3.0;
if (gl_InvocationID == 0)
{
patchOut.v1[0] = float4(2.0);
((device float*)&patchOut.v1[0])[0u] = 3.0;
patchOut.v1[1] = float4(2.0);
((device float*)&patchOut.v1[1])[0u] = 5.0;
}
patchOut.v3 = float4(5.0);
gl_out[gl_InvocationID].gl_Position = float4(10.0);
gl_out[gl_InvocationID].gl_Position.z = 20.0;
gl_out_masked[gl_InvocationID].gl_PointSize = 40.0;
}

View File

@@ -0,0 +1,30 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 v0 [[user(locn0)]];
float4 v1 [[user(locn1)]];
float4 gl_Position [[position]];
float gl_ClipDistance [[clip_distance]] [2];
float gl_ClipDistance_0 [[user(clip0)]];
float gl_ClipDistance_1 [[user(clip1)]];
};
vertex main0_out main0()
{
main0_out out = {};
float gl_PointSize = {};
out.v0 = float4(1.0);
out.v1 = float4(2.0);
out.gl_Position = float4(3.0);
gl_PointSize = 4.0;
out.gl_ClipDistance[0] = 1.0;
out.gl_ClipDistance[1] = 0.5;
out.gl_ClipDistance_0 = out.gl_ClipDistance[0];
out.gl_ClipDistance_1 = out.gl_ClipDistance[1];
return out;
}

View File

@@ -0,0 +1,89 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct gl_PerVertex
{
float4 gl_Position;
float gl_PointSize;
spvUnsafeArray<float, 1> gl_ClipDistance;
spvUnsafeArray<float, 1> gl_CullDistance;
};
struct main0_out
{
float4 v0;
float gl_PointSize;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> v1;
float4 v3;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
threadgroup gl_PerVertex spvStoragegl_out_masked[8][4];
threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8];
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
gl_out[gl_InvocationID].v0 = float4(1.0);
gl_out[gl_InvocationID].v0.z = 3.0;
if (gl_InvocationID == 0)
{
patchOut.v1[0] = float4(2.0);
((device float*)&patchOut.v1[0])[0u] = 3.0;
patchOut.v1[1] = float4(2.0);
((device float*)&patchOut.v1[1])[0u] = 5.0;
}
patchOut.v3 = float4(5.0);
gl_out_masked[gl_InvocationID].gl_Position = float4(10.0);
gl_out_masked[gl_InvocationID].gl_Position.z = 20.0;
gl_out[gl_InvocationID].gl_PointSize = 40.0;
}

View File

@@ -0,0 +1,86 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct gl_PerVertex
{
float4 gl_Position;
float gl_PointSize;
spvUnsafeArray<float, 1> gl_ClipDistance;
spvUnsafeArray<float, 1> gl_CullDistance;
};
struct main0_out
{
float4 v0;
float gl_PointSize;
};
struct main0_patchOut
{
spvUnsafeArray<float4, 2> v1;
float4 v3;
};
kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
threadgroup gl_PerVertex gl_out_masked[4];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
gl_out[gl_InvocationID].v0 = float4(1.0);
gl_out[gl_InvocationID].v0.z = 3.0;
if (gl_InvocationID == 0)
{
patchOut.v1[0] = float4(2.0);
((device float*)&patchOut.v1[0])[0u] = 3.0;
patchOut.v1[1] = float4(2.0);
((device float*)&patchOut.v1[1])[0u] = 5.0;
}
patchOut.v3 = float4(5.0);
gl_out_masked[gl_InvocationID].gl_Position = float4(10.0);
gl_out_masked[gl_InvocationID].gl_Position.z = 20.0;
gl_out[gl_InvocationID].gl_PointSize = 40.0;
}

View File

@@ -11,7 +11,7 @@ struct main0_patchOut
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 1];
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1]);
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1);
spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375);
spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375);

View File

@@ -0,0 +1,128 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Meep
{
float a;
float b;
};
struct Block
{
spvUnsafeArray<float, 2> a;
float b;
float2x2 m;
Meep meep;
spvUnsafeArray<Meep, 2> meeps;
};
struct Block_1
{
spvUnsafeArray<float, 2> a;
float b;
float2x2 m;
Meep meep;
spvUnsafeArray<Meep, 2> meeps;
};
struct main0_out
{
spvUnsafeArray<float, 2> a;
float b;
float2x2 m;
Meep meep;
spvUnsafeArray<Meep, 2> meeps;
spvUnsafeArray<float, 2> Block_a;
float Block_b;
float2x2 Block_m;
Meep Block_meep;
spvUnsafeArray<Meep, 2> Block_meeps;
float4 gl_Position;
};
struct main0_in
{
spvUnsafeArray<float, 2> in_a;
float in_b;
float2x2 in_m;
Meep in_meep;
spvUnsafeArray<Meep, 2> in_meeps;
spvUnsafeArray<float, 2> Block_a;
float Block_b;
float2x2 Block_m;
Meep Block_meep;
spvUnsafeArray<Meep, 2> Block_meeps;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]])
{
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
gl_out[gl_InvocationID].gl_Position = float4(1.0);
gl_out[gl_InvocationID].a[0] = gl_in[gl_InvocationID].in_a[0];
gl_out[gl_InvocationID].a[1] = gl_in[gl_InvocationID].in_a[1];
gl_out[gl_InvocationID].b = gl_in[gl_InvocationID].in_b;
gl_out[gl_InvocationID].m = gl_in[gl_InvocationID].in_m;
gl_out[gl_InvocationID].meep.a = gl_in[gl_InvocationID].in_meep.a;
gl_out[gl_InvocationID].meep.b = gl_in[gl_InvocationID].in_meep.b;
gl_out[gl_InvocationID].meeps[0].a = gl_in[gl_InvocationID].in_meeps[0].a;
gl_out[gl_InvocationID].meeps[0].b = gl_in[gl_InvocationID].in_meeps[0].b;
gl_out[gl_InvocationID].meeps[1].a = gl_in[gl_InvocationID].in_meeps[1].a;
gl_out[gl_InvocationID].meeps[1].b = gl_in[gl_InvocationID].in_meeps[1].b;
gl_out[gl_InvocationID].Block_a[0] = gl_in[gl_InvocationID].Block_a[0];
gl_out[gl_InvocationID].Block_a[1] = gl_in[gl_InvocationID].Block_a[1];
gl_out[gl_InvocationID].Block_b = gl_in[gl_InvocationID].Block_b;
gl_out[gl_InvocationID].Block_m = gl_in[gl_InvocationID].Block_m;
gl_out[gl_InvocationID].Block_meep.a = gl_in[gl_InvocationID].Block_meep.a;
gl_out[gl_InvocationID].Block_meep.b = gl_in[gl_InvocationID].Block_meep.b;
gl_out[gl_InvocationID].Block_meeps[0].a = gl_in[gl_InvocationID].Block_meeps[0].a;
gl_out[gl_InvocationID].Block_meeps[0].b = gl_in[gl_InvocationID].Block_meeps[0].b;
gl_out[gl_InvocationID].Block_meeps[1].a = gl_in[gl_InvocationID].Block_meeps[1].a;
gl_out[gl_InvocationID].Block_meeps[1].b = gl_in[gl_InvocationID].Block_meeps[1].b;
}

View File

@@ -0,0 +1,132 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Meep
{
float a;
float b;
};
struct Block
{
spvUnsafeArray<float, 2> a;
float b;
float2x2 m;
Meep meep;
spvUnsafeArray<Meep, 2> meeps;
};
struct Block_1
{
spvUnsafeArray<float, 2> a;
float b;
float2x2 m;
};
struct main0_out
{
spvUnsafeArray<float, 2> a;
float b;
float2x2 m;
Meep meep;
spvUnsafeArray<Meep, 2> meeps;
spvUnsafeArray<float, 2> Block_a;
float Block_b;
float2x2 Block_m;
Meep Block_meep;
spvUnsafeArray<Meep, 2> Block_meeps;
float4 gl_Position;
};
struct main0_in
{
float in_a_0 [[attribute(0)]];
float in_a_1 [[attribute(1)]];
float in_b [[attribute(2)]];
float2 in_m_0 [[attribute(3)]];
float2 in_m_1 [[attribute(4)]];
float Meep_a [[attribute(5)]];
float Meep_b [[attribute(6)]];
float Block_a_0 [[attribute(11)]];
float Block_a_1 [[attribute(12)]];
float Block_b [[attribute(13)]];
float2 Block_m_0 [[attribute(14)]];
float2 Block_m_1 [[attribute(15)]];
};
kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
if (gl_InvocationID < spvIndirectParams[0])
gl_in[gl_InvocationID] = in;
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 4)
return;
gl_out[gl_InvocationID].gl_Position = float4(1.0);
gl_out[gl_InvocationID].a[0] = gl_in[gl_InvocationID].in_a_0;
gl_out[gl_InvocationID].a[1] = gl_in[gl_InvocationID].in_a_1;
gl_out[gl_InvocationID].b = gl_in[gl_InvocationID].in_b;
float2x2 _178 = float2x2(gl_in[gl_InvocationID].in_m_0, gl_in[gl_InvocationID].in_m_1);
gl_out[gl_InvocationID].m = _178;
gl_out[gl_InvocationID].meep.a = gl_in[gl_InvocationID].Meep_a;
gl_out[gl_InvocationID].meep.b = gl_in[gl_InvocationID].Meep_b;
gl_out[gl_InvocationID].meeps[0].a = 1.0;
gl_out[gl_InvocationID].meeps[0].b = 2.0;
gl_out[gl_InvocationID].meeps[1].a = 3.0;
gl_out[gl_InvocationID].meeps[1].b = 4.0;
gl_out[gl_InvocationID].Block_a[0] = gl_in[gl_InvocationID].Block_a_0;
gl_out[gl_InvocationID].Block_a[1] = gl_in[gl_InvocationID].Block_a_1;
gl_out[gl_InvocationID].Block_b = gl_in[gl_InvocationID].Block_b;
float2x2 _216 = float2x2(gl_in[gl_InvocationID].Block_m_0, gl_in[gl_InvocationID].Block_m_1);
gl_out[gl_InvocationID].Block_m = _216;
gl_out[gl_InvocationID].Block_meep.a = 10.0;
gl_out[gl_InvocationID].Block_meep.b = 20.0;
gl_out[gl_InvocationID].Block_meeps[0].a = 5.0;
gl_out[gl_InvocationID].Block_meeps[0].b = 6.0;
gl_out[gl_InvocationID].Block_meeps[1].a = 7.0;
gl_out[gl_InvocationID].Block_meeps[1].b = 8.0;
}

View File

@@ -0,0 +1,107 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Meep
{
float a;
float b;
};
struct Block
{
spvUnsafeArray<float, 2> a;
float b;
float2x2 m;
Meep meep;
spvUnsafeArray<Meep, 2> meeps;
};
struct main0_out
{
float4 gl_Position;
};
struct main0_patchOut
{
spvUnsafeArray<float, 2> a;
float b;
float2x2 m;
Meep meep;
spvUnsafeArray<Meep, 2> meeps;
spvUnsafeArray<float, 2> Block_a;
float Block_b;
float2x2 Block_m;
Meep Block_meep;
spvUnsafeArray<Meep, 2> Block_meeps;
};
kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
{
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
gl_out[gl_InvocationID].gl_Position = float4(1.0);
patchOut.a[0] = 1.0;
patchOut.a[1] = 2.0;
patchOut.b = 3.0;
patchOut.m = float2x2(float2(2.0, 0.0), float2(0.0, 2.0));
patchOut.meep.a = 4.0;
patchOut.meep.b = 5.0;
patchOut.meeps[0].a = 6.0;
patchOut.meeps[0].b = 7.0;
patchOut.meeps[1].a = 8.0;
patchOut.meeps[1].b = 9.0;
patchOut.Block_a[0] = 1.0;
patchOut.Block_a[1] = 2.0;
patchOut.Block_b = 3.0;
patchOut.Block_m = float2x2(float2(4.0, 0.0), float2(0.0, 4.0));
patchOut.Block_meep.a = 4.0;
patchOut.Block_meep.b = 5.0;
patchOut.Block_meeps[0].a = 6.0;
patchOut.Block_meeps[0].b = 7.0;
patchOut.Block_meeps[1].a = 8.0;
patchOut.Block_meeps[1].b = 9.0;
}

View File

@@ -59,7 +59,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
spvUnsafeArray<float4x4, 32> _16 = spvUnsafeArray<float4x4, 32>({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs });
spvUnsafeArray<float4x4, 32> tmp;
tmp = _16;

View File

@@ -58,9 +58,7 @@ struct main0_out
struct main0_in
{
float4x4 VertexData_a;
spvUnsafeArray<float4, 2> VertexData_b;
float4 VertexData_c;
VertexData vInputs;
};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]])
@@ -68,11 +66,11 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
spvUnsafeArray<VertexData, 32> _19 = spvUnsafeArray<VertexData, 32>({ VertexData{ gl_in[0].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[0].VertexData_b[0], gl_in[0].VertexData_b[1] }), gl_in[0].VertexData_c }, VertexData{ gl_in[1].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[1].VertexData_b[0], gl_in[1].VertexData_b[1] }), gl_in[1].VertexData_c }, VertexData{ gl_in[2].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[2].VertexData_b[0], gl_in[2].VertexData_b[1] }), gl_in[2].VertexData_c }, VertexData{ gl_in[3].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[3].VertexData_b[0], gl_in[3].VertexData_b[1] }), gl_in[3].VertexData_c }, VertexData{ gl_in[4].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[4].VertexData_b[0], gl_in[4].VertexData_b[1] }), gl_in[4].VertexData_c }, VertexData{ gl_in[5].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[5].VertexData_b[0], gl_in[5].VertexData_b[1] }), gl_in[5].VertexData_c }, VertexData{ gl_in[6].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[6].VertexData_b[0], gl_in[6].VertexData_b[1] }), gl_in[6].VertexData_c }, VertexData{ gl_in[7].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[7].VertexData_b[0], gl_in[7].VertexData_b[1] }), gl_in[7].VertexData_c }, VertexData{ gl_in[8].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[8].VertexData_b[0], gl_in[8].VertexData_b[1] }), gl_in[8].VertexData_c }, VertexData{ gl_in[9].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[9].VertexData_b[0], gl_in[9].VertexData_b[1] }), gl_in[9].VertexData_c }, VertexData{ gl_in[10].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[10].VertexData_b[0], gl_in[10].VertexData_b[1] }), gl_in[10].VertexData_c }, VertexData{ gl_in[11].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[11].VertexData_b[0], gl_in[11].VertexData_b[1] }), gl_in[11].VertexData_c }, VertexData{ gl_in[12].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[12].VertexData_b[0], gl_in[12].VertexData_b[1] }), gl_in[12].VertexData_c }, VertexData{ gl_in[13].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[13].VertexData_b[0], gl_in[13].VertexData_b[1] }), gl_in[13].VertexData_c }, VertexData{ gl_in[14].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[14].VertexData_b[0], gl_in[14].VertexData_b[1] }), gl_in[14].VertexData_c }, VertexData{ gl_in[15].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[15].VertexData_b[0], gl_in[15].VertexData_b[1] }), gl_in[15].VertexData_c }, VertexData{ gl_in[16].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[16].VertexData_b[0], gl_in[16].VertexData_b[1] }), gl_in[16].VertexData_c }, VertexData{ gl_in[17].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[17].VertexData_b[0], gl_in[17].VertexData_b[1] }), gl_in[17].VertexData_c }, VertexData{ gl_in[18].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[18].VertexData_b[0], gl_in[18].VertexData_b[1] }), gl_in[18].VertexData_c }, VertexData{ gl_in[19].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[19].VertexData_b[0], gl_in[19].VertexData_b[1] }), gl_in[19].VertexData_c }, VertexData{ gl_in[20].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[20].VertexData_b[0], gl_in[20].VertexData_b[1] }), gl_in[20].VertexData_c }, VertexData{ gl_in[21].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[21].VertexData_b[0], gl_in[21].VertexData_b[1] }), gl_in[21].VertexData_c }, VertexData{ gl_in[22].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[22].VertexData_b[0], gl_in[22].VertexData_b[1] }), gl_in[22].VertexData_c }, VertexData{ gl_in[23].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[23].VertexData_b[0], gl_in[23].VertexData_b[1] }), gl_in[23].VertexData_c }, VertexData{ gl_in[24].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[24].VertexData_b[0], gl_in[24].VertexData_b[1] }), gl_in[24].VertexData_c }, VertexData{ gl_in[25].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[25].VertexData_b[0], gl_in[25].VertexData_b[1] }), gl_in[25].VertexData_c }, VertexData{ gl_in[26].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[26].VertexData_b[0], gl_in[26].VertexData_b[1] }), gl_in[26].VertexData_c }, VertexData{ gl_in[27].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[27].VertexData_b[0], gl_in[27].VertexData_b[1] }), gl_in[27].VertexData_c }, VertexData{ gl_in[28].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[28].VertexData_b[0], gl_in[28].VertexData_b[1] }), gl_in[28].VertexData_c }, VertexData{ gl_in[29].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[29].VertexData_b[0], gl_in[29].VertexData_b[1] }), gl_in[29].VertexData_c }, VertexData{ gl_in[30].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[30].VertexData_b[0], gl_in[30].VertexData_b[1] }), gl_in[30].VertexData_c }, VertexData{ gl_in[31].VertexData_a, spvUnsafeArray<float4, 2>({ gl_in[31].VertexData_b[0], gl_in[31].VertexData_b[1] }), gl_in[31].VertexData_c } });
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
spvUnsafeArray<VertexData, 32> _19 = spvUnsafeArray<VertexData, 32>({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs });
spvUnsafeArray<VertexData, 32> tmp;
tmp = _19;
int _27 = gl_InvocationID ^ 1;
gl_out[gl_InvocationID].vOutputs = ((tmp[gl_InvocationID].a[1] + tmp[gl_InvocationID].b[1]) + tmp[gl_InvocationID].c) + gl_in[_27].VertexData_c;
gl_out[gl_InvocationID].vOutputs = ((tmp[gl_InvocationID].a[1] + tmp[gl_InvocationID].b[1]) + tmp[gl_InvocationID].c) + gl_in[_27].vInputs.c;
}

View File

@@ -60,7 +60,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
spvUnsafeArray<float4, 32> _15 = spvUnsafeArray<float4, 32>({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs });
spvUnsafeArray<float4, 32> tmp;
tmp = _15;

View File

@@ -21,7 +21,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 3];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 3;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1]);
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1);
float _15 = float(gl_InvocationID);
float3 _18 = float3(_15, 0.0, 0.0);
float3 _19 = float3(0.0, _15, 0.0);

View File

@@ -20,7 +20,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1);
if (gl_InvocationID == 0)
{
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(2.0);

View File

@@ -28,7 +28,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 3];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_InvocationID = gl_GlobalInvocationID.x % 3;
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1]);
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1);
float _15 = float(gl_InvocationID);
int _18 = gl_InvocationID + 1;
float _19 = float(_18);

View File

@@ -29,7 +29,7 @@ kernel void main0(constant UBO& _41 [[buffer(0)]], uint3 gl_GlobalInvocationID [
{
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 1];
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1]);
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1);
float2 _431 = (gl_in[0].vPatchPosBase.xy - float2(10.0)) * _41.uScale.xy;
float2 _441 = ((gl_in[0].vPatchPosBase.xy + _41.uPatchSize) + float2(10.0)) * _41.uScale.xy;
float3 _446 = float3(_431.x, -10.0, _431.y);

View File

@@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position [[position]];
@@ -10,15 +51,23 @@ struct main0_out
struct main0_patchIn
{
float2 gl_TessLevelInner [[attribute(0)]];
float4 gl_TessLevelOuter [[attribute(1)]];
float4 gl_TessLevelOuter [[attribute(0)]];
float2 gl_TessLevelInner [[attribute(1)]];
};
[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoord [[position_in_patch]])
{
main0_out out = {};
spvUnsafeArray<float, 2> gl_TessLevelInner = {};
spvUnsafeArray<float, 4> gl_TessLevelOuter = {};
gl_TessLevelInner[0] = patchIn.gl_TessLevelInner.x;
gl_TessLevelInner[1] = patchIn.gl_TessLevelInner.y;
gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter.x;
gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter.y;
gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter.z;
gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter.w;
gl_TessCoord.y = 1.0 - gl_TessCoord.y;
out.gl_Position = float4(((gl_TessCoord.x * patchIn.gl_TessLevelInner.x) * patchIn.gl_TessLevelOuter.x) + (((1.0 - gl_TessCoord.x) * patchIn.gl_TessLevelInner.x) * patchIn.gl_TessLevelOuter.z), ((gl_TessCoord.y * patchIn.gl_TessLevelInner.y) * patchIn.gl_TessLevelOuter.w) + (((1.0 - gl_TessCoord.y) * patchIn.gl_TessLevelInner.y) * patchIn.gl_TessLevelOuter.y), 0.0, 1.0);
out.gl_Position = float4(((gl_TessCoord.x * gl_TessLevelInner[0]) * gl_TessLevelOuter[0]) + (((1.0 - gl_TessCoord.x) * gl_TessLevelInner[0]) * gl_TessLevelOuter[2]), ((gl_TessCoord.y * gl_TessLevelInner[1]) * gl_TessLevelOuter[3]) + (((1.0 - gl_TessCoord.y) * gl_TessLevelInner[1]) * gl_TessLevelOuter[1]), 0.0, 1.0);
return out;
}

View File

@@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position [[position]];
@@ -10,14 +51,22 @@ struct main0_out
struct main0_patchIn
{
float2 gl_TessLevelInner [[attribute(0)]];
float4 gl_TessLevelOuter [[attribute(1)]];
float4 gl_TessLevelOuter [[attribute(0)]];
float2 gl_TessLevelInner [[attribute(1)]];
};
[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoord [[position_in_patch]])
{
main0_out out = {};
out.gl_Position = float4(((gl_TessCoord.x * patchIn.gl_TessLevelInner.x) * patchIn.gl_TessLevelOuter.x) + (((1.0 - gl_TessCoord.x) * patchIn.gl_TessLevelInner.x) * patchIn.gl_TessLevelOuter.z), ((gl_TessCoord.y * patchIn.gl_TessLevelInner.y) * patchIn.gl_TessLevelOuter.y) + (((1.0 - gl_TessCoord.y) * patchIn.gl_TessLevelInner.y) * patchIn.gl_TessLevelOuter.w), 0.0, 1.0);
spvUnsafeArray<float, 2> gl_TessLevelInner = {};
spvUnsafeArray<float, 4> gl_TessLevelOuter = {};
gl_TessLevelInner[0] = patchIn.gl_TessLevelInner.x;
gl_TessLevelInner[1] = patchIn.gl_TessLevelInner.y;
gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter.x;
gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter.y;
gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter.z;
gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter.w;
out.gl_Position = float4(((gl_TessCoord.x * gl_TessLevelInner[0]) * gl_TessLevelOuter[0]) + (((1.0 - gl_TessCoord.x) * gl_TessLevelInner[0]) * gl_TessLevelOuter[2]), ((gl_TessCoord.y * gl_TessLevelInner[1]) * gl_TessLevelOuter[1]) + (((1.0 - gl_TessCoord.y) * gl_TessLevelInner[1]) * gl_TessLevelOuter[3]), 0.0, 1.0);
return out;
}

View File

@@ -0,0 +1,72 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position [[position]];
};
struct main0_patchIn
{
float4 gl_TessLevelOuter [[attribute(0)]];
float2 gl_TessLevelInner [[attribute(1)]];
};
[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]])
{
main0_out out = {};
spvUnsafeArray<float, 4> gl_TessLevelOuter = {};
spvUnsafeArray<float, 2> gl_TessLevelInner = {};
gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter.x;
gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter.y;
gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter.z;
gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter.w;
gl_TessLevelInner[0] = patchIn.gl_TessLevelInner.x;
gl_TessLevelInner[1] = patchIn.gl_TessLevelInner.y;
out.gl_Position = float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy;
return out;
}

View File

@@ -0,0 +1,69 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position [[position]];
};
struct main0_patchIn
{
float4 gl_TessLevel [[attribute(0)]];
};
[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]])
{
main0_out out = {};
spvUnsafeArray<float, 4> gl_TessLevelOuter = {};
spvUnsafeArray<float, 2> gl_TessLevelInner = {};
gl_TessLevelOuter[0] = patchIn.gl_TessLevel.x;
gl_TessLevelOuter[1] = patchIn.gl_TessLevel.y;
gl_TessLevelOuter[2] = patchIn.gl_TessLevel.z;
gl_TessLevelInner[0] = patchIn.gl_TessLevel.w;
out.gl_Position = float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy;
return out;
}

View File

@@ -0,0 +1,98 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 m_location_0;
float4 m_location_1;
float4 m_location_2;
float4 gl_Position;
};
struct main0_in
{
float4 m_location_0 [[attribute(0)]];
float4 m_location_1 [[attribute(1)]];
float4 m_location_2 [[attribute(2)]];
float4 Pos [[attribute(4)]];
};
kernel void main0(main0_in in [[stage_in]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]])
{
spvUnsafeArray<float, 2> A = {};
spvUnsafeArray<float2, 2> B = {};
spvUnsafeArray<float, 3> C = {};
float D = {};
spvUnsafeArray<float, 2> InA = {};
spvUnsafeArray<float2, 2> InB = {};
spvUnsafeArray<float, 3> InC = {};
float InD = {};
device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x];
InA[0] = in.m_location_1.x;
InA[1] = in.m_location_2.x;
InB[0] = in.m_location_1.zw;
InB[1] = in.m_location_2.zw;
InC[0] = in.m_location_0.y;
InC[1] = in.m_location_1.y;
InC[2] = in.m_location_2.y;
InD = in.m_location_0.w;
if (any(gl_GlobalInvocationID >= spvStageInputSize))
return;
out.gl_Position = in.Pos;
A = InA;
B = InB;
C = InC;
D = InD;
out.m_location_1.x = A[0];
out.m_location_2.x = A[1];
out.m_location_1.zw = B[0];
out.m_location_2.zw = B[1];
out.m_location_0.y = C[0];
out.m_location_1.y = C[1];
out.m_location_2.y = C[2];
out.m_location_0.w = D;
}

View File

@@ -0,0 +1,100 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float C_0 [[user(locn0_1)]];
float D [[user(locn0_3)]];
float A_0 [[user(locn1)]];
float C_1 [[user(locn1_1)]];
float2 B_0 [[user(locn1_2)]];
float A_1 [[user(locn2)]];
float C_2 [[user(locn2_1)]];
float2 B_1 [[user(locn2_2)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float4 m_location_0 [[attribute(0)]];
float4 m_location_1 [[attribute(1)]];
float4 m_location_2 [[attribute(2)]];
float4 Pos [[attribute(4)]];
};
vertex main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
spvUnsafeArray<float, 2> A = {};
spvUnsafeArray<float2, 2> B = {};
spvUnsafeArray<float, 3> C = {};
spvUnsafeArray<float, 2> InA = {};
spvUnsafeArray<float2, 2> InB = {};
spvUnsafeArray<float, 3> InC = {};
float InD = {};
InA[0] = in.m_location_1.x;
InA[1] = in.m_location_2.x;
InB[0] = in.m_location_1.zw;
InB[1] = in.m_location_2.zw;
InC[0] = in.m_location_0.y;
InC[1] = in.m_location_1.y;
InC[2] = in.m_location_2.y;
InD = in.m_location_0.w;
out.gl_Position = in.Pos;
A = InA;
B = InB;
C = InC;
out.D = InD;
out.A_0 = A[0];
out.A_1 = A[1];
out.B_0 = B[0];
out.B_1 = B[1];
out.C_0 = C[0];
out.C_1 = C[1];
out.C_2 = C[2];
return out;
}

View File

@@ -0,0 +1,18 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 V [[user(locn0)]];
float4 gl_Position [[position]];
};
vertex main0_out main0()
{
main0_out out = {};
out.V = float4(1.0);
return out;
}

View File

@@ -0,0 +1,9 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
vertex void main0()
{
}

View File

@@ -0,0 +1,88 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 gl_Position [[position]];
};
struct main0_in
{
float4 vA [[attribute(0)]];
float4 vB [[attribute(1)]];
float4 vC [[attribute(2)]];
};
template<typename T>
T spvFMul(T l, T r)
{
return fma(l, r, T(0));
}
template<typename T, int Cols, int Rows>
vec<T, Cols> spvFMulVectorMatrix(vec<T, Rows> v, matrix<T, Cols, Rows> m)
{
vec<T, Cols> res = vec<T, Cols>(0);
for (uint i = Rows; i > 0; --i)
{
vec<T, Cols> tmp(0);
for (uint j = 0; j < Cols; ++j)
{
tmp[j] = m[j][i - 1];
}
res = fma(tmp, vec<T, Cols>(v[i - 1]), res);
}
return res;
}
template<typename T, int Cols, int Rows>
vec<T, Rows> spvFMulMatrixVector(matrix<T, Cols, Rows> m, vec<T, Cols> v)
{
vec<T, Rows> res = vec<T, Rows>(0);
for (uint i = Cols; i > 0; --i)
{
res = fma(m[i - 1], vec<T, Rows>(v[i - 1]), res);
}
return res;
}
template<typename T, int LCols, int LRows, int RCols, int RRows>
matrix<T, RCols, LRows> spvFMulMatrixMatrix(matrix<T, LCols, LRows> l, matrix<T, RCols, RRows> r)
{
matrix<T, RCols, LRows> res;
for (uint i = 0; i < RCols; i++)
{
vec<T, RCols> tmp(0);
for (uint j = 0; j < LCols; j++)
{
tmp = fma(vec<T, RCols>(r[i][j]), l[j], tmp);
}
res[i] = tmp;
}
return res;
}
template<typename T>
T spvFAdd(T l, T r)
{
return fma(T(1), l, r);
}
template<typename T>
T spvFSub(T l, T r)
{
return fma(T(-1), r, l);
}
vertex main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
float4 _15 = spvFMul(in.vA, in.vB);
out.gl_Position = spvFAdd(spvFAdd(spvFAdd(_15, spvFAdd(in.vA, in.vB)), spvFSub(in.vA, in.vB)), spvFAdd(_15, in.vC));
return out;
}

View File

@@ -197,9 +197,10 @@ struct main0_out
float4 out_var_SV_Target0 [[color(0)]];
};
fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d<float> ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]])
fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d<float> ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]])
{
main0_out out = {};
gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
float4 _67 = _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData;
float _68 = _67.w;
float4 _82 = _Globals.ScreenToShadowMatrix * float4((((gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw) - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0);

View File

@@ -197,9 +197,10 @@ struct main0_out
float4 out_var_SV_Target0 [[color(0)]];
};
fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d<float> ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]])
fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d<float> ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]])
{
main0_out out = {};
gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
float4 _67 = _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData;
float _68 = _67.w;
float4 _82 = _Globals.ScreenToShadowMatrix * float4((((gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw) - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0);

View File

@@ -246,9 +246,9 @@ struct main0_out
float4 out_var_TEXCOORD7 [[user(locn1)]];
float4 out_var_TEXCOORD10_centroid [[user(locn2)]];
float4 out_var_TEXCOORD11_centroid [[user(locn3)]];
float4 gl_Position [[position]];
float gl_ClipDistance [[clip_distance]] [1];
float gl_ClipDistance_0 [[user(clip0)]];
float4 gl_Position [[position]];
};
struct main0_in

View File

@@ -22,15 +22,18 @@ void main()
#line 16 "test.frag"
FragColor = 4.0;
}
#line 19 "test.frag"
for (int _127 = 0; float(_127) < (40.0 + vColor); )
{
#line 21 "test.frag"
FragColor += 0.20000000298023223876953125;
#line 22 "test.frag"
FragColor += 0.300000011920928955078125;
#line 19 "test.frag"
_127 += (int(vColor) + 5);
continue;
}
#line 25 "test.frag"
switch (int(vColor))
{
case 0:
@@ -57,7 +60,10 @@ void main()
}
for (;;)
{
#line 42 "test.frag"
FragColor += (10.0 + vColor);
#line 43 "test.frag"
#line 42 "test.frag"
#line 43 "test.frag"
if (FragColor < 100.0)
{
@@ -67,5 +73,6 @@ void main()
break;
}
}
#line 48 "test.frag"
}

View File

@@ -12,7 +12,7 @@ layout(location = 0) out int _entryPointOutput;
int _231;
mat4 SPIRV_Cross_workaround_load_row_major(mat4 wrap) { return wrap; }
mat4 spvWorkaroundRowMajor(mat4 wrap) { return wrap; }
void main()
{
@@ -37,7 +37,7 @@ void main()
_223 = mat4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));
break;
} while(false);
vec4 _170 = (_223 * SPIRV_Cross_workaround_load_row_major(_11.lightVP[_222])) * vec4(fragWorld, 1.0);
vec4 _170 = (_223 * spvWorkaroundRowMajor(_11.lightVP[_222])) * vec4(fragWorld, 1.0);
float _172 = _170.z;
float _179 = _170.x;
float _181 = _170.y;

View File

@@ -2,10 +2,12 @@
layout(location = 0) out vec4 FragColors[2];
layout(location = 2) out vec4 FragColor;
const vec4 _3_init[2] = vec4[](vec4(1.0, 2.0, 3.0, 4.0), vec4(10.0));
const vec4 _4_init = vec4(5.0);
void main()
{
FragColors = vec4[](vec4(1.0, 2.0, 3.0, 4.0), vec4(10.0));
FragColor = vec4(5.0);
FragColors = _3_init;
FragColor = _4_init;
}

View File

@@ -6,6 +6,7 @@ struct VSOutput
};
layout(location = 0) in vec4 position;
layout(location = 0) out VSOutput _entryPointOutput;
void main()
{

View File

@@ -34,12 +34,12 @@ layout(binding = 3, std140) uniform UBONoWorkaround
layout(location = 0) out vec4 FragColor;
layout(location = 0) in vec4 Clip;
NestedRowMajor SPIRV_Cross_workaround_load_row_major(NestedRowMajor wrap) { return wrap; }
mat4 SPIRV_Cross_workaround_load_row_major(mat4 wrap) { return wrap; }
NestedRowMajor spvWorkaroundRowMajor(NestedRowMajor wrap) { return wrap; }
mat4 spvWorkaroundRowMajor(mat4 wrap) { return wrap; }
void main()
{
FragColor = (((SPIRV_Cross_workaround_load_row_major(_17.rm2).rm.B * SPIRV_Cross_workaround_load_row_major(_35.rm.B)) * SPIRV_Cross_workaround_load_row_major(_42.A)) * SPIRV_Cross_workaround_load_row_major(_42.C)) * Clip;
FragColor = (((spvWorkaroundRowMajor(_17.rm2).rm.B * spvWorkaroundRowMajor(_35.rm.B)) * spvWorkaroundRowMajor(_42.A)) * spvWorkaroundRowMajor(_42.C)) * Clip;
FragColor += (_56.D * Clip);
FragColor += (_42.A[1] * Clip);
}

View File

@@ -10,7 +10,7 @@ void main()
highp vec4 _65;
highp vec4 _66;
highp vec4 _68;
for (int SPIRV_Cross_Dummy25 = 0; SPIRV_Cross_Dummy25 < 1; SPIRV_Cross_Dummy25++)
for (int spvDummy25 = 0; spvDummy25 < 1; spvDummy25++)
{
if (_13 == 2)
{
@@ -59,7 +59,7 @@ void main()
}
}
highp vec4 _70;
for (int SPIRV_Cross_Dummy146 = 0; SPIRV_Cross_Dummy146 < 1; SPIRV_Cross_Dummy146++)
for (int spvDummy146 = 0; spvDummy146 < 1; spvDummy146++)
{
if ((_13 == 10) || (_13 == 20))
{

View File

@@ -11,12 +11,12 @@ uniform UBO _34;
void main()
{
vec4 _102;
for (int SPIRV_Cross_Dummy30 = 0; SPIRV_Cross_Dummy30 < 1; SPIRV_Cross_Dummy30++)
for (int spvDummy30 = 0; spvDummy30 < 1; spvDummy30++)
{
if (_34.func_arg != 0)
{
vec4 _101;
for (int SPIRV_Cross_Dummy45 = 0; SPIRV_Cross_Dummy45 < 1; SPIRV_Cross_Dummy45++)
for (int spvDummy45 = 0; spvDummy45 < 1; spvDummy45++)
{
if (_34.inner_func_arg != 0)
{

View File

@@ -11,9 +11,9 @@ uniform Buffer _13;
attribute vec4 Position;
mat4 SPIRV_Cross_workaround_load_row_major(mat4 wrap) { return wrap; }
mat4 spvWorkaroundRowMajor(mat4 wrap) { return wrap; }
mat4 SPIRV_Cross_Transpose(mat4 m)
mat4 spvTranspose(mat4 m)
{
return mat4(m[0][0], m[1][0], m[2][0], m[3][0], m[0][1], m[1][1], m[2][1], m[3][1], m[0][2], m[1][2], m[2][2], m[3][2], m[0][3], m[1][3], m[2][3], m[3][3]);
}
@@ -21,9 +21,9 @@ mat4 SPIRV_Cross_Transpose(mat4 m)
void main()
{
mat4 _55 = _13.MVPRowMajor;
mat4 _61 = SPIRV_Cross_workaround_load_row_major(_13.MVPColMajor);
mat4 _80 = SPIRV_Cross_Transpose(_13.MVPRowMajor) * 2.0;
mat4 _87 = SPIRV_Cross_Transpose(_61) * 2.0;
gl_Position = (((((((((((SPIRV_Cross_workaround_load_row_major(_13.M) * (Position * _13.MVPRowMajor)) + (SPIRV_Cross_workaround_load_row_major(_13.M) * (SPIRV_Cross_workaround_load_row_major(_13.MVPColMajor) * Position))) + (SPIRV_Cross_workaround_load_row_major(_13.M) * (_13.MVPRowMajor * Position))) + (SPIRV_Cross_workaround_load_row_major(_13.M) * (Position * SPIRV_Cross_workaround_load_row_major(_13.MVPColMajor)))) + (_55 * Position)) + (Position * _61)) + (Position * _55)) + (_61 * Position)) + (_80 * Position)) + (_87 * Position)) + (Position * _80)) + (Position * _87);
mat4 _61 = spvWorkaroundRowMajor(_13.MVPColMajor);
mat4 _80 = spvTranspose(_13.MVPRowMajor) * 2.0;
mat4 _87 = spvTranspose(_61) * 2.0;
gl_Position = (((((((((((spvWorkaroundRowMajor(_13.M) * (Position * _13.MVPRowMajor)) + (spvWorkaroundRowMajor(_13.M) * (spvWorkaroundRowMajor(_13.MVPColMajor) * Position))) + (spvWorkaroundRowMajor(_13.M) * (_13.MVPRowMajor * Position))) + (spvWorkaroundRowMajor(_13.M) * (Position * spvWorkaroundRowMajor(_13.MVPColMajor)))) + (_55 * Position)) + (Position * _61)) + (Position * _55)) + (_61 * Position)) + (_80 * Position)) + (_87 * Position)) + (Position * _80)) + (Position * _87);
}

View File

@@ -0,0 +1,18 @@
#version 450
layout(location = 0) in vec4 vA;
layout(location = 1) in vec4 vB;
layout(location = 2) in vec4 vC;
void main()
{
precise vec4 _15 = vA * vB;
precise vec4 _19 = vA + vB;
precise vec4 _23 = vA - vB;
precise vec4 _30 = _15 + vC;
precise vec4 _34 = _15 + _19;
precise vec4 _36 = _34 + _23;
precise vec4 _38 = _36 + _30;
gl_Position = _38;
}

Some files were not shown because too many files have changed in this diff Show More