Backlog/engine/rend/shaders/sample.vert.hlsl

47 lines
857 B
HLSL

struct Input
{
uint VertexIndex : SV_VertexID;
};
struct Output
{
float4 Color : TEXCOORD0;
float4 Position : SV_Position;
};
struct Scene
{
float3 color;
};
StructuredBuffer<Scene> test: register(t0, space0);
Output main(Input input)
{
Output output;
float2 pos;
if (input.VertexIndex == 0)
{
pos = (-1.0f).xx;
output.Color = float4(test[0].color, 1.0f);
}
else
{
if (input.VertexIndex == 1)
{
pos = float2(1.0f, -1.0f);
output.Color = float4(test[1].color, 1.0f);
}
else
{
if (input.VertexIndex == 2)
{
pos = float2(0.0f, 1.0f);
output.Color = float4(test[2].color, 1.0f);
}
}
}
output.Position = float4(pos, 0.0f, 1.0f);
return output;
}