SPIRV-Cross/reference/opt/shaders-msl/vert/read-from-row-major-array.vert
Bill Hollings 9b4defe202 CompilerMSL support matrices & arrays in stage-in & stage-out.
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.
2018-06-12 11:41:35 -04:00

38 lines
1.3 KiB
GLSL

#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Block
{
float2x3 var[3][4];
};
struct main0_out
{
float v_vtxResult [[user(locn0)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float4 a_position [[attribute(0)]];
};
// Implementation of a conversion of matrix content from RowMajor to ColumnMajor organization.
float2x3 spvConvertFromRowMajor2x3(float2x3 m)
{
return float2x3(float3(m[0][0], m[0][2], m[1][1]), float3(m[0][1], m[1][0], m[1][2]));
}
vertex main0_out main0(main0_in in [[stage_in]], constant Block& _104 [[buffer(0)]])
{
main0_out out = {};
out.gl_Position = in.a_position;
out.v_vtxResult = ((float(abs(spvConvertFromRowMajor2x3(_104.var[0][0])[0].x - 2.0) < 0.0500000007450580596923828125) * float(abs(spvConvertFromRowMajor2x3(_104.var[0][0])[0].y - 6.0) < 0.0500000007450580596923828125)) * float(abs(spvConvertFromRowMajor2x3(_104.var[0][0])[0].z - (-6.0)) < 0.0500000007450580596923828125)) * ((float(abs(spvConvertFromRowMajor2x3(_104.var[0][0])[1].x) < 0.0500000007450580596923828125) * float(abs(spvConvertFromRowMajor2x3(_104.var[0][0])[1].y - 5.0) < 0.0500000007450580596923828125)) * float(abs(spvConvertFromRowMajor2x3(_104.var[0][0])[1].z - 5.0) < 0.0500000007450580596923828125));
return out;
}