diff options
| author | 2014-08-12 13:55:41 +0200 | |
|---|---|---|
| committer | 2014-08-12 13:55:41 +0200 | |
| commit | 36cabe35cc15a6590f5d18be695ae505a946cb06 (patch) | |
| tree | 241e6d8b36e6ab9921ef7afb71e7350e52862e2a /src/video_core/primitive_assembly.cpp | |
| parent | Merge pull request #38 from neobrain/replace_registerset (diff) | |
| parent | Pica: Add basic rasterizer. (diff) | |
| download | yuzu-36cabe35cc15a6590f5d18be695ae505a946cb06.tar.gz yuzu-36cabe35cc15a6590f5d18be695ae505a946cb06.tar.xz yuzu-36cabe35cc15a6590f5d18be695ae505a946cb06.zip | |
Merge pull request #37 from neobrain/pica
Initial work on Pica rendering.
Diffstat (limited to 'src/video_core/primitive_assembly.cpp')
| -rw-r--r-- | src/video_core/primitive_assembly.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp new file mode 100644 index 000000000..2354ffb99 --- /dev/null +++ b/src/video_core/primitive_assembly.cpp | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "clipper.h" | ||
| 6 | #include "pica.h" | ||
| 7 | #include "primitive_assembly.h" | ||
| 8 | #include "vertex_shader.h" | ||
| 9 | |||
| 10 | namespace Pica { | ||
| 11 | |||
| 12 | namespace PrimitiveAssembly { | ||
| 13 | |||
| 14 | static OutputVertex buffer[2]; | ||
| 15 | static int buffer_index = 0; // TODO: reset this on emulation restart | ||
| 16 | |||
| 17 | void SubmitVertex(OutputVertex& vtx) | ||
| 18 | { | ||
| 19 | switch (registers.triangle_topology) { | ||
| 20 | case Regs::TriangleTopology::List: | ||
| 21 | case Regs::TriangleTopology::ListIndexed: | ||
| 22 | if (buffer_index < 2) { | ||
| 23 | buffer[buffer_index++] = vtx; | ||
| 24 | } else { | ||
| 25 | buffer_index = 0; | ||
| 26 | |||
| 27 | Clipper::ProcessTriangle(buffer[0], buffer[1], vtx); | ||
| 28 | } | ||
| 29 | break; | ||
| 30 | |||
| 31 | case Regs::TriangleTopology::Fan: | ||
| 32 | if (buffer_index == 2) { | ||
| 33 | buffer_index = 0; | ||
| 34 | |||
| 35 | Clipper::ProcessTriangle(buffer[0], buffer[1], vtx); | ||
| 36 | |||
| 37 | buffer[1] = vtx; | ||
| 38 | } else { | ||
| 39 | buffer[buffer_index++] = vtx; | ||
| 40 | } | ||
| 41 | break; | ||
| 42 | |||
| 43 | default: | ||
| 44 | ERROR_LOG(GPU, "Unknown triangle mode %x:", (int)registers.triangle_topology.Value()); | ||
| 45 | break; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | } // namespace | ||
| 50 | |||
| 51 | } // namespace | ||