diff options
Diffstat (limited to 'src')
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() { | |||
| 1267 | } | 1267 | } |
| 1268 | 1268 | ||
| 1269 | void RasterizerOpenGL::SyncAlphaTest() { | 1269 | void RasterizerOpenGL::SyncAlphaTest() { |
| 1270 | const auto& regs = system.GPU().Maxwell3D().regs; | 1270 | auto& gpu = system.GPU().Maxwell3D(); |
| 1271 | UNIMPLEMENTED_IF_MSG(regs.alpha_test_enabled != 0 && regs.rt_control.count > 1, | 1271 | auto& flags = gpu.dirty.flags; |
| 1272 | "Alpha Testing is enabled with more than one rendertarget"); | 1272 | if (!flags[Dirty::AlphaTest]) { |
| 1273 | return; | ||
| 1274 | } | ||
| 1275 | flags[Dirty::AlphaTest] = false; | ||
| 1276 | |||
| 1277 | const auto& regs = gpu.regs; | ||
| 1278 | if (regs.alpha_test_enabled && regs.rt_control.count > 1) { | ||
| 1279 | LOG_WARNING(Render_OpenGL, "Alpha testing with more than one render target is not tested"); | ||
| 1280 | } | ||
| 1273 | 1281 | ||
| 1274 | oglEnable(GL_ALPHA_TEST, regs.alpha_test_enabled); | ||
| 1275 | if (regs.alpha_test_enabled) { | 1282 | if (regs.alpha_test_enabled) { |
| 1283 | glEnable(GL_ALPHA_TEST); | ||
| 1276 | glAlphaFunc(MaxwellToGL::ComparisonOp(regs.alpha_test_func), regs.alpha_test_ref); | 1284 | glAlphaFunc(MaxwellToGL::ComparisonOp(regs.alpha_test_func), regs.alpha_test_ref); |
| 1285 | } else { | ||
| 1286 | glDisable(GL_ALPHA_TEST); | ||
| 1277 | } | 1287 | } |
| 1278 | } | 1288 | } |
| 1279 | 1289 | ||
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) { | |||
| 149 | } | 149 | } |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | void SetupDirtyAlphaTest(Tables& tables) { | ||
| 153 | auto& table = tables[0]; | ||
| 154 | table[OFF(alpha_test_ref)] = AlphaTest; | ||
| 155 | table[OFF(alpha_test_func)] = AlphaTest; | ||
| 156 | table[OFF(alpha_test_enabled)] = AlphaTest; | ||
| 157 | } | ||
| 158 | |||
| 152 | void SetupDirtyBlend(Tables& tables) { | 159 | void SetupDirtyBlend(Tables& tables) { |
| 153 | FillBlock(tables[0], OFF(blend_color), NUM(blend_color), BlendColor); | 160 | FillBlock(tables[0], OFF(blend_color), NUM(blend_color), BlendColor); |
| 154 | 161 | ||
| @@ -205,6 +212,7 @@ void StateTracker::Initialize() { | |||
| 205 | SetupDirtyShaders(tables); | 212 | SetupDirtyShaders(tables); |
| 206 | SetupDirtyDepthTest(tables); | 213 | SetupDirtyDepthTest(tables); |
| 207 | SetupDirtyStencilTest(tables); | 214 | SetupDirtyStencilTest(tables); |
| 215 | SetupDirtyAlphaTest(tables); | ||
| 208 | SetupDirtyBlend(tables); | 216 | SetupDirtyBlend(tables); |
| 209 | SetupDirtyPrimitiveRestart(tables); | 217 | SetupDirtyPrimitiveRestart(tables); |
| 210 | SetupDirtyPolygonOffset(tables); | 218 | 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 { | |||
| 62 | DepthMask, | 62 | DepthMask, |
| 63 | DepthTest, | 63 | DepthTest, |
| 64 | StencilTest, | 64 | StencilTest, |
| 65 | AlphaTest, | ||
| 65 | PrimitiveRestart, | 66 | PrimitiveRestart, |
| 66 | PolygonOffset, | 67 | PolygonOffset, |
| 67 | 68 | ||
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; | |||
| 195 | layout (binding = 0) uniform sampler2D color_texture; | 195 | layout (binding = 0) uniform sampler2D color_texture; |
| 196 | 196 | ||
| 197 | void main() { | 197 | void main() { |
| 198 | color = texture(color_texture, frag_tex_coord); | 198 | color = vec4(texture(color_texture, frag_tex_coord).rgb, 1.0f); |
| 199 | } | 199 | } |
| 200 | )"; | 200 | )"; |
| 201 | 201 | ||
| @@ -600,7 +600,6 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { | |||
| 600 | glDisable(GL_FRAMEBUFFER_SRGB); | 600 | glDisable(GL_FRAMEBUFFER_SRGB); |
| 601 | } | 601 | } |
| 602 | glDisable(GL_COLOR_LOGIC_OP); | 602 | glDisable(GL_COLOR_LOGIC_OP); |
| 603 | glDisable(GL_ALPHA_TEST); | ||
| 604 | glDisable(GL_DEPTH_TEST); | 603 | glDisable(GL_DEPTH_TEST); |
| 605 | glDisable(GL_STENCIL_TEST); | 604 | glDisable(GL_STENCIL_TEST); |
| 606 | glDisable(GL_POLYGON_OFFSET_FILL); | 605 | glDisable(GL_POLYGON_OFFSET_FILL); |