Skip to content
  • Louis-Francis Ratté-Boulianne's avatar
    d3d12: Create geometry shader to re-order vertices if needed · 1941a95f
    Louis-Francis Ratté-Boulianne authored and Erik Faye-Lund's avatar Erik Faye-Lund committed
     Triangle strips are not tesselated the same way in OpenGL and in
     DirectX12. For a triangle strip with vertices: 0, 1, 2, 3, 4...
    
     DirectX12 will invert the last two vertices of every other triangle
     to preserve the winding order:
    
     (0, 1, 2) - (1, 3, 2) - (2, 3, 4) - (3, 5, 4)
    
     Meanwhile, OpenGL expects the first two vertices to be inverted:
    
     (0, 1, 2) - (2, 1, 3) - (2, 3, 4) - (4, 3, 5)
    
     This detail is relevent when flat shading or transform feedback
     is enabled. Consequently, we need to re-order vertices in the
     two cases:
    
      - When flatshading is enabled, attributeAtVertex is not supported, and
        the provoking vertex is the last one OR we are drawing triangle
        strips. (note: line primitives are not implemented yet)
    
      - When transform feedback is enabled and we are drawing triangle
        strips.
    1941a95f