softgpu: Correct cull handling for sprites.

This commit is contained in:
Unknown W. Brackets 2020-09-08 16:16:41 -07:00
parent c1ce8383ae
commit 5fae2171cc
2 changed files with 4 additions and 2 deletions

View File

@ -206,7 +206,7 @@ void ProcessRect(const VertexData& v0, const VertexData& v1)
VertexData* bottomleft = &buf[2];
VertexData* bottomright = &buf[3];
// Um. Why is this stuff needed?
// DrawTriangle always culls, so sort out the drawing order.
for (int i = 0; i < 4; ++i) {
if (buf[i].screenpos.x < topleft->screenpos.x && buf[i].screenpos.y < topleft->screenpos.y)
topleft = &buf[i];

View File

@ -237,8 +237,10 @@ bool RectangleFastPath(const VertexData &v0, const VertexData &v1) {
bool coord_check =
(xdiff == udiff || xdiff == -udiff) &&
(ydiff == vdiff || ydiff == -vdiff);
// Currently only works for TL/BR, which is the most common but not required.
bool orient_check = xdiff >= 0 && ydiff >= 0;
bool state_check = !gstate.isModeClear(); // TODO: Add support for clear modes in Rasterizer::DrawSprite.
if ((coord_check || !gstate.isTextureMapEnabled()) && state_check) {
if ((coord_check || !gstate.isTextureMapEnabled()) && orient_check && state_check) {
Rasterizer::DrawSprite(v0, v1);
return true;
}