diff options
| author | bunnei <bunneidev@gmail.com> | 2014-08-25 16:12:10 -0400 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2014-08-25 16:12:10 -0400 |
| commit | 97fd8fc38d4f9c288779cddb06538860124c6263 (patch) | |
| tree | bc99e0fceaae732f9c8d4831fcdb8f661b49ccb8 /src/video_core/primitive_assembly.cpp | |
| parent | 613b0a8df85578c97790c5b116195e8bd2fad6f4 (diff) | |
| parent | a79644c9baaeaa88e79db9837e9ed6e2b74e9889 (diff) | |
Merge pull request #50 from neobrain/pica
Further work on Pica emulation
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 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#include "clipper.h" #include "pica.h" #include "primitive_assembly.h" #include "vertex_shader.h" -namespace Pica { +#include "video_core/debug_utils/debug_utils.h" -namespace PrimitiveAssembly { +namespace Pica { -static OutputVertex buffer[2]; -static int buffer_index = 0; // TODO: reset this on emulation restart +template<typename VertexType> +PrimitiveAssembler<VertexType>::PrimitiveAssembler(Regs::TriangleTopology topology) + : topology(topology), buffer_index(0) { +} -void SubmitVertex(OutputVertex& vtx) +template<typename VertexType> +void PrimitiveAssembler<VertexType>::SubmitVertex(VertexType& vtx, TriangleHandler triangle_handler) { - switch (registers.triangle_topology) { + switch (topology) { case Regs::TriangleTopology::List: case Regs::TriangleTopology::ListIndexed: if (buffer_index < 2) { @@ -24,7 +26,7 @@ void SubmitVertex(OutputVertex& vtx) } else { buffer_index = 0; - Clipper::ProcessTriangle(buffer[0], buffer[1], vtx); + triangle_handler(buffer[0], buffer[1], vtx); } break; @@ -32,7 +34,7 @@ void SubmitVertex(OutputVertex& vtx) if (buffer_index == 2) { buffer_index = 0; - Clipper::ProcessTriangle(buffer[0], buffer[1], vtx); + triangle_handler(buffer[0], buffer[1], vtx); buffer[1] = vtx; } else { @@ -41,11 +43,15 @@ void SubmitVertex(OutputVertex& vtx) break; default: - ERROR_LOG(GPU, "Unknown triangle mode %x:", (int)registers.triangle_topology.Value()); + ERROR_LOG(GPU, "Unknown triangle topology %x:", (int)topology); break; } } -} // namespace +// explicitly instantiate use cases +template +struct PrimitiveAssembler<VertexShader::OutputVertex>; +template +struct PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex>; } // namespace |
