mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
VideoCommon: Fix scissorOffset, handle negative value correctly
VideoCommon: Change the type of BPMemory.scissorOffset to 10bit signed: S32X10Y10 VideoBackends: Fix Software Clipper.PerspectiveDivide function, use BPMemory.scissorOffset instead of hard code 342
This commit is contained in:
@ -513,8 +513,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
|
||||
|
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user