summaryrefslogtreecommitdiff
path: root/src/video_core/rasterizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/rasterizer.cpp')
-rw-r--r--src/video_core/rasterizer.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index 514d64208..6f369a00e 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -344,17 +344,18 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
344 u16 max_y = std::max({vtxpos[0].y, vtxpos[1].y, vtxpos[2].y}); 344 u16 max_y = std::max({vtxpos[0].y, vtxpos[1].y, vtxpos[2].y});
345 345
346 // Convert the scissor box coordinates to 12.4 fixed point 346 // Convert the scissor box coordinates to 12.4 fixed point
347 u16 scissor_left = (u16)(regs.scissor_test.GetLeft() << 4); 347 u16 scissor_x1 = (u16)( regs.scissor_test.x1 << 4);
348 u16 scissor_top = (u16)(regs.scissor_test.GetTop() << 4); 348 u16 scissor_y1 = (u16)( regs.scissor_test.y1 << 4);
349 u16 scissor_right = (u16)(regs.scissor_test.right << 4); 349 // x2,y2 have +1 added to cover the entire sub-pixel area
350 u16 scissor_bottom = (u16)(regs.scissor_test.bottom << 4); 350 u16 scissor_x2 = (u16)((regs.scissor_test.x2 + 1) << 4);
351 u16 scissor_y2 = (u16)((regs.scissor_test.y2 + 1) << 4);
351 352
352 if (regs.scissor_test.mode == Regs::ScissorMode::Include) { 353 if (regs.scissor_test.mode == Regs::ScissorMode::Include) {
353 // Calculate the new bounds 354 // Calculate the new bounds
354 min_x = std::max(min_x, scissor_right); 355 min_x = std::max(min_x, scissor_x1);
355 min_y = std::max(min_y, scissor_bottom); 356 min_y = std::max(min_y, scissor_y1);
356 max_x = std::min(max_x, scissor_left); 357 max_x = std::min(max_x, scissor_x2);
357 max_y = std::min(max_y, scissor_top); 358 max_y = std::min(max_y, scissor_y2);
358 } 359 }
359 360
360 min_x &= Fix12P4::IntMask(); 361 min_x &= Fix12P4::IntMask();
@@ -397,10 +398,10 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
397 for (u16 x = min_x + 8; x < max_x; x += 0x10) { 398 for (u16 x = min_x + 8; x < max_x; x += 0x10) {
398 399
399 // Do not process the pixel if it's inside the scissor box and the scissor mode is set to Exclude 400 // Do not process the pixel if it's inside the scissor box and the scissor mode is set to Exclude
400 if (regs.scissor_test.mode == Regs::ScissorMode::Exclude && 401 if (regs.scissor_test.mode == Regs::ScissorMode::Exclude) {
401 x >= scissor_right && x <= scissor_left && 402 if (x >= scissor_x1 && x < scissor_x2 &&
402 y >= scissor_bottom && y <= scissor_top) { 403 y >= scissor_y1 && y < scissor_y2)
403 continue; 404 continue;
404 } 405 }
405 406
406 // Calculate the barycentric coordinates w0, w1 and w2 407 // Calculate the barycentric coordinates w0, w1 and w2