summaryrefslogtreecommitdiffstats
path: root/src/video_core/primitive_assembly.cpp
diff options
context:
space:
mode:
authorTony Wasserka <NeoBrainX@gmail.com>2014-07-27 14:58:30 +0200
committerTony Wasserka <NeoBrainX@gmail.com>2014-08-12 13:48:56 +0200
commit9a76a2d0611fc0c35b665fb886d437e8f4d5b4df (patch)
tree3dc2277e820070ef0d13769c10892f1fd2460d13 /src/video_core/primitive_assembly.cpp
parentPica: Add vertex shader implementation. (diff)
downloadyuzu-9a76a2d0611fc0c35b665fb886d437e8f4d5b4df.tar
yuzu-9a76a2d0611fc0c35b665fb886d437e8f4d5b4df.tar.gz
yuzu-9a76a2d0611fc0c35b665fb886d437e8f4d5b4df.tar.bz2
yuzu-9a76a2d0611fc0c35b665fb886d437e8f4d5b4df.tar.lz
yuzu-9a76a2d0611fc0c35b665fb886d437e8f4d5b4df.tar.xz
yuzu-9a76a2d0611fc0c35b665fb886d437e8f4d5b4df.tar.zst
yuzu-9a76a2d0611fc0c35b665fb886d437e8f4d5b4df.zip
Diffstat (limited to 'src/video_core/primitive_assembly.cpp')
-rw-r--r--src/video_core/primitive_assembly.cpp52
1 files changed, 52 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..b2196d13c
--- /dev/null
+++ b/src/video_core/primitive_assembly.cpp
@@ -0,0 +1,52 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include "pica.h"
+#include "primitive_assembly.h"
+#include "vertex_shader.h"
+
+namespace Pica {
+
+namespace PrimitiveAssembly {
+
+static OutputVertex buffer[2];
+static int buffer_index = 0; // TODO: reset this on emulation restart
+
+void SubmitVertex(OutputVertex& vtx)
+{
+ switch (registers.triangle_topology) {
+ case Regs::TriangleTopology::List:
+ case Regs::TriangleTopology::ListIndexed:
+ if (buffer_index < 2) {
+ buffer[buffer_index++] = vtx;
+ } else {
+ buffer_index = 0;
+
+ // TODO
+ // Clipper::ProcessTriangle(buffer[0], buffer[1], vtx);
+ }
+ break;
+
+ case Regs::TriangleTopology::Fan:
+ if (buffer_index == 2) {
+ buffer_index = 0;
+
+ // TODO
+ // Clipper::ProcessTriangle(buffer[0], buffer[1], vtx);
+
+ buffer[1] = vtx;
+ } else {
+ buffer[buffer_index++] = vtx;
+ }
+ break;
+
+ default:
+ ERROR_LOG(GPU, "Unknown triangle mode %x:", (int)registers.triangle_topology.Value());
+ break;
+ }
+}
+
+} // namespace
+
+} // namespace