Add some more MSL test shaders.

This commit is contained in:
Hans-Kristian Arntzen 2018-03-05 16:42:38 +01:00
parent 5fe79eb59c
commit 38d9d8af68
9 changed files with 292 additions and 0 deletions

View File

@ -0,0 +1,34 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u);
struct T1
{
float3 a;
float b;
};
struct T1_1
{
packed_float3 a;
float b;
};
struct Buffer0
{
T1_1 buf0[1];
};
struct Buffer1
{
float buf1[1];
};
kernel void main0(device Buffer0& _15 [[buffer(0)]], device Buffer1& _34 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
_34.buf1[gl_GlobalInvocationID.x] = _15.buf0[0].b;
}

View File

@ -0,0 +1,28 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u);
struct T1
{
packed_float3 a;
float b;
};
struct Buffer0
{
T1 buf0[1];
};
struct Buffer1
{
float buf1[1];
};
kernel void main0(device Buffer0& _14 [[buffer(0)]], device Buffer1& _24 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
_24.buf1[gl_GlobalInvocationID.x] = _14.buf0[0].b;
}

View File

@ -0,0 +1,39 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct VertexOutput
{
float4 HPosition;
};
struct TestStruct
{
float3 position;
float radius;
};
struct TestStruct_1
{
packed_float3 position;
float radius;
};
struct CB0
{
TestStruct_1 CB0[16];
};
struct main0_out
{
float4 _entryPointOutput [[color(0)]];
};
fragment main0_out main0(constant CB0& _26 [[buffer(0)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
out._entryPointOutput = float4(_26.CB0[1].position, _26.CB0[1].radius);
return out;
}

View File

@ -0,0 +1,38 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u);
struct T1
{
float3 a;
float b;
};
struct T1_1
{
packed_float3 a;
float b;
};
struct Buffer0
{
T1_1 buf0[1];
};
struct Buffer1
{
float buf1[1];
};
kernel void main0(device Buffer0& _15 [[buffer(0)]], device Buffer1& _34 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
T1 v;
v.a = _15.buf0[0].a;
v.b = _15.buf0[0].b;
float x = v.b;
_34.buf1[gl_GlobalInvocationID.x] = x;
}

View File

@ -0,0 +1,29 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u);
struct T1
{
packed_float3 a;
float b;
};
struct Buffer0
{
T1 buf0[1];
};
struct Buffer1
{
float buf1[1];
};
kernel void main0(device Buffer0& _14 [[buffer(0)]], device Buffer1& _24 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
float x = _14.buf0[0].b;
_24.buf1[gl_GlobalInvocationID.x] = x;
}

View File

@ -0,0 +1,54 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct VertexOutput
{
float4 HPosition;
};
struct TestStruct
{
float3 position;
float radius;
};
struct TestStruct_1
{
packed_float3 position;
float radius;
};
struct CB0
{
TestStruct_1 CB0[16];
};
struct main0_out
{
float4 _entryPointOutput [[color(0)]];
};
float4 _main(thread const VertexOutput& IN, constant CB0& v_26)
{
TestStruct st;
st.position = v_26.CB0[1].position;
st.radius = v_26.CB0[1].radius;
float4 col = float4(st.position, st.radius);
return col;
}
fragment main0_out main0(constant CB0& v_26 [[buffer(0)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
VertexOutput IN;
IN.HPosition = gl_FragCoord;
VertexOutput param = IN;
VertexOutput param_1 = param;
out._entryPointOutput = _main(param_1, v_26);
return out;
}

View File

@ -0,0 +1,18 @@
#version 450
struct T1
{
vec3 a;
float b;
};
layout(std430, binding = 1) buffer Buffer0 { T1 buf0[]; };
layout(std430, binding = 2) buffer Buffer1 { float buf1[]; };
layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
void main()
{
// broken case in Metal!
T1 v = buf0[0];
float x = v.b;
buf1[gl_GlobalInvocationID.x] = x;
}

View File

@ -0,0 +1,16 @@
#version 450
struct T1
{
vec3 a;
float b;
};
layout(std430, binding = 1) buffer Buffer0 { T1 buf0[]; };
layout(std430, binding = 2) buffer Buffer1 { float buf1[]; };
layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
void main()
{
float x = buf0[0].b;
buf1[gl_GlobalInvocationID.x] = x;
}

View File

@ -0,0 +1,36 @@
#version 450
struct VertexOutput
{
vec4 HPosition;
};
struct TestStruct
{
vec3 position;
float radius;
};
layout(binding = 0, std140) uniform CB0
{
TestStruct CB0[16];
} _24;
layout(location = 0) out vec4 _entryPointOutput;
vec4 _main(VertexOutput IN)
{
TestStruct st;
st.position = _24.CB0[1].position;
st.radius = _24.CB0[1].radius;
vec4 col = vec4(st.position, st.radius);
return col;
}
void main()
{
VertexOutput IN;
IN.HPosition = gl_FragCoord;
VertexOutput param = IN;
_entryPointOutput = _main(param);
}