summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2021-04-23 21:21:53 -0400
committerGitHub <noreply@github.com>2021-04-23 21:21:53 -0400
commit18e84361d925af09586b940b265f10e501e889d6 (patch)
treedfaeb6832c9fcb9e1f6ce01305863198a760754e /Source/Core/VideoBackends/Software
parentbe5775614c9486540523c1b64cdba4d1d6202c31 (diff)
parent97ea3a603ef4df32945dfd33300cedcb04ffa67a (diff)
Merge pull request #9660 from ezio1900/master
VideoCommon: Fix scissorOffset, handle negative value correctly
Diffstat (limited to 'Source/Core/VideoBackends/Software')
-rw-r--r--Source/Core/VideoBackends/Software/Clipper.cpp6
-rw-r--r--Source/Core/VideoBackends/Software/Rasterizer.cpp12
2 files changed, 10 insertions, 8 deletions
diff --git a/Source/Core/VideoBackends/Software/Clipper.cpp b/Source/Core/VideoBackends/Software/Clipper.cpp
index 41a5e07d07..9c507de5ca 100644
--- a/Source/Core/VideoBackends/Software/Clipper.cpp
+++ b/Source/Core/VideoBackends/Software/Clipper.cpp
@@ -518,8 +518,10 @@ void PerspectiveDivide(OutputVertexData* vertex)
Vec3& screen = vertex->screenPosition;
float wInverse = 1.0f / projected.w;
- screen.x = projected.x * wInverse * xfmem.viewport.wd + xfmem.viewport.xOrig - 342;
- screen.y = projected.y * wInverse * xfmem.viewport.ht + xfmem.viewport.yOrig - 342;
+ screen.x =
+ projected.x * wInverse * xfmem.viewport.wd + xfmem.viewport.xOrig - bpmem.scissorOffset.x * 2;
+ screen.y =
+ projected.y * wInverse * xfmem.viewport.ht + xfmem.viewport.yOrig - bpmem.scissorOffset.y * 2;
screen.z = projected.z * wInverse * xfmem.viewport.zRange + xfmem.viewport.farZ;
}
} // namespace Clipper
diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp
index e987817c8c..cf5374342b 100644
--- a/Source/Core/VideoBackends/Software/Rasterizer.cpp
+++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp
@@ -306,22 +306,22 @@ void DrawTriangleFrontFace(const OutputVertexData* v0, const OutputVertexData* v
s32 maxy = (std::max(std::max(Y1, Y2), Y3) + 0xF) >> 4;
// scissor
- int xoff = bpmem.scissorOffset.x * 2 - 342;
- int yoff = bpmem.scissorOffset.y * 2 - 342;
+ s32 xoff = bpmem.scissorOffset.x * 2;
+ s32 yoff = bpmem.scissorOffset.y * 2;
- s32 scissorLeft = bpmem.scissorTL.x - xoff - 342;
+ s32 scissorLeft = bpmem.scissorTL.x - xoff;
if (scissorLeft < 0)
scissorLeft = 0;
- s32 scissorTop = bpmem.scissorTL.y - yoff - 342;
+ s32 scissorTop = bpmem.scissorTL.y - yoff;
if (scissorTop < 0)
scissorTop = 0;
- s32 scissorRight = bpmem.scissorBR.x - xoff - 341;
+ s32 scissorRight = bpmem.scissorBR.x - xoff + 1;
if (scissorRight > s32(EFB_WIDTH))
scissorRight = EFB_WIDTH;
- s32 scissorBottom = bpmem.scissorBR.y - yoff - 341;
+ s32 scissorBottom = bpmem.scissorBR.y - yoff + 1;
if (scissorBottom > s32(EFB_HEIGHT))
scissorBottom = EFB_HEIGHT;