Skip to content

Commit

Permalink
Make clear detection a bit more lenient. Allows using clears in Assas…
Browse files Browse the repository at this point in the history
…sin's Creed and likely more.
  • Loading branch information
hrydgard committed Sep 18, 2023
1 parent 3c4872b commit e6a864e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions GPU/Common/SoftwareTransformCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,22 @@ static void RotateUVThrough(TransformedVertex v[4]) {
// Clears on the PSP are best done by drawing a series of vertical strips
// in clear mode. This tries to detect that.
static bool IsReallyAClear(const TransformedVertex *transformed, int numVerts, float x2, float y2) {
if (transformed[0].x != 0.0f || transformed[0].y != 0.0f)
if (transformed[0].x < 0.0f || transformed[0].y < 0.0f || transformed[0].x > 0.5f || transformed[0].y > 0.5f)
return false;

const float originY = transformed[0].y;

// Color and Z are decided by the second vertex, so only need to check those for matching color.
u32 matchcolor = transformed[1].color0_32;
float matchz = transformed[1].z;
const u32 matchcolor = transformed[1].color0_32;
const float matchz = transformed[1].z;

for (int i = 1; i < numVerts; i++) {
if ((i & 1) == 0) {
// Top left of a rectangle
if (transformed[i].y != 0.0f)
if (transformed[i].y != originY)
return false;
if (i > 0 && transformed[i].x != transformed[i - 1].x)
float gap = fabsf(transformed[i].x - transformed[i - 1].x); // Should probably do some smarter check.
if (i > 0 && gap > 0.0625)
return false;
} else {
if (transformed[i].color0_32 != matchcolor || transformed[i].z != matchz)
Expand Down

0 comments on commit e6a864e

Please sign in to comment.