SPIRV-Cross/reference/shaders-msl/vert/out_block.vert
Hans-Kristian Arntzen d310060f92 MSL: Support global I/O block and struct Input/Output usage.
Implement this by flattening outputs and unflattening inputs explicitly.
This allows us to pass down a single struct instead of dealing with the
insanity that would be passing down each flattened member separately.

Remove stage_uniforms_var_id.
Seems to be dead code. Naked uniforms do not exist in SPIR-V for Vulkan,
which this seems to have been intended for. It was also unused elsewhere.
2018-09-13 16:04:24 +02:00

42 lines
811 B
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Transform
{
float4x4 transform;
};
struct VertexOut
{
float4 color;
float4 color2;
};
struct main0_out
{
float4 VertexOut_color [[user(locn2)]];
float4 VertexOut_color2 [[user(locn3)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float3 position [[attribute(0)]];
float4 color [[attribute(1)]];
};
vertex main0_out main0(main0_in in [[stage_in]], constant Transform& block [[buffer(0)]])
{
main0_out out = {};
VertexOut outputs = {};
out.gl_Position = block.transform * float4(in.position, 1.0);
outputs.color = in.color;
outputs.color2 = in.color + float4(1.0);
out.VertexOut_color = outputs.color;
out.VertexOut_color2 = outputs.color2;
return out;
}