SPIRV-Cross/reference/shaders-msl-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

29 lines
412 B
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct UBO
{
float4 v;
float4x4 m;
};
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float4 vColor [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], constant UBO& _13 [[buffer(0)]])
{
main0_out out = {};
out.FragColor = (_13.m * in.vColor) + _13.v;
return out;
}