diff options
| author | 2015-05-28 21:41:37 -0400 | |
|---|---|---|
| committer | 2015-06-08 19:18:17 -0400 | |
| commit | d42275f11cc53000fead76b7c695fb370d19e56d (patch) | |
| tree | 351cd273da23c232bde19e49ca2f389dc1cb4dd0 /src | |
| parent | Merge pull request #848 from lioncash/ldm (diff) | |
| download | yuzu-d42275f11cc53000fead76b7c695fb370d19e56d.tar.gz yuzu-d42275f11cc53000fead76b7c695fb370d19e56d.tar.xz yuzu-d42275f11cc53000fead76b7c695fb370d19e56d.zip | |
Implemented glColorMask
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.h | 7 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index d31c46cca..2f55bfd76 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -652,6 +652,10 @@ void RasterizerOpenGL::SyncDepthTest() { | |||
| 652 | const auto& regs = Pica::g_state.regs; | 652 | const auto& regs = Pica::g_state.regs; |
| 653 | state.depth.test_enabled = (regs.output_merger.depth_test_enable == 1); | 653 | state.depth.test_enabled = (regs.output_merger.depth_test_enable == 1); |
| 654 | state.depth.test_func = PicaToGL::CompareFunc(regs.output_merger.depth_test_func); | 654 | state.depth.test_func = PicaToGL::CompareFunc(regs.output_merger.depth_test_func); |
| 655 | state.color_mask.red_enabled = regs.output_merger.red_enable; | ||
| 656 | state.color_mask.green_enabled = regs.output_merger.green_enable; | ||
| 657 | state.color_mask.blue_enabled = regs.output_merger.blue_enable; | ||
| 658 | state.color_mask.alpha_enabled = regs.output_merger.alpha_enable; | ||
| 655 | state.depth.write_mask = regs.output_merger.depth_write_enable ? GL_TRUE : GL_FALSE; | 659 | state.depth.write_mask = regs.output_merger.depth_write_enable ? GL_TRUE : GL_FALSE; |
| 656 | } | 660 | } |
| 657 | 661 | ||
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 9c5f38f94..2305fb2cb 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp | |||
| @@ -16,6 +16,11 @@ OpenGLState::OpenGLState() { | |||
| 16 | depth.test_func = GL_LESS; | 16 | depth.test_func = GL_LESS; |
| 17 | depth.write_mask = GL_TRUE; | 17 | depth.write_mask = GL_TRUE; |
| 18 | 18 | ||
| 19 | color_mask.red_enabled = GL_TRUE; | ||
| 20 | color_mask.green_enabled = GL_TRUE; | ||
| 21 | color_mask.blue_enabled = GL_TRUE; | ||
| 22 | color_mask.alpha_enabled = GL_TRUE; | ||
| 23 | |||
| 19 | stencil.test_enabled = false; | 24 | stencil.test_enabled = false; |
| 20 | stencil.test_func = GL_ALWAYS; | 25 | stencil.test_func = GL_ALWAYS; |
| 21 | stencil.test_ref = 0; | 26 | stencil.test_ref = 0; |
| @@ -77,6 +82,14 @@ void OpenGLState::Apply() { | |||
| 77 | glDepthMask(depth.write_mask); | 82 | glDepthMask(depth.write_mask); |
| 78 | } | 83 | } |
| 79 | 84 | ||
| 85 | // Color mask | ||
| 86 | if (color_mask.red_enabled != cur_state.color_mask.red_enabled || | ||
| 87 | color_mask.green_enabled != cur_state.color_mask.green_enabled || | ||
| 88 | color_mask.blue_enabled != cur_state.color_mask.blue_enabled || | ||
| 89 | color_mask.alpha_enabled != cur_state.color_mask.alpha_enabled) { | ||
| 90 | glColorMask(color_mask.red_enabled, color_mask.green_enabled, color_mask.blue_enabled, color_mask.alpha_enabled); | ||
| 91 | } | ||
| 92 | |||
| 80 | // Stencil test | 93 | // Stencil test |
| 81 | if (stencil.test_enabled != cur_state.stencil.test_enabled) { | 94 | if (stencil.test_enabled != cur_state.stencil.test_enabled) { |
| 82 | if (stencil.test_enabled) { | 95 | if (stencil.test_enabled) { |
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 6b97721d6..26b916360 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h | |||
| @@ -20,6 +20,13 @@ public: | |||
| 20 | } depth; | 20 | } depth; |
| 21 | 21 | ||
| 22 | struct { | 22 | struct { |
| 23 | GLboolean red_enabled; | ||
| 24 | GLboolean green_enabled; | ||
| 25 | GLboolean blue_enabled; | ||
| 26 | GLboolean alpha_enabled; | ||
| 27 | } color_mask; // GL_COLOR_WRITEMASK | ||
| 28 | |||
| 29 | struct { | ||
| 23 | bool test_enabled; // GL_STENCIL_TEST | 30 | bool test_enabled; // GL_STENCIL_TEST |
| 24 | GLenum test_func; // GL_STENCIL_FUNC | 31 | GLenum test_func; // GL_STENCIL_FUNC |
| 25 | GLint test_ref; // GL_STENCIL_REF | 32 | GLint test_ref; // GL_STENCIL_REF |