Pica: Consolidate the primitive assembly code in PrimitiveAssembly and GeometryDumper.
This commit is contained in:
parent
9679d231df
commit
2f1c129f64
5 changed files with 73 additions and 45 deletions
|
@ -4,18 +4,40 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "video_core/pica.h"
|
||||
|
||||
#include "video_core/vertex_shader.h"
|
||||
|
||||
namespace Pica {
|
||||
|
||||
namespace VertexShader {
|
||||
struct OutputVertex;
|
||||
}
|
||||
/*
|
||||
* Utility class to build triangles from a series of vertices,
|
||||
* according to a given triangle topology.
|
||||
*/
|
||||
template<typename VertexType>
|
||||
struct PrimitiveAssembler {
|
||||
using TriangleHandler = std::function<void(VertexType& v0,
|
||||
VertexType& v1,
|
||||
VertexType& v2)>;
|
||||
|
||||
namespace PrimitiveAssembly {
|
||||
PrimitiveAssembler(Regs::TriangleTopology topology);
|
||||
|
||||
using VertexShader::OutputVertex;
|
||||
/*
|
||||
* Queues a vertex, builds primitives from the vertex queue according to the given
|
||||
* triangle topology, and calls triangle_handler for each generated primitive.
|
||||
* NOTE: We could specify the triangle handler in the constructor, but this way we can
|
||||
* keep event and handler code next to each other.
|
||||
*/
|
||||
void SubmitVertex(VertexType& vtx, TriangleHandler triangle_handler);
|
||||
|
||||
private:
|
||||
Regs::TriangleTopology topology;
|
||||
|
||||
int buffer_index;
|
||||
VertexType buffer[2];
|
||||
};
|
||||
|
||||
void SubmitVertex(OutputVertex& vtx);
|
||||
|
||||
} // namespace
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue