citra-emu
/
citra-canary
Archived
1
0
Fork 0

Merge pull request #5240 from lioncash/primitive

primitive_assembly: Minor changes
This commit is contained in:
Ben 2020-04-19 16:55:56 +02:00 committed by GitHub
commit 362956a69b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -11,11 +11,11 @@ namespace Pica {
template <typename VertexType> template <typename VertexType>
PrimitiveAssembler<VertexType>::PrimitiveAssembler(PipelineRegs::TriangleTopology topology) PrimitiveAssembler<VertexType>::PrimitiveAssembler(PipelineRegs::TriangleTopology topology)
: topology(topology), buffer_index(0) {} : topology(topology) {}
template <typename VertexType> template <typename VertexType>
void PrimitiveAssembler<VertexType>::SubmitVertex(const VertexType& vtx, void PrimitiveAssembler<VertexType>::SubmitVertex(const VertexType& vtx,
TriangleHandler triangle_handler) { const TriangleHandler& triangle_handler) {
switch (topology) { switch (topology) {
case PipelineRegs::TriangleTopology::List: case PipelineRegs::TriangleTopology::List:
case PipelineRegs::TriangleTopology::Shader: case PipelineRegs::TriangleTopology::Shader:

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <array>
#include <functional> #include <functional>
#include <boost/serialization/access.hpp> #include <boost/serialization/access.hpp>
#include "video_core/regs_pipeline.h" #include "video_core/regs_pipeline.h"
@ -19,7 +20,7 @@ struct PrimitiveAssembler {
using TriangleHandler = using TriangleHandler =
std::function<void(const VertexType& v0, const VertexType& v1, const VertexType& v2)>; std::function<void(const VertexType& v0, const VertexType& v1, const VertexType& v2)>;
PrimitiveAssembler( explicit PrimitiveAssembler(
PipelineRegs::TriangleTopology topology = PipelineRegs::TriangleTopology::List); PipelineRegs::TriangleTopology topology = PipelineRegs::TriangleTopology::List);
/* /*
@ -28,7 +29,7 @@ struct PrimitiveAssembler {
* NOTE: We could specify the triangle handler in the constructor, but this way we can * NOTE: We could specify the triangle handler in the constructor, but this way we can
* keep event and handler code next to each other. * keep event and handler code next to each other.
*/ */
void SubmitVertex(const VertexType& vtx, TriangleHandler triangle_handler); void SubmitVertex(const VertexType& vtx, const TriangleHandler& triangle_handler);
/** /**
* Invert the vertex order of the next triangle. Called by geometry shader emitter. * Invert the vertex order of the next triangle. Called by geometry shader emitter.
@ -59,8 +60,8 @@ struct PrimitiveAssembler {
private: private:
PipelineRegs::TriangleTopology topology; PipelineRegs::TriangleTopology topology;
int buffer_index; int buffer_index = 0;
VertexType buffer[2]; std::array<VertexType, 2> buffer;
bool strip_ready = false; bool strip_ready = false;
bool winding = false; bool winding = false;