softgpu: Fast path rectangles as fans.

Some games, such as Legend of Heroes III, use fans instead of strips.
This commit is contained in:
Unknown W. Brackets committed 2021-11-14 18:31:45 -08:00
1 parent 09a9927b82
commit fb6fadbbb7
4 files changed
+61 -1

No files matched your search

+17 -1
View File
@@ -445,7 +445,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
// If index count == 4, check if we can convert to a rectangle.
// This is for Darkstalkers (and should speed up many 2D games).
if (vertex_count == 4 && gstate.isModeThrough()) {
if (data_index == 0 && vertex_count == 4 && gstate.isModeThrough()) {
for (int vtx = 0; vtx < 4; ++vtx) {
if (indices) {
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
@@ -517,6 +517,22 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
data_index++;
start_vtx = 1;
}
if (data_index == 1 && vertex_count == 4 && gstate.isModeThrough()) {
for (int vtx = start_vtx; vtx < vertex_count; ++vtx) {
if (indices) {
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
} else {
vreader.Goto(vtx);
}
data[vtx] = ReadVertex(vreader, outside_range_flag);
}
int tl = -1, br = -1;
if (Rasterizer::DetectRectangleFromThroughModeFan(data, vertex_count, &tl, &br)) {
Clipper::ProcessRect(data[tl], data[br]);
break;
}
}
outside_range_flag = false;
for (int vtx = start_vtx; vtx < vertex_count; ++vtx) {