Files
Seele/res/shaders/FullScreenQuad.slang
T

16 lines
388 B
Plaintext

struct QuadOutput
{
float2 uv : UV;
float4 position : SV_Position;
}
[shader("vertex")]
QuadOutput quadMain(uint vertexIndex : SV_VertexID)
{
QuadOutput result;
result.uv = float2(vertexIndex & 2, (vertexIndex << 1) & 2);
float2 ndc = result.uv * 2.0f + -1.0f;
ndc.y = -ndc.y; // Flip Y for flipped viewport
result.position = float4(ndc, 0.0f, 1.0f);
return result;
}