SoftGPU: Keep rectangles as triangles where sprite coverage differs

Strips, fans and triangle pairs that form rectangles are drawn as sprites,
but a sprite's first column is (x + 6) >> 4 and a triangle's (x + 7) >> 4.
For a left edge 9/16 into a pixel, draw them as triangles (NBA 2K13's menu
boxes, now 99.99% exact against the PSP).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-02 15:09:42 -06:00
1 parent bc8a1370e3
commit 497f5628fd
3 files changed
+11 -3

No files matched your search

+3 -3
View File
@@ -1025,7 +1025,7 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
continue;
int tl = -1, br = -1;
if (Rasterizer::DetectRectangleFromPair(binner_->State(), buf, &tl, &br)) {
if (Rasterizer::DetectRectangleFromPair(binner_->State(), buf, &tl, &br) && Rasterizer::RectangleCoverageMatchesTriangles(buf[tl].v, buf[br].v)) {
Clipper::ProcessRect(buf[tl], buf[br], *binner_);
} else {
SendTriangle(cullType, &buf[0]);
@@ -1159,7 +1159,7 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
// If a strip is effectively a rectangle, draw it as such!
int tl = -1, br = -1;
if (Rasterizer::DetectRectangleFromStrip(binner_->State(), data_, &tl, &br)) {
if (Rasterizer::DetectRectangleFromStrip(binner_->State(), data_, &tl, &br) && Rasterizer::RectangleCoverageMatchesTriangles(data_[tl].v, data_[br].v)) {
Clipper::ProcessRect(data_[tl], data_[br], *binner_);
start_vtx += 2;
skip_count = 2;
@@ -1228,7 +1228,7 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
}
int tl = -1, br = -1;
if (Rasterizer::DetectRectangleFromFan(binner_->State(), data_, &tl, &br)) {
if (Rasterizer::DetectRectangleFromFan(binner_->State(), data_, &tl, &br) && Rasterizer::RectangleCoverageMatchesTriangles(data_[tl].v, data_[br].v)) {
Clipper::ProcessRect(data_[tl], data_[br], *binner_);
break;
}