diff options
-rw-r--r-- | src/video_core/primitive_assembly.cpp | 15 | ||||
-rw-r--r-- | src/video_core/primitive_assembly.h | 7 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index acd2ac5e2..9c3dd4cab 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp @@ -17,15 +17,18 @@ template <typename VertexType> void PrimitiveAssembler<VertexType>::SubmitVertex(const VertexType& vtx, TriangleHandler triangle_handler) { switch (topology) { - // TODO: Figure out what's different with TriangleTopology::Shader. case PipelineRegs::TriangleTopology::List: case PipelineRegs::TriangleTopology::Shader: if (buffer_index < 2) { buffer[buffer_index++] = vtx; } else { buffer_index = 0; - - triangle_handler(buffer[0], buffer[1], vtx); + if (topology == PipelineRegs::TriangleTopology::Shader && winding) { + triangle_handler(buffer[1], buffer[0], vtx); + winding = false; + } else { + triangle_handler(buffer[0], buffer[1], vtx); + } } break; @@ -51,9 +54,15 @@ void PrimitiveAssembler<VertexType>::SubmitVertex(const VertexType& vtx, } template <typename VertexType> +void PrimitiveAssembler<VertexType>::SetWinding() { + winding = true; +} + +template <typename VertexType> void PrimitiveAssembler<VertexType>::Reset() { buffer_index = 0; strip_ready = false; + winding = false; } template <typename VertexType> diff --git a/src/video_core/primitive_assembly.h b/src/video_core/primitive_assembly.h index e8eccdf27..12de8e3b9 100644 --- a/src/video_core/primitive_assembly.h +++ b/src/video_core/primitive_assembly.h @@ -30,6 +30,12 @@ struct PrimitiveAssembler { void SubmitVertex(const VertexType& vtx, TriangleHandler triangle_handler); /** + * Invert the vertex order of the next triangle. Called by geometry shader emitter. + * This only takes effect for TriangleTopology::Shader. + */ + void SetWinding(); + + /** * Resets the internal state of the PrimitiveAssembler. */ void Reset(); @@ -45,6 +51,7 @@ private: int buffer_index; VertexType buffer[2]; bool strip_ready = false; + bool winding = false; }; } // namespace |