diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-12-30 04:37:35 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-02-28 21:56:42 +0100 |
commit | 3c22bd92d878fcfe7b710e84b478b962fd325417 (patch) | |
tree | fb73c00d5e678b061e539606252d86abc91cb784 | |
parent | gl_state_tracker: Implement dirty flags for polygon offsets (diff) | |
download | yuzu-3c22bd92d878fcfe7b710e84b478b962fd325417.tar yuzu-3c22bd92d878fcfe7b710e84b478b962fd325417.tar.gz yuzu-3c22bd92d878fcfe7b710e84b478b962fd325417.tar.bz2 yuzu-3c22bd92d878fcfe7b710e84b478b962fd325417.tar.lz yuzu-3c22bd92d878fcfe7b710e84b478b962fd325417.tar.xz yuzu-3c22bd92d878fcfe7b710e84b478b962fd325417.tar.zst yuzu-3c22bd92d878fcfe7b710e84b478b962fd325417.zip |
4 files changed, 24 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 78838b8d1..5949f53ab 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -1267,13 +1267,23 @@ void RasterizerOpenGL::SyncPolygonOffset() { } void RasterizerOpenGL::SyncAlphaTest() { - const auto& regs = system.GPU().Maxwell3D().regs; - UNIMPLEMENTED_IF_MSG(regs.alpha_test_enabled != 0 && regs.rt_control.count > 1, - "Alpha Testing is enabled with more than one rendertarget"); + auto& gpu = system.GPU().Maxwell3D(); + auto& flags = gpu.dirty.flags; + if (!flags[Dirty::AlphaTest]) { + return; + } + flags[Dirty::AlphaTest] = false; + + const auto& regs = gpu.regs; + if (regs.alpha_test_enabled && regs.rt_control.count > 1) { + LOG_WARNING(Render_OpenGL, "Alpha testing with more than one render target is not tested"); + } - oglEnable(GL_ALPHA_TEST, regs.alpha_test_enabled); if (regs.alpha_test_enabled) { + glEnable(GL_ALPHA_TEST); glAlphaFunc(MaxwellToGL::ComparisonOp(regs.alpha_test_func), regs.alpha_test_ref); + } else { + glDisable(GL_ALPHA_TEST); } } diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp index 7cb874ac9..314d6f14d 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.cpp +++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp @@ -149,6 +149,13 @@ void SetupDirtyStencilTest(Tables& tables) { } } +void SetupDirtyAlphaTest(Tables& tables) { + auto& table = tables[0]; + table[OFF(alpha_test_ref)] = AlphaTest; + table[OFF(alpha_test_func)] = AlphaTest; + table[OFF(alpha_test_enabled)] = AlphaTest; +} + void SetupDirtyBlend(Tables& tables) { FillBlock(tables[0], OFF(blend_color), NUM(blend_color), BlendColor); @@ -205,6 +212,7 @@ void StateTracker::Initialize() { SetupDirtyShaders(tables); SetupDirtyDepthTest(tables); SetupDirtyStencilTest(tables); + SetupDirtyAlphaTest(tables); SetupDirtyBlend(tables); SetupDirtyPrimitiveRestart(tables); SetupDirtyPolygonOffset(tables); diff --git a/src/video_core/renderer_opengl/gl_state_tracker.h b/src/video_core/renderer_opengl/gl_state_tracker.h index 20c63595c..bef4e6ce6 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.h +++ b/src/video_core/renderer_opengl/gl_state_tracker.h @@ -62,6 +62,7 @@ enum : u8 { DepthMask, DepthTest, StencilTest, + AlphaTest, PrimitiveRestart, PolygonOffset, diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 630406044..1be7e491a 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -195,7 +195,7 @@ layout (location = 0) out vec4 color; layout (binding = 0) uniform sampler2D color_texture; void main() { - color = texture(color_texture, frag_tex_coord); + color = vec4(texture(color_texture, frag_tex_coord).rgb, 1.0f); } )"; @@ -600,7 +600,6 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { glDisable(GL_FRAMEBUFFER_SRGB); } glDisable(GL_COLOR_LOGIC_OP); - glDisable(GL_ALPHA_TEST); glDisable(GL_DEPTH_TEST); glDisable(GL_STENCIL_TEST); glDisable(GL_POLYGON_OFFSET_FILL); |