summaryrefslogtreecommitdiff
path: root/src/video_core/primitive_assembly.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/primitive_assembly.h')
-rw-r--r--src/video_core/primitive_assembly.h38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/video_core/primitive_assembly.h b/src/video_core/primitive_assembly.h
index 2a2b0c170..ea2e2f61e 100644
--- a/src/video_core/primitive_assembly.h
+++ b/src/video_core/primitive_assembly.h
@@ -4,18 +4,40 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Pica { 7#include <functional>
8 8
9namespace VertexShader { 9#include "video_core/pica.h"
10 struct OutputVertex;
11}
12 10
13namespace PrimitiveAssembly { 11#include "video_core/vertex_shader.h"
14 12
15using VertexShader::OutputVertex; 13namespace Pica {
16 14
17void SubmitVertex(OutputVertex& vtx); 15/*
16 * Utility class to build triangles from a series of vertices,
17 * according to a given triangle topology.
18 */
19template<typename VertexType>
20struct PrimitiveAssembler {
21 using TriangleHandler = std::function<void(VertexType& v0,
22 VertexType& v1,
23 VertexType& v2)>;
24
25 PrimitiveAssembler(Regs::TriangleTopology topology);
26
27 /*
28 * Queues a vertex, builds primitives from the vertex queue according to the given
29 * triangle topology, and calls triangle_handler for each generated primitive.
30 * NOTE: We could specify the triangle handler in the constructor, but this way we can
31 * keep event and handler code next to each other.
32 */
33 void SubmitVertex(VertexType& vtx, TriangleHandler triangle_handler);
34
35private:
36 Regs::TriangleTopology topology;
37
38 int buffer_index;
39 VertexType buffer[2];
40};
18 41
19} // namespace
20 42
21} // namespace 43} // namespace