Backlog/lib/sdl3/content/hello-triangle.vert.hlsl

62 lines
1.1 KiB
HLSL

struct Input
{
uint VertexIndex : SV_VertexID;
};
struct Output
{
float4 Color : TEXCOORD0;
float4 Position : SV_Position;
};
struct Scene2
{
float4 color;
float4 lmfao;
};
struct Scene
{
float4 color;
};
cbuffer TransformBuffer : register(b0, space1)
{
float4x4 modelMatrix;
float4x4 viewMatrix;
float4x4 projectionMatrix;
float time;
};
StructuredBuffer<Scene> test: register(t0, space0);
StructuredBuffer<Scene2> test2: register(t1, space0);
Output main(Input input)
{
Output output;
float2 pos;
if (input.VertexIndex == 0)
{
pos = (-1.0f).xx;
output.Color = test[0].color;
}
else
{
if (input.VertexIndex == 1)
{
pos = float2(1.0f, -1.0f);
output.Color = test2[1].color;
}
else
{
if (input.VertexIndex == 2)
{
pos = float2(0.0f, 1.0f);
output.Color = test[2].color;
}
}
}
output.Position = mul(modelMatrix, float4(pos, 0.0f, 1.0f));
return output;
}