-
-
Save Inori/6660d3b4d979baebe9c5b3a97ea19b0c to your computer and use it in GitHub Desktop.
A vertex shader that uses the vertex ID to generate a full-screen quad. Don't bind vertex buffer, index buffer or input layout. Just render three vertices!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Output | |
{ | |
float4 position_cs : SV_POSITION; | |
float2 texcoord : TEXCOORD; | |
}; | |
Output main(uint id: SV_VertexID) | |
{ | |
Output output; | |
output.texcoord = float2((id << 1) & 2, id & 2); | |
output.position_cs = float4(output.texcoord * float2(2, -2) + float2(-1, 1), 0, 1); | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment