How does this

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;

and this

pImmediateContext->VSSetShader(fxaaVS, ..., ...);
pImmediateContext->Draw(3, 0);

generate a Full Screen Quad?

  1. It has only three vertices b(provided quad has 4 vertices)
  2. the positions produced are also not like a (half of a) quad.

Looking at this, i might be confused between a quad and a full screen triangle.

  • 1
    \$\begingroup\$ It generates a fullscreen quad because it's a 'big triangle' that is clipped by the hardware to a quad. This is preferable because it avoids some duplicated work along what would otherwise be the diagonal seam if you draw it as two triangles. \$\endgroup\$ Commented Mar 8, 2018 at 17:36
  • \$\begingroup\$ Can you post this as an answer? Your comment answers my question \$\endgroup\$ Commented Mar 9, 2018 at 4:38
  • \$\begingroup\$ I think ratchet freak beat me to it :) \$\endgroup\$ Commented Mar 10, 2018 at 23:41

1 Answer 1


it doesn't generate a quad, instead it generates a fullscreen triangle.

The outputs end up as:

output[0].texcoord = float2(0,0); 
output[0].position_cs = float4(-1, 1, 0, 1);

output[1].texcoord = float2(2,0);  
output[1].position_cs = float4(3, 1, 0, 1);

output[2].texcoord = float2(0,2); 
output[2].position_cs = float4(-1, -3, 0, 1);

It goes beyond the edges of the screen but any part outside will get clipped by the rasterizer stage. Doing this avoid double coverage of evaluated pixel on the diagonal you get with 2 triangles.

  • 1
    \$\begingroup\$ Be aware that both the 'self-generating quad' and the 'big triangle' rely on the VertexID system-generated value which requires Direct3D Hardware Feature Level 10.0 or better hardware if you are using Direct3D. See this blog post \$\endgroup\$ Commented Mar 8, 2018 at 17:37
  • \$\begingroup\$ DirectX 11 is the API... Direct3D Hardware Feature Level is what GPU is attached to the computer. Be sure you know the difference. \$\endgroup\$ Commented Mar 10, 2018 at 23:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .