mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-24 15:43:08 +00:00
Pica/PrimitiveAssembly: Implement triangle strips.
This commit is contained in:
parent
346012f29e
commit
cd322e328e
|
@ -30,20 +30,27 @@ void PrimitiveAssembler<VertexType>::SubmitVertex(VertexType& vtx, TriangleHandl
|
|||
}
|
||||
break;
|
||||
|
||||
case Regs::TriangleTopology::Strip:
|
||||
case Regs::TriangleTopology::Fan:
|
||||
if (buffer_index == 2) {
|
||||
buffer_index = 0;
|
||||
if (strip_ready) {
|
||||
// TODO: Should be "buffer[0], buffer[1], vtx" instead!
|
||||
// Not quite sure why we need this order for things to show up properly.
|
||||
// Maybe a bug in the rasterizer?
|
||||
triangle_handler(buffer[1], buffer[0], vtx);
|
||||
}
|
||||
buffer[buffer_index] = vtx;
|
||||
|
||||
triangle_handler(buffer[0], buffer[1], vtx);
|
||||
|
||||
buffer[1] = vtx;
|
||||
} else {
|
||||
buffer[buffer_index++] = vtx;
|
||||
if (topology == Regs::TriangleTopology::Strip) {
|
||||
strip_ready |= (buffer_index == 1);
|
||||
buffer_index = !buffer_index;
|
||||
} else if (topology == Regs::TriangleTopology::Fan) {
|
||||
buffer_index = 1;
|
||||
strip_ready = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(Render_Software, "Unknown triangle topology %x:", (int)topology);
|
||||
LOG_ERROR(HW_GPU, "Unknown triangle topology %x:", (int)topology);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ private:
|
|||
|
||||
int buffer_index;
|
||||
VertexType buffer[2];
|
||||
bool strip_ready = false;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue