summaryrefslogtreecommitdiff
path: root/src/video_core/debug_utils
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2014-08-17 17:44:55 +0200
committerGravatar Tony Wasserka2014-08-25 22:03:19 +0200
commit2f1c129f6407fe2d5c8c3e57c6717d5668570de5 (patch)
tree5d12dadd9ffe3b46b9b94a84b7688d6d3b8260fd /src/video_core/debug_utils
parentPica/Rasterizer: Add texturing support. (diff)
downloadyuzu-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/debug_utils')
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp22
-rw-r--r--src/video_core/debug_utils/debug_utils.h12
2 files changed, 11 insertions, 23 deletions
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index f7d9455be..48e6dd182 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -22,27 +22,17 @@ namespace Pica {
22 22
23namespace DebugUtils { 23namespace DebugUtils {
24 24
25void GeometryDumper::AddVertex(std::array<float,3> pos, TriangleTopology topology) { 25void GeometryDumper::AddTriangle(Vertex& v0, Vertex& v1, Vertex& v2) {
26 vertices.push_back({pos[0], pos[1], pos[2]}); 26 vertices.push_back(v0);
27 vertices.push_back(v1);
28 vertices.push_back(v2);
27 29
28 int num_vertices = vertices.size(); 30 int num_vertices = vertices.size();
29 31 faces.push_back({ num_vertices-3, num_vertices-2, num_vertices-1 });
30 switch (topology) {
31 case TriangleTopology::List:
32 case TriangleTopology::ListIndexed:
33 if (0 == (num_vertices % 3))
34 faces.push_back({ num_vertices-3, num_vertices-2, num_vertices-1 });
35 break;
36
37 default:
38 ERROR_LOG(GPU, "Unknown triangle topology %x", (int)topology);
39 exit(0);
40 break;
41 }
42} 32}
43 33
44void GeometryDumper::Dump() { 34void GeometryDumper::Dump() {
45 // NOTE: Permanently enabling this just trashes hard disks for no reason. 35 // NOTE: Permanently enabling this just trashes the hard disk for no reason.
46 // Hence, this is currently disabled. 36 // Hence, this is currently disabled.
47 return; 37 return;
48 38
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h
index 53c33c96e..8b1499bf2 100644
--- a/src/video_core/debug_utils/debug_utils.h
+++ b/src/video_core/debug_utils/debug_utils.h
@@ -14,20 +14,18 @@ namespace Pica {
14 14
15namespace DebugUtils { 15namespace DebugUtils {
16 16
17using TriangleTopology = Regs::TriangleTopology;
18
19// Simple utility class for dumping geometry data to an OBJ file 17// Simple utility class for dumping geometry data to an OBJ file
20class GeometryDumper { 18class GeometryDumper {
21public: 19public:
22 void AddVertex(std::array<float,3> pos, TriangleTopology topology);
23
24 void Dump();
25
26private:
27 struct Vertex { 20 struct Vertex {
28 std::array<float,3> pos; 21 std::array<float,3> pos;
29 }; 22 };
30 23
24 void AddTriangle(Vertex& v0, Vertex& v1, Vertex& v2);
25
26 void Dump();
27
28private:
31 struct Face { 29 struct Face {
32 int index[3]; 30 int index[3];
33 }; 31 };