diff options
| author | 2014-08-17 17:44:55 +0200 | |
|---|---|---|
| committer | 2014-08-25 22:03:19 +0200 | |
| commit | 2f1c129f6407fe2d5c8c3e57c6717d5668570de5 (patch) | |
| tree | 5d12dadd9ffe3b46b9b94a84b7688d6d3b8260fd /src/video_core/primitive_assembly.cpp | |
| parent | Pica/Rasterizer: Add texturing support. (diff) | |
| download | yuzu-2f1c129f6407fe2d5c8c3e57c6717d5668570de5.tar.gz yuzu-2f1c129f6407fe2d5c8c3e57c6717d5668570de5.tar.xz yuzu-2f1c129f6407fe2d5c8c3e57c6717d5668570de5.zip | |
Pica: Consolidate the primitive assembly code in PrimitiveAssembly and GeometryDumper.
Diffstat (limited to 'src/video_core/primitive_assembly.cpp')
| -rw-r--r-- | src/video_core/primitive_assembly.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index 2354ffb99..dabf2d1a3 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp | |||
| @@ -2,21 +2,23 @@ | |||
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "clipper.h" | ||
| 6 | #include "pica.h" | 5 | #include "pica.h" |
| 7 | #include "primitive_assembly.h" | 6 | #include "primitive_assembly.h" |
| 8 | #include "vertex_shader.h" | 7 | #include "vertex_shader.h" |
| 9 | 8 | ||
| 10 | namespace Pica { | 9 | #include "video_core/debug_utils/debug_utils.h" |
| 11 | 10 | ||
| 12 | namespace PrimitiveAssembly { | 11 | namespace Pica { |
| 13 | 12 | ||
| 14 | static OutputVertex buffer[2]; | 13 | template<typename VertexType> |
| 15 | static int buffer_index = 0; // TODO: reset this on emulation restart | 14 | PrimitiveAssembler<VertexType>::PrimitiveAssembler(Regs::TriangleTopology topology) |
| 15 | : topology(topology), buffer_index(0) { | ||
| 16 | } | ||
| 16 | 17 | ||
| 17 | void SubmitVertex(OutputVertex& vtx) | 18 | template<typename VertexType> |
| 19 | void PrimitiveAssembler<VertexType>::SubmitVertex(VertexType& vtx, TriangleHandler triangle_handler) | ||
| 18 | { | 20 | { |
| 19 | switch (registers.triangle_topology) { | 21 | switch (topology) { |
| 20 | case Regs::TriangleTopology::List: | 22 | case Regs::TriangleTopology::List: |
| 21 | case Regs::TriangleTopology::ListIndexed: | 23 | case Regs::TriangleTopology::ListIndexed: |
| 22 | if (buffer_index < 2) { | 24 | if (buffer_index < 2) { |
| @@ -24,7 +26,7 @@ void SubmitVertex(OutputVertex& vtx) | |||
| 24 | } else { | 26 | } else { |
| 25 | buffer_index = 0; | 27 | buffer_index = 0; |
| 26 | 28 | ||
| 27 | Clipper::ProcessTriangle(buffer[0], buffer[1], vtx); | 29 | triangle_handler(buffer[0], buffer[1], vtx); |
| 28 | } | 30 | } |
| 29 | break; | 31 | break; |
| 30 | 32 | ||
| @@ -32,7 +34,7 @@ void SubmitVertex(OutputVertex& vtx) | |||
| 32 | if (buffer_index == 2) { | 34 | if (buffer_index == 2) { |
| 33 | buffer_index = 0; | 35 | buffer_index = 0; |
| 34 | 36 | ||
| 35 | Clipper::ProcessTriangle(buffer[0], buffer[1], vtx); | 37 | triangle_handler(buffer[0], buffer[1], vtx); |
| 36 | 38 | ||
| 37 | buffer[1] = vtx; | 39 | buffer[1] = vtx; |
| 38 | } else { | 40 | } else { |
| @@ -41,11 +43,15 @@ void SubmitVertex(OutputVertex& vtx) | |||
| 41 | break; | 43 | break; |
| 42 | 44 | ||
| 43 | default: | 45 | default: |
| 44 | ERROR_LOG(GPU, "Unknown triangle mode %x:", (int)registers.triangle_topology.Value()); | 46 | ERROR_LOG(GPU, "Unknown triangle topology %x:", (int)topology); |
| 45 | break; | 47 | break; |
| 46 | } | 48 | } |
| 47 | } | 49 | } |
| 48 | 50 | ||
| 49 | } // namespace | 51 | // explicitly instantiate use cases |
| 52 | template | ||
| 53 | struct PrimitiveAssembler<VertexShader::OutputVertex>; | ||
| 54 | template | ||
| 55 | struct PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex>; | ||
| 50 | 56 | ||
| 51 | } // namespace | 57 | } // namespace |