diff options
author | wwylele <wwylele@gmail.com> | 2017-07-26 14:07:13 +0200 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2017-08-19 09:13:20 +0200 |
commit | 36981a5aa6ffcc10417e533ab00de3b6f9bad067 (patch) | |
tree | a1a32917c5e51c55ac05fe5780d3bebf85211c4c /src | |
parent | correct constness (diff) | |
download | yuzu-36981a5aa6ffcc10417e533ab00de3b6f9bad067.tar yuzu-36981a5aa6ffcc10417e533ab00de3b6f9bad067.tar.gz yuzu-36981a5aa6ffcc10417e533ab00de3b6f9bad067.tar.bz2 yuzu-36981a5aa6ffcc10417e533ab00de3b6f9bad067.tar.lz yuzu-36981a5aa6ffcc10417e533ab00de3b6f9bad067.tar.xz yuzu-36981a5aa6ffcc10417e533ab00de3b6f9bad067.tar.zst yuzu-36981a5aa6ffcc10417e533ab00de3b6f9bad067.zip |
Diffstat (limited to 'src')
-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 |