diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2016-01-25 07:59:16 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2016-06-28 06:14:39 +0200 |
commit | f0b9bc14b64765bd8bc78cb4cfb4a30eb9ab9324 (patch) | |
tree | 5980ec623e974d6c9b71291d417365cfbe4ae4fc /src/video_core/renderer_opengl/gl_shader_gen.cpp | |
parent | PICA: Implement scissor test (diff) | |
download | yuzu-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 '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 10bb44210..b2e452afe 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -557,10 +557,10 @@ layout (std140) uniform shader_data { int alphatest_ref; float depth_scale; float depth_offset; - int scissor_right; - int scissor_bottom; - int scissor_left; - int scissor_top; + int scissor_x1; + int scissor_y1; + int scissor_x2; + int scissor_y2; vec3 fog_color; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; @@ -589,13 +589,14 @@ vec4 secondary_fragment_color = vec4(0.0); } // Append the scissor test - if (state.scissor_test_mode == Regs::ScissorMode::Include || state.scissor_test_mode == Regs::ScissorMode::Exclude) { - out += "if (scissor_left <= scissor_right || scissor_top <= scissor_bottom) discard;\n"; + if (state.scissor_test_mode != Regs::ScissorMode::Disabled) { out += "if ("; // Negate the condition if we have to keep only the pixels outside the scissor box if (state.scissor_test_mode == Regs::ScissorMode::Include) out += "!"; - out += "(gl_FragCoord.x >= scissor_right && gl_FragCoord.x <= scissor_left && gl_FragCoord.y >= scissor_bottom && gl_FragCoord.y <= scissor_top)) discard;\n"; + // x2,y2 have +1 added to cover the entire pixel area + out += "(gl_FragCoord.x >= scissor_x1 && gl_FragCoord.x < scissor_x2 + 1 && " + "gl_FragCoord.y >= scissor_y1 && gl_FragCoord.y < scissor_y2 + 1)) discard;\n"; } out += "float z_over_w = 1.0 - gl_FragCoord.z * 2.0;\n"; |