1
0
Fork 0

primitive_assembly: Take triangle_handler by reference

Avoids copying the std::function when we don't need to. Particularly
given the std::function isn't actually stored anywhere, so there's no
need to move it.
This commit is contained in:
Lioncash 2020-04-18 20:40:43 -04:00
parent e38e79e27e
commit 59bb84b86c
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ PrimitiveAssembler<VertexType>::PrimitiveAssembler(PipelineRegs::TriangleTopolog
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

@ -29,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.