SPIRV-Cross/reference/shaders-msl/frag/packing-test-3.frag
Hans-Kristian Arntzen a07441568e Overhaul how we deal with reserved identifiers.
- Do not silently drop reserved identifiers in the parser. This makes it
  possible to reflect identifiers which are reserved by the
  cross-compiler module.
- Instead of dropping the name, emit _RESERVED_IDENTIFIER_FIXUP in the
  source to make it clear that a name has been rewritten.
- Document what is reserved and not.
2020-08-21 16:33:27 +02:00

56 lines
1.1 KiB
GLSL

#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)]];
};
static inline __attribute__((always_inline))
float4 _main(thread const VertexOutput& IN, constant CB0& _RESERVED_IDENTIFIER_FIXUP_24)
{
TestStruct st;
st.position = float3(_RESERVED_IDENTIFIER_FIXUP_24.CB0[1].position);
st.radius = _RESERVED_IDENTIFIER_FIXUP_24.CB0[1].radius;
float4 col = float4(st.position, st.radius);
return col;
}
fragment main0_out main0(constant CB0& _RESERVED_IDENTIFIER_FIXUP_24 [[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, _RESERVED_IDENTIFIER_FIXUP_24);
return out;
}