SPIRV-Cross/reference/shaders-hlsl-no-opt/frag/ubo-offset-out-of-order.frag
Hans-Kristian Arntzen 0ebb88cc39 MSL: Redirect member indices when buffer has been sorted by Offset.
If a buffer rewrites its Offsets, all member references to that struct
are invalidated, and must be redirected, do so in to_member_reference,
but there might be other places where this is needed. Fix as required.
SPIR-V code relying on this is somewhat questionable, but seems to be
in-spec.
2020-04-30 11:48:53 +02:00

34 lines
570 B
GLSL

cbuffer UBO : register(b0)
{
row_major float4x4 _13_m : packoffset(c1);
float4 _13_v : packoffset(c0);
};
static float4 FragColor;
static float4 vColor;
struct SPIRV_Cross_Input
{
float4 vColor : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = mul(vColor, _13_m) + _13_v;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vColor = stage_input.vColor;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}