9b4defe202
Support flattening StorageOutput & StorageInput matrices and arrays. No longer move matrix & array inputs to separate buffer. Add separate SPIRFunction::fixup_statements_in & SPIRFunction::fixup_statements_out instead of just SPIRFunction::fixup_statements. Emit SPIRFunction::fixup_statements at beginning of functions. CompilerMSL track vars_needing_early_declaration. Pass global output variables as variables to functions that access them. Sort input structs by location, same as output structs. Emit struct declarations in order output, input, uniforms. Regenerate reference shaders to new formats defined by above.
34 lines
683 B
GLSL
34 lines
683 B
GLSL
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct Buffer
|
|
{
|
|
float4x4 MVPRowMajor;
|
|
float4x4 MVPColMajor;
|
|
float4x4 M;
|
|
};
|
|
|
|
struct main0_out
|
|
{
|
|
float4 gl_Position [[position]];
|
|
};
|
|
|
|
struct main0_in
|
|
{
|
|
float4 Position [[attribute(0)]];
|
|
};
|
|
|
|
vertex main0_out main0(main0_in in [[stage_in]], constant Buffer& _13 [[buffer(0)]])
|
|
{
|
|
main0_out out = {};
|
|
float4 c0 = _13.M * (in.Position * _13.MVPRowMajor);
|
|
float4 c1 = _13.M * (_13.MVPColMajor * in.Position);
|
|
float4 c2 = _13.M * (_13.MVPRowMajor * in.Position);
|
|
float4 c3 = _13.M * (in.Position * _13.MVPColMajor);
|
|
out.gl_Position = ((c0 + c1) + c2) + c3;
|
|
return out;
|
|
}
|
|
|