summaryrefslogtreecommitdiffstats
path: root/src/video_core/rasterizer.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2016-01-25 07:59:16 +0100
committerYuri Kunde Schlesner <yuriks@yuriks.net>2016-06-28 06:14:39 +0200
commitf0b9bc14b64765bd8bc78cb4cfb4a30eb9ab9324 (patch)
tree5980ec623e974d6c9b71291d417365cfbe4ae4fc /src/video_core/rasterizer.cpp
parentPICA: Implement scissor test (diff)
downloadyuzu-f0b9bc14b64765bd8bc78cb4cfb4a30eb9ab9324.tar
yuzu-f0b9bc14b64765bd8bc78cb4cfb4a30eb9ab9324.tar.gz
yuzu-f0b9bc14b64765bd8bc78cb4cfb4a30eb9ab9324.tar.bz2
yuzu-f0b9bc14b64765bd8bc78cb4cfb4a30eb9ab9324.tar.lz
yuzu-f0b9bc14b64765bd8bc78cb4cfb4a30eb9ab9324.tar.xz
yuzu-f0b9bc14b64765bd8bc78cb4cfb4a30eb9ab9324.tar.zst
yuzu-f0b9bc14b64765bd8bc78cb4cfb4a30eb9ab9324.zip
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,
u16 max_y = std::max({vtxpos[0].y, vtxpos[1].y, vtxpos[2].y});
// Convert the scissor box coordinates to 12.4 fixed point
- u16 scissor_left = (u16)(regs.scissor_test.GetLeft() << 4);
- u16 scissor_top = (u16)(regs.scissor_test.GetTop() << 4);
- u16 scissor_right = (u16)(regs.scissor_test.right << 4);
- u16 scissor_bottom = (u16)(regs.scissor_test.bottom << 4);
+ u16 scissor_x1 = (u16)( regs.scissor_test.x1 << 4);
+ u16 scissor_y1 = (u16)( regs.scissor_test.y1 << 4);
+ // x2,y2 have +1 added to cover the entire sub-pixel area
+ u16 scissor_x2 = (u16)((regs.scissor_test.x2 + 1) << 4);
+ u16 scissor_y2 = (u16)((regs.scissor_test.y2 + 1) << 4);
if (regs.scissor_test.mode == Regs::ScissorMode::Include) {
// Calculate the new bounds
- min_x = std::max(min_x, scissor_right);
- min_y = std::max(min_y, scissor_bottom);
- max_x = std::min(max_x, scissor_left);
- max_y = std::min(max_y, scissor_top);
+ min_x = std::max(min_x, scissor_x1);
+ min_y = std::max(min_y, scissor_y1);
+ max_x = std::min(max_x, scissor_x2);
+ max_y = std::min(max_y, scissor_y2);
}
min_x &= Fix12P4::IntMask();
@@ -397,10 +398,10 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
for (u16 x = min_x + 8; x < max_x; x += 0x10) {
// Do not process the pixel if it's inside the scissor box and the scissor mode is set to Exclude
- if (regs.scissor_test.mode == Regs::ScissorMode::Exclude &&
- x >= scissor_right && x <= scissor_left &&
- y >= scissor_bottom && y <= scissor_top) {
- continue;
+ if (regs.scissor_test.mode == Regs::ScissorMode::Exclude) {
+ if (x >= scissor_x1 && x < scissor_x2 &&
+ y >= scissor_y1 && y < scissor_y2)
+ continue;
}
// Calculate the barycentric coordinates w0, w1 and w2