Merge pull request #1643 from KhronosGroup/fix-1639
Add some interfaces to aid with LTO-style optimization
This commit is contained in:
commit
3cb8e7c223
@ -332,7 +332,7 @@ if (SPIRV_CROSS_STATIC)
|
||||
endif()
|
||||
|
||||
set(spirv-cross-abi-major 0)
|
||||
set(spirv-cross-abi-minor 46)
|
||||
set(spirv-cross-abi-minor 47)
|
||||
set(spirv-cross-abi-patch 0)
|
||||
|
||||
if (SPIRV_CROSS_SHARED)
|
||||
|
95
main.cpp
95
main.cpp
@ -285,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);
|
||||
@ -475,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)
|
||||
@ -621,6 +678,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;
|
||||
|
||||
@ -845,6 +904,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
|
||||
}
|
||||
@ -1103,6 +1167,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);
|
||||
|
||||
@ -1346,6 +1415,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);
|
||||
@ -1571,6 +1641,31 @@ 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(); };
|
||||
|
@ -10,8 +10,8 @@ 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]])
|
||||
|
@ -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)]])
|
||||
@ -26,8 +25,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
|
||||
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;
|
||||
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);
|
||||
|
67
reference/opt/shaders-msl/frag/cull-distance-varying.frag
Normal file
67
reference/opt/shaders-msl/frag/cull-distance-varying.frag
Normal 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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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]);
|
||||
_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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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]);
|
||||
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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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]);
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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]);
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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]);
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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]);
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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]);
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
107
reference/opt/shaders-msl/tesc/complex-patch-out-types.tesc
Normal file
107
reference/opt/shaders-msl/tesc/complex-patch-out-types.tesc
Normal 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;
|
||||
}
|
||||
|
@ -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)]])
|
||||
@ -69,10 +67,10 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
|
||||
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 } });
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ 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]])
|
||||
|
@ -10,8 +10,8 @@ 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]])
|
||||
|
@ -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 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 = {};
|
||||
gl_TessLevelOuter[0] = patchIn.gl_TessLevel.x;
|
||||
gl_TessLevelOuter[1] = patchIn.gl_TessLevel.y;
|
||||
gl_TessLevelOuter[2] = patchIn.gl_TessLevel.z;
|
||||
out.gl_Position = float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]);
|
||||
return out;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -0,0 +1,82 @@
|
||||
#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 C
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct P
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 P_v;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<C, 4> _18 = spvUnsafeArray<C, 4>({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } });
|
||||
|
||||
threadgroup C c[4];
|
||||
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
|
||||
c[gl_InvocationID] = _18[gl_InvocationID];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
|
||||
patchOut.P_v = float4(0.0);
|
||||
c[gl_InvocationID].v = float4(1.0);
|
||||
patchOut.P_v = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
#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 C
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct P
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 P_v;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<C, 4> _18 = spvUnsafeArray<C, 4>({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } });
|
||||
|
||||
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];
|
||||
c[gl_GlobalInvocationID.x % 4] = _18[gl_GlobalInvocationID.x % 4];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
|
||||
patchOut.P_v = float4(0.0);
|
||||
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
|
||||
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
|
||||
c[gl_InvocationID].v = float4(1.0);
|
||||
patchOut.P_v = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -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 C
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct P
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 C_v;
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<C, 4> _18 = spvUnsafeArray<C, 4>({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } });
|
||||
|
||||
threadgroup P p;
|
||||
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
|
||||
gl_out[gl_InvocationID].C_v = _18[gl_InvocationID].v;
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
|
||||
p = P{ float4(0.0) };
|
||||
gl_out[gl_InvocationID].C_v = float4(1.0);
|
||||
p.v = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,84 @@
|
||||
#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 C
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct P
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 C_v;
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
};
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<C, 4> _18 = spvUnsafeArray<C, 4>({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } });
|
||||
|
||||
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].C_v = _18[gl_GlobalInvocationID.x % 4].v;
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
|
||||
threadgroup P spvStoragep[8];
|
||||
threadgroup P (&p) = spvStoragep[(gl_GlobalInvocationID.x / 4) % 8];
|
||||
p = P{ float4(0.0) };
|
||||
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
|
||||
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
|
||||
gl_out[gl_InvocationID].C_v = float4(1.0);
|
||||
p.v = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -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 C
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct P
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct gl_PerVertex
|
||||
{
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float, 1> _51 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _52 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 C_v;
|
||||
float4 gl_Position;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 P_v;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<C, 4> _18 = spvUnsafeArray<C, 4>({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } });
|
||||
spvUnsafeArray<gl_PerVertex, 4> _33 = spvUnsafeArray<gl_PerVertex, 4>({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
threadgroup gl_PerVertex gl_out_masked[4];
|
||||
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
|
||||
gl_out[gl_InvocationID].C_v = _18[gl_InvocationID].v;
|
||||
gl_out[gl_InvocationID].gl_Position = _33[gl_InvocationID].gl_Position;
|
||||
gl_out[gl_InvocationID].gl_ClipDistance = _33[gl_InvocationID].gl_ClipDistance;
|
||||
gl_out[gl_InvocationID].gl_CullDistance = _33[gl_InvocationID].gl_CullDistance;
|
||||
gl_out_masked[gl_InvocationID] = _33[gl_InvocationID];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
|
||||
patchOut.P_v = float4(0.0);
|
||||
gl_out[gl_InvocationID].C_v = float4(1.0);
|
||||
patchOut.P_v = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out_masked[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,103 @@
|
||||
#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 C
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct P
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct gl_PerVertex
|
||||
{
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float, 1> _51 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _52 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 C_v;
|
||||
float4 gl_Position;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 P_v;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<C, 4> _18 = spvUnsafeArray<C, 4>({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } });
|
||||
spvUnsafeArray<gl_PerVertex, 4> _33 = spvUnsafeArray<gl_PerVertex, 4>({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].C_v = _18[gl_GlobalInvocationID.x % 4].v;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_Position = _33[gl_GlobalInvocationID.x % 4].gl_Position;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _33[gl_GlobalInvocationID.x % 4].gl_ClipDistance;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _33[gl_GlobalInvocationID.x % 4].gl_CullDistance;
|
||||
threadgroup gl_PerVertex spvStoragegl_out_masked[8][4];
|
||||
threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8];
|
||||
gl_out_masked[gl_GlobalInvocationID.x % 4] = _33[gl_GlobalInvocationID.x % 4];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
|
||||
patchOut.P_v = float4(0.0);
|
||||
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
|
||||
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
|
||||
gl_out[gl_InvocationID].C_v = float4(1.0);
|
||||
patchOut.P_v = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out_masked[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -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 C
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct P
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct gl_PerVertex
|
||||
{
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float, 1> _51 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _52 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 C_v;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 P_v;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<C, 4> _18 = spvUnsafeArray<C, 4>({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } });
|
||||
spvUnsafeArray<gl_PerVertex, 4> _33 = spvUnsafeArray<gl_PerVertex, 4>({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
threadgroup gl_PerVertex gl_out_masked[4];
|
||||
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
|
||||
gl_out[gl_InvocationID].C_v = _18[gl_InvocationID].v;
|
||||
gl_out[gl_InvocationID].gl_PointSize = _33[gl_InvocationID].gl_PointSize;
|
||||
gl_out[gl_InvocationID].gl_ClipDistance = _33[gl_InvocationID].gl_ClipDistance;
|
||||
gl_out[gl_InvocationID].gl_CullDistance = _33[gl_InvocationID].gl_CullDistance;
|
||||
gl_out_masked[gl_InvocationID] = _33[gl_InvocationID];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
|
||||
patchOut.P_v = float4(0.0);
|
||||
gl_out[gl_InvocationID].C_v = float4(1.0);
|
||||
patchOut.P_v = float4(2.0);
|
||||
gl_out_masked[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,103 @@
|
||||
#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 C
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct P
|
||||
{
|
||||
float4 v;
|
||||
};
|
||||
|
||||
struct gl_PerVertex
|
||||
{
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float, 1> _51 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _52 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 C_v;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 P_v;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<C, 4> _18 = spvUnsafeArray<C, 4>({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } });
|
||||
spvUnsafeArray<gl_PerVertex, 4> _33 = spvUnsafeArray<gl_PerVertex, 4>({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].C_v = _18[gl_GlobalInvocationID.x % 4].v;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_PointSize = _33[gl_GlobalInvocationID.x % 4].gl_PointSize;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _33[gl_GlobalInvocationID.x % 4].gl_ClipDistance;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _33[gl_GlobalInvocationID.x % 4].gl_CullDistance;
|
||||
threadgroup gl_PerVertex spvStoragegl_out_masked[8][4];
|
||||
threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8];
|
||||
gl_out_masked[gl_GlobalInvocationID.x % 4] = _33[gl_GlobalInvocationID.x % 4];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
|
||||
patchOut.P_v = float4(0.0);
|
||||
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
|
||||
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
|
||||
gl_out[gl_InvocationID].C_v = float4(1.0);
|
||||
patchOut.P_v = float4(2.0);
|
||||
gl_out_masked[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
#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 _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex
|
||||
{
|
||||
float4 _RESERVED_IDENTIFIER_FIXUP_gl_Position;
|
||||
float _RESERVED_IDENTIFIER_FIXUP_gl_PointSize;
|
||||
spvUnsafeArray<float, 1> _RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> _RESERVED_IDENTIFIER_FIXUP_gl_CullDistance;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float4, 4> _15 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) });
|
||||
constant spvUnsafeArray<float, 1> _45 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _46 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 foo_patch;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4> _29 = spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4>({ _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
threadgroup float4 foo[4];
|
||||
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
|
||||
foo[gl_InvocationID] = _15[gl_InvocationID];
|
||||
gl_out[gl_InvocationID].gl_Position = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_Position;
|
||||
gl_out[gl_InvocationID].gl_PointSize = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_PointSize;
|
||||
gl_out[gl_InvocationID].gl_ClipDistance = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance;
|
||||
gl_out[gl_InvocationID].gl_CullDistance = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_CullDistance;
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
|
||||
patchOut.foo_patch = float4(0.0);
|
||||
foo[gl_InvocationID] = float4(1.0);
|
||||
patchOut.foo_patch = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
#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 _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex
|
||||
{
|
||||
float4 _RESERVED_IDENTIFIER_FIXUP_gl_Position;
|
||||
float _RESERVED_IDENTIFIER_FIXUP_gl_PointSize;
|
||||
spvUnsafeArray<float, 1> _RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> _RESERVED_IDENTIFIER_FIXUP_gl_CullDistance;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float4, 4> _15 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) });
|
||||
constant spvUnsafeArray<float, 1> _45 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _46 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 foo_patch;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4> _29 = spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4>({ _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
|
||||
threadgroup float4 spvStoragefoo[8][4];
|
||||
threadgroup float4 (&foo)[4] = spvStoragefoo[(gl_GlobalInvocationID.x / 4) % 8];
|
||||
foo[gl_GlobalInvocationID.x % 4] = _15[gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_Position = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_Position;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_PointSize = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_PointSize;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_CullDistance;
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
|
||||
patchOut.foo_patch = float4(0.0);
|
||||
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
|
||||
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
|
||||
foo[gl_InvocationID] = float4(1.0);
|
||||
patchOut.foo_patch = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -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 _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex
|
||||
{
|
||||
float4 _RESERVED_IDENTIFIER_FIXUP_gl_Position;
|
||||
float _RESERVED_IDENTIFIER_FIXUP_gl_PointSize;
|
||||
spvUnsafeArray<float, 1> _RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> _RESERVED_IDENTIFIER_FIXUP_gl_CullDistance;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float4, 4> _15 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) });
|
||||
constant spvUnsafeArray<float, 1> _45 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _46 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 foo;
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4> _29 = spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4>({ _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
threadgroup float4 foo_patch;
|
||||
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
|
||||
gl_out[gl_InvocationID].foo = _15[gl_InvocationID];
|
||||
gl_out[gl_InvocationID].gl_Position = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_Position;
|
||||
gl_out[gl_InvocationID].gl_PointSize = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_PointSize;
|
||||
gl_out[gl_InvocationID].gl_ClipDistance = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance;
|
||||
gl_out[gl_InvocationID].gl_CullDistance = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_CullDistance;
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
|
||||
foo_patch = float4(0.0);
|
||||
gl_out[gl_InvocationID].foo = float4(1.0);
|
||||
foo_patch = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,92 @@
|
||||
#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 _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex
|
||||
{
|
||||
float4 _RESERVED_IDENTIFIER_FIXUP_gl_Position;
|
||||
float _RESERVED_IDENTIFIER_FIXUP_gl_PointSize;
|
||||
spvUnsafeArray<float, 1> _RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> _RESERVED_IDENTIFIER_FIXUP_gl_CullDistance;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float4, 4> _15 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) });
|
||||
constant spvUnsafeArray<float, 1> _45 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _46 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 foo;
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
};
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4> _29 = spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4>({ _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].foo = _15[gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_Position = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_Position;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_PointSize = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_PointSize;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_CullDistance;
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
|
||||
threadgroup float4 spvStoragefoo_patch[8];
|
||||
threadgroup float4 (&foo_patch) = spvStoragefoo_patch[(gl_GlobalInvocationID.x / 4) % 8];
|
||||
foo_patch = float4(0.0);
|
||||
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
|
||||
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
|
||||
gl_out[gl_InvocationID].foo = float4(1.0);
|
||||
foo_patch = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float4, 4> _15 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) });
|
||||
constant spvUnsafeArray<float, 1> _45 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _46 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 foo;
|
||||
float4 gl_Position;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 foo_patch;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<gl_PerVertex, 4> _29 = spvUnsafeArray<gl_PerVertex, 4>({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
threadgroup gl_PerVertex gl_out_masked[4];
|
||||
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
|
||||
gl_out[gl_InvocationID].foo = _15[gl_InvocationID];
|
||||
gl_out[gl_InvocationID].gl_Position = _29[gl_InvocationID].gl_Position;
|
||||
gl_out[gl_InvocationID].gl_ClipDistance = _29[gl_InvocationID].gl_ClipDistance;
|
||||
gl_out[gl_InvocationID].gl_CullDistance = _29[gl_InvocationID].gl_CullDistance;
|
||||
gl_out_masked[gl_InvocationID] = _29[gl_InvocationID];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
|
||||
patchOut.foo_patch = float4(0.0);
|
||||
gl_out[gl_InvocationID].foo = float4(1.0);
|
||||
patchOut.foo_patch = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out_masked[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float4, 4> _15 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) });
|
||||
constant spvUnsafeArray<float, 1> _45 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _46 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 foo;
|
||||
float4 gl_Position;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 foo_patch;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<gl_PerVertex, 4> _29 = spvUnsafeArray<gl_PerVertex, 4>({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].foo = _15[gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_Position = _29[gl_GlobalInvocationID.x % 4].gl_Position;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _29[gl_GlobalInvocationID.x % 4].gl_ClipDistance;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _29[gl_GlobalInvocationID.x % 4].gl_CullDistance;
|
||||
threadgroup gl_PerVertex spvStoragegl_out_masked[8][4];
|
||||
threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8];
|
||||
gl_out_masked[gl_GlobalInvocationID.x % 4] = _29[gl_GlobalInvocationID.x % 4];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
|
||||
patchOut.foo_patch = float4(0.0);
|
||||
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
|
||||
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
|
||||
gl_out[gl_InvocationID].foo = float4(1.0);
|
||||
patchOut.foo_patch = float4(2.0);
|
||||
gl_out[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out_masked[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float4, 4> _15 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) });
|
||||
constant spvUnsafeArray<float, 1> _45 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _46 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 foo;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 foo_patch;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<gl_PerVertex, 4> _29 = spvUnsafeArray<gl_PerVertex, 4>({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
threadgroup gl_PerVertex gl_out_masked[4];
|
||||
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
|
||||
gl_out[gl_InvocationID].foo = _15[gl_InvocationID];
|
||||
gl_out[gl_InvocationID].gl_PointSize = _29[gl_InvocationID].gl_PointSize;
|
||||
gl_out[gl_InvocationID].gl_ClipDistance = _29[gl_InvocationID].gl_ClipDistance;
|
||||
gl_out[gl_InvocationID].gl_CullDistance = _29[gl_InvocationID].gl_CullDistance;
|
||||
gl_out_masked[gl_InvocationID] = _29[gl_InvocationID];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
|
||||
patchOut.foo_patch = float4(0.0);
|
||||
gl_out[gl_InvocationID].foo = float4(1.0);
|
||||
patchOut.foo_patch = float4(2.0);
|
||||
gl_out_masked[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
constant spvUnsafeArray<float4, 4> _15 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) });
|
||||
constant spvUnsafeArray<float, 1> _45 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
constant spvUnsafeArray<float, 1> _46 = spvUnsafeArray<float, 1>({ 0.0 });
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 foo;
|
||||
float gl_PointSize;
|
||||
spvUnsafeArray<float, 1> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 foo_patch;
|
||||
};
|
||||
|
||||
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)]])
|
||||
{
|
||||
spvUnsafeArray<gl_PerVertex, 4> _29 = spvUnsafeArray<gl_PerVertex, 4>({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray<float, 1>({ 0.0 }), spvUnsafeArray<float, 1>({ 0.0 }) } });
|
||||
|
||||
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].foo = _15[gl_GlobalInvocationID.x % 4];
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_PointSize = _29[gl_GlobalInvocationID.x % 4].gl_PointSize;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _29[gl_GlobalInvocationID.x % 4].gl_ClipDistance;
|
||||
gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _29[gl_GlobalInvocationID.x % 4].gl_CullDistance;
|
||||
threadgroup gl_PerVertex spvStoragegl_out_masked[8][4];
|
||||
threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8];
|
||||
gl_out_masked[gl_GlobalInvocationID.x % 4] = _29[gl_GlobalInvocationID.x % 4];
|
||||
device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4];
|
||||
patchOut.foo_patch = float4(0.0);
|
||||
uint gl_InvocationID = gl_GlobalInvocationID.x % 4;
|
||||
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]);
|
||||
gl_out[gl_InvocationID].foo = float4(1.0);
|
||||
patchOut.foo_patch = float4(2.0);
|
||||
gl_out_masked[gl_InvocationID].gl_Position = float4(3.0);
|
||||
gl_out[gl_InvocationID].gl_PointSize = 4.0;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ void fork0_epilogue(thread const float4& _87, thread const float4& _88, thread c
|
||||
}
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void fork0(uint vForkInstanceId, device half (&gl_TessLevelOuter)[3], thread spvUnsafeArray<float4, 4> (&opc), constant cb1_struct& cb0_0, thread float4& v_48, thread float4& v_49, thread float4& v_50)
|
||||
void fork0(uint vForkInstanceId, device half (&gl_TessLevelOuter)[3], thread spvUnsafeArray<float4, 4>& opc, constant cb1_struct& cb0_0, thread float4& v_48, thread float4& v_49, thread float4& v_50)
|
||||
{
|
||||
float4 r0;
|
||||
r0.x = as_type<float>(vForkInstanceId);
|
||||
@ -90,7 +90,7 @@ void fork1_epilogue(thread const float4& _109, device half &gl_TessLevelInner)
|
||||
}
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void fork1(device half &gl_TessLevelInner, thread spvUnsafeArray<float4, 4> (&opc), constant cb1_struct& cb0_0, thread float4& v_56)
|
||||
void fork1(device half &gl_TessLevelInner, thread spvUnsafeArray<float4, 4>& opc, constant cb1_struct& cb0_0, thread float4& v_56)
|
||||
{
|
||||
opc[3u].x = cb0_0._m0[0u].x;
|
||||
v_56 = opc[3u];
|
||||
|
@ -85,7 +85,7 @@ struct main0_in
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3> (&p), thread const uint& i)
|
||||
HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3>& p, thread const uint& i)
|
||||
{
|
||||
HSOut _output;
|
||||
_output.pos = p[i].pos;
|
||||
@ -94,7 +94,7 @@ HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3> (&p), thread const u
|
||||
}
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
HSConstantOut PatchHS(thread const spvUnsafeArray<VertexOutput, 3> (&_patch))
|
||||
HSConstantOut PatchHS(thread const spvUnsafeArray<VertexOutput, 3>& _patch)
|
||||
{
|
||||
HSConstantOut _output;
|
||||
_output.EdgeTess[0] = (float2(1.0) + _patch[0].uv).x;
|
||||
|
@ -64,7 +64,7 @@ struct HSConstantOut
|
||||
|
||||
struct VertexOutput_1
|
||||
{
|
||||
float3 uv;
|
||||
float2 uv;
|
||||
};
|
||||
|
||||
struct HSOut_1
|
||||
@ -80,13 +80,13 @@ struct main0_out
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float3 VertexOutput_uv;
|
||||
ushort2 m_172;
|
||||
VertexOutput_1 p;
|
||||
ushort2 m_171;
|
||||
float4 gl_Position;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3> (&p), thread const uint& i)
|
||||
HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3>& p, thread const uint& i)
|
||||
{
|
||||
HSOut _output;
|
||||
_output.pos = p[i].pos;
|
||||
@ -95,7 +95,7 @@ HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3> (&p), thread const u
|
||||
}
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
HSConstantOut PatchHS(thread const spvUnsafeArray<VertexOutput, 3> (&_patch))
|
||||
HSConstantOut PatchHS(thread const spvUnsafeArray<VertexOutput, 3>& _patch)
|
||||
{
|
||||
HSConstantOut _output;
|
||||
_output.EdgeTess[0] = (float2(1.0) + _patch[0].uv).x;
|
||||
@ -113,11 +113,11 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
|
||||
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1]);
|
||||
spvUnsafeArray<VertexOutput, 3> p;
|
||||
p[0].pos = gl_in[0].gl_Position;
|
||||
p[0].uv = gl_in[0].VertexOutput_uv.xy;
|
||||
p[0].uv = gl_in[0].p.uv;
|
||||
p[1].pos = gl_in[1].gl_Position;
|
||||
p[1].uv = gl_in[1].VertexOutput_uv.xy;
|
||||
p[1].uv = gl_in[1].p.uv;
|
||||
p[2].pos = gl_in[2].gl_Position;
|
||||
p[2].uv = gl_in[2].VertexOutput_uv.xy;
|
||||
p[2].uv = gl_in[2].p.uv;
|
||||
uint i = gl_InvocationID;
|
||||
spvUnsafeArray<VertexOutput, 3> param;
|
||||
param = p;
|
||||
|
@ -0,0 +1,71 @@
|
||||
#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<float, 2> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
uint3 m_57;
|
||||
ushort2 m_61;
|
||||
spvUnsafeArray<float, 2> gl_ClipDistance;
|
||||
spvUnsafeArray<float, 1> gl_CullDistance;
|
||||
};
|
||||
|
||||
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]);
|
||||
gl_out[gl_InvocationID].gl_ClipDistance[0] = gl_in[gl_InvocationID].gl_ClipDistance[0];
|
||||
gl_out[gl_InvocationID].gl_ClipDistance[1] = gl_in[gl_InvocationID].gl_ClipDistance[1];
|
||||
gl_out[gl_InvocationID].gl_CullDistance[0] = gl_in[gl_InvocationID].gl_CullDistance[0];
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ struct main0_in
|
||||
struct main0_patchIn
|
||||
{
|
||||
float4 FragColor [[attribute(0)]];
|
||||
float2 gl_TessLevelInner [[attribute(3)]];
|
||||
float4 gl_TessLevelOuter [[attribute(4)]];
|
||||
float4 gl_TessLevelOuter [[attribute(3)]];
|
||||
float2 gl_TessLevelInner [[attribute(4)]];
|
||||
patch_control_point<main0_in> gl_in;
|
||||
};
|
||||
|
||||
|
37
reference/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese
Normal file
37
reference/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese
Normal file
@ -0,0 +1,37 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 gl_Position [[attribute(0)]];
|
||||
float gl_ClipDistance_0 [[attribute(1)]];
|
||||
float gl_ClipDistance_1 [[attribute(2)]];
|
||||
float gl_CullDistance_0 [[attribute(3)]];
|
||||
float gl_CullDistance_1 [[attribute(4)]];
|
||||
float gl_CullDistance_2 [[attribute(5)]];
|
||||
};
|
||||
|
||||
struct main0_patchIn
|
||||
{
|
||||
patch_control_point<main0_in> gl_in;
|
||||
};
|
||||
|
||||
[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.gl_Position.x = patchIn.gl_in[0].gl_ClipDistance_0;
|
||||
out.gl_Position.y = patchIn.gl_in[1].gl_CullDistance_0;
|
||||
out.gl_Position.z = patchIn.gl_in[0].gl_ClipDistance_1;
|
||||
out.gl_Position.w = patchIn.gl_in[1].gl_CullDistance_1;
|
||||
out.gl_Position += patchIn.gl_in[0].gl_Position;
|
||||
out.gl_Position += patchIn.gl_in[1].gl_Position;
|
||||
return out;
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
#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;
|
||||
spvUnsafeArray<float, 2> gl_CullDistance;
|
||||
};
|
||||
|
||||
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]])
|
||||
{
|
||||
device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x];
|
||||
if (any(gl_GlobalInvocationID >= spvStageInputSize))
|
||||
return;
|
||||
out.gl_CullDistance[0] = 1.0;
|
||||
out.gl_CullDistance[1] = 3.0;
|
||||
out.gl_Position = float4(1.0);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ struct main0_in
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void func(thread float4& FragColor, thread float2 baz, thread spvUnsafeArray<float2, 2> (&a), thread _13& s, thread main0_in& in)
|
||||
void func(thread float4& FragColor, thread float2 baz, thread spvUnsafeArray<float2, 2>& a, thread _13& s, thread main0_in& in)
|
||||
{
|
||||
float2 _237 = FragColor.xy + baz;
|
||||
FragColor = float4(_237.x, _237.y, FragColor.z, FragColor.w);
|
||||
|
@ -10,8 +10,8 @@ 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]])
|
||||
|
@ -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)]])
|
||||
@ -26,8 +25,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
|
||||
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;
|
||||
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);
|
||||
|
67
reference/shaders-msl/frag/cull-distance-varying.frag
Normal file
67
reference/shaders-msl/frag/cull-distance-varying.frag
Normal 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;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ struct main0_in
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void set_globals(thread spvUnsafeArray<float, 2> (&FragColors), thread float3& vColor, thread float2& FragColor2, thread float3& FragColor3)
|
||||
void set_globals(thread spvUnsafeArray<float, 2>& FragColors, thread float3& vColor, thread float2& FragColor2, thread float3& FragColor3)
|
||||
{
|
||||
FragColors[0] = vColor.x;
|
||||
FragColors[1] = vColor.y;
|
||||
|
@ -66,13 +66,13 @@ inline Tx mod(Tx x, Ty y)
|
||||
}
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_deeper_in_function(thread spvUnsafeArray<float4, 4> (&FragColor), thread float4& vA, thread float4& vB)
|
||||
void write_deeper_in_function(thread spvUnsafeArray<float4, 4>& FragColor, thread float4& vA, thread float4& vB)
|
||||
{
|
||||
FragColor[3] = vA * vB;
|
||||
}
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_function(thread spvUnsafeArray<float4, 4> (&FragColor), thread float4& vA, thread float4& vB)
|
||||
void write_in_function(thread spvUnsafeArray<float4, 4>& FragColor, thread float4& vA, thread float4& vB)
|
||||
{
|
||||
FragColor[2] = vA - vB;
|
||||
write_deeper_in_function(FragColor, vA, vB);
|
||||
|
@ -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 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)]];
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
float4 read_in_func(thread spvUnsafeArray<float, 2>& gl_CullDistance, thread spvUnsafeArray<float, 2>& gl_ClipDistance)
|
||||
{
|
||||
return float4(gl_CullDistance[0], gl_CullDistance[1], gl_ClipDistance[0], gl_ClipDistance[1]);
|
||||
}
|
||||
|
||||
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 = read_in_func(gl_CullDistance, gl_ClipDistance);
|
||||
return out;
|
||||
}
|
||||
|
@ -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]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_function(threadgroup P& _11, device main0_patchOut& patchOut, device main0_out* thread & gl_out, thread uint& gl_InvocationID)
|
||||
{
|
||||
_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);
|
||||
}
|
||||
|
||||
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];
|
||||
write_in_function(_11, patchOut, gl_out, gl_InvocationID);
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_function(threadgroup P& _11, device main0_patchOut& patchOut, device main0_out* thread & gl_out, thread uint& gl_InvocationID)
|
||||
{
|
||||
_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);
|
||||
}
|
||||
|
||||
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]);
|
||||
write_in_function(_11, patchOut, gl_out, gl_InvocationID);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_function(device main0_patchOut& patchOut, threadgroup C (&c)[4], device main0_out* thread & gl_out, thread uint& gl_InvocationID)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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];
|
||||
write_in_function(patchOut, c, gl_out, gl_InvocationID);
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_function(device main0_patchOut& patchOut, threadgroup C (&c)[4], device main0_out* thread & gl_out, thread uint& gl_InvocationID)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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]);
|
||||
write_in_function(patchOut, c, gl_out, gl_InvocationID);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
#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]];
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(thread float4& v0, thread float4& v1, thread float4& gl_Position, thread float& gl_PointSize, thread spvUnsafeArray<float, 2>& gl_ClipDistance)
|
||||
{
|
||||
v0 = float4(1.0);
|
||||
v1 = float4(2.0);
|
||||
gl_Position = float4(3.0);
|
||||
gl_PointSize = 4.0;
|
||||
gl_ClipDistance[0] = 1.0;
|
||||
gl_ClipDistance[1] = 0.5;
|
||||
}
|
||||
|
||||
vertex main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
spvUnsafeArray<float, 2> gl_ClipDistance = {};
|
||||
write_in_func(out.v0, out.v1, out.gl_Position, out.gl_PointSize, gl_ClipDistance);
|
||||
return out;
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(thread float4& v0, device float4& v1, device float4& gl_Position, device float& gl_PointSize, device spvUnsafeArray<float, 2>& gl_ClipDistance)
|
||||
{
|
||||
v0 = float4(1.0);
|
||||
v1 = float4(2.0);
|
||||
gl_Position = float4(3.0);
|
||||
gl_PointSize = 4.0;
|
||||
gl_ClipDistance[0] = 1.0;
|
||||
gl_ClipDistance[1] = 0.5;
|
||||
}
|
||||
|
||||
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;
|
||||
write_in_func(v0, out.v1, out.gl_Position, out.gl_PointSize, out.gl_ClipDistance);
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
float4 v1;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(threadgroup float4 (&v0)[4], thread uint& gl_InvocationID, device float4& v1, device main0_out* thread & gl_out)
|
||||
{
|
||||
v0[gl_InvocationID] = float4(1.0);
|
||||
v0[gl_InvocationID].x = 2.0;
|
||||
if (gl_InvocationID == 0)
|
||||
{
|
||||
v1 = float4(2.0);
|
||||
((device 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;
|
||||
}
|
||||
|
||||
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];
|
||||
write_in_func(v0, gl_InvocationID, patchOut.v1, gl_out);
|
||||
}
|
||||
|
@ -0,0 +1,87 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(threadgroup float4 (&v0)[4], thread uint& gl_InvocationID, device spvUnsafeArray<float4, 2>& v1, device float4& v3, device main0_out* thread & gl_out)
|
||||
{
|
||||
v0[gl_InvocationID] = float4(1.0);
|
||||
v0[gl_InvocationID].z = 3.0;
|
||||
if (gl_InvocationID == 0)
|
||||
{
|
||||
v1[0] = float4(2.0);
|
||||
((device float*)&v1[0])[0u] = 3.0;
|
||||
v1[1] = float4(2.0);
|
||||
((device float*)&v1[1])[0u] = 5.0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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]);
|
||||
write_in_func(v0, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out);
|
||||
}
|
||||
|
@ -0,0 +1,84 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(threadgroup float4 (&v0)[4], thread uint& gl_InvocationID, device spvUnsafeArray<float4, 2>& v1, device float4& v3, device main0_out* thread & gl_out)
|
||||
{
|
||||
v0[gl_InvocationID] = float4(1.0);
|
||||
v0[gl_InvocationID].z = 3.0;
|
||||
if (gl_InvocationID == 0)
|
||||
{
|
||||
v1[0] = float4(2.0);
|
||||
((device float*)&v1[0])[0u] = 3.0;
|
||||
v1[1] = float4(2.0);
|
||||
((device float*)&v1[1])[0u] = 5.0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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];
|
||||
write_in_func(v0, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out);
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#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)]];
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(thread float4& v0, thread float4& v1, thread float4& gl_Position, thread float& gl_PointSize, thread float (&gl_ClipDistance)[2])
|
||||
{
|
||||
v0 = float4(1.0);
|
||||
v1 = float4(2.0);
|
||||
gl_Position = float4(3.0);
|
||||
gl_PointSize = 4.0;
|
||||
gl_ClipDistance[0] = 1.0;
|
||||
gl_ClipDistance[1] = 0.5;
|
||||
}
|
||||
|
||||
vertex main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
float4 v0 = {};
|
||||
write_in_func(v0, out.v1, out.gl_Position, out.gl_PointSize, out.gl_ClipDistance);
|
||||
out.gl_ClipDistance_0 = out.gl_ClipDistance[0];
|
||||
out.gl_ClipDistance_1 = out.gl_ClipDistance[1];
|
||||
return out;
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(device float4& v0, thread float4& v1, device float4& gl_Position, device float& gl_PointSize, device spvUnsafeArray<float, 2>& gl_ClipDistance)
|
||||
{
|
||||
v0 = float4(1.0);
|
||||
v1 = float4(2.0);
|
||||
gl_Position = float4(3.0);
|
||||
gl_PointSize = 4.0;
|
||||
gl_ClipDistance[0] = 1.0;
|
||||
gl_ClipDistance[1] = 0.5;
|
||||
}
|
||||
|
||||
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;
|
||||
write_in_func(out.v0, v1, out.gl_Position, out.gl_PointSize, out.gl_ClipDistance);
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 v0;
|
||||
float4 gl_Position;
|
||||
float gl_PointSize;
|
||||
};
|
||||
|
||||
struct main0_patchOut
|
||||
{
|
||||
};
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup float4& v1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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];
|
||||
write_in_func(gl_out, gl_InvocationID, v1);
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup float4 (&v1)[2], device float4& v3)
|
||||
{
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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]);
|
||||
write_in_func(gl_out, gl_InvocationID, v1, patchOut.v3);
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup float4 (&v1)[2], device float4& v3)
|
||||
{
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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];
|
||||
write_in_func(gl_out, gl_InvocationID, v1, patchOut.v3);
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#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)]];
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(thread float4& v0, thread float4& v1, thread float4& gl_Position, thread float& gl_PointSize, thread float (&gl_ClipDistance)[2])
|
||||
{
|
||||
v0 = float4(1.0);
|
||||
v1 = float4(2.0);
|
||||
gl_Position = float4(3.0);
|
||||
gl_PointSize = 4.0;
|
||||
gl_ClipDistance[0] = 1.0;
|
||||
gl_ClipDistance[1] = 0.5;
|
||||
}
|
||||
|
||||
vertex main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
float4 v1 = {};
|
||||
write_in_func(out.v0, v1, out.gl_Position, out.gl_PointSize, out.gl_ClipDistance);
|
||||
out.gl_ClipDistance_0 = out.gl_ClipDistance[0];
|
||||
out.gl_ClipDistance_1 = out.gl_ClipDistance[1];
|
||||
return out;
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(device float4& v0, device float4& v1, device float4& gl_Position, thread float& gl_PointSize, device spvUnsafeArray<float, 2>& gl_ClipDistance)
|
||||
{
|
||||
v0 = float4(1.0);
|
||||
v1 = float4(2.0);
|
||||
gl_Position = float4(3.0);
|
||||
gl_PointSize = 4.0;
|
||||
gl_ClipDistance[0] = 1.0;
|
||||
gl_ClipDistance[1] = 0.5;
|
||||
}
|
||||
|
||||
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;
|
||||
write_in_func(out.v0, out.v1, out.gl_Position, gl_PointSize, out.gl_ClipDistance);
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, device spvUnsafeArray<float4, 2>& v1, device float4& v3, threadgroup gl_PerVertex (&gl_out_masked)[4])
|
||||
{
|
||||
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);
|
||||
((device float*)&v1[0])[0u] = 3.0;
|
||||
v1[1] = float4(2.0);
|
||||
((device float*)&v1[1])[0u] = 5.0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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]);
|
||||
write_in_func(gl_out, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out_masked);
|
||||
}
|
||||
|
@ -0,0 +1,92 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, device spvUnsafeArray<float4, 2>& v1, device float4& v3, threadgroup gl_PerVertex (&gl_out_masked)[4])
|
||||
{
|
||||
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);
|
||||
((device float*)&v1[0])[0u] = 3.0;
|
||||
v1[1] = float4(2.0);
|
||||
((device float*)&v1[1])[0u] = 5.0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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];
|
||||
write_in_func(gl_out, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out_masked);
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#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)]];
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
void write_in_func(thread float4& v0, thread float4& v1, thread float4& gl_Position, thread float& gl_PointSize, thread float (&gl_ClipDistance)[2])
|
||||
{
|
||||
v0 = float4(1.0);
|
||||
v1 = float4(2.0);
|
||||
gl_Position = float4(3.0);
|
||||
gl_PointSize = 4.0;
|
||||
gl_ClipDistance[0] = 1.0;
|
||||
gl_ClipDistance[1] = 0.5;
|
||||
}
|
||||
|
||||
vertex main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
float gl_PointSize = {};
|
||||
write_in_func(out.v0, out.v1, out.gl_Position, gl_PointSize, out.gl_ClipDistance);
|
||||
out.gl_ClipDistance_0 = out.gl_ClipDistance[0];
|
||||
out.gl_ClipDistance_1 = out.gl_ClipDistance[1];
|
||||
return out;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user