diff options
author | Subv <subv2112@gmail.com> | 2015-08-20 17:11:09 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2015-08-20 17:11:09 +0200 |
commit | 46f660a789ff02f9cd86600ed82e0936b049b176 (patch) | |
tree | ddb2c54c86025ac338549922c7c548844e38a68e /src/video_core/renderer_opengl/pica_to_gl.h | |
parent | GPU/Rasterizer: Corrected the stencil implementation. (diff) | |
download | yuzu-46f660a789ff02f9cd86600ed82e0936b049b176.tar yuzu-46f660a789ff02f9cd86600ed82e0936b049b176.tar.gz yuzu-46f660a789ff02f9cd86600ed82e0936b049b176.tar.bz2 yuzu-46f660a789ff02f9cd86600ed82e0936b049b176.tar.lz yuzu-46f660a789ff02f9cd86600ed82e0936b049b176.tar.xz yuzu-46f660a789ff02f9cd86600ed82e0936b049b176.tar.zst yuzu-46f660a789ff02f9cd86600ed82e0936b049b176.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/pica_to_gl.h')
-rw-r--r-- | src/video_core/renderer_opengl/pica_to_gl.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h index 3b562da86..a8f84a411 100644 --- a/src/video_core/renderer_opengl/pica_to_gl.h +++ b/src/video_core/renderer_opengl/pica_to_gl.h @@ -152,6 +152,27 @@ inline GLenum CompareFunc(Pica::Regs::CompareFunc func) { return compare_func_table[(unsigned)func]; } +inline GLenum StencilOp(Pica::Regs::StencilAction action) { + static const GLenum stencil_op_table[] = { + GL_KEEP, // StencilAction::Keep + GL_KEEP, + GL_REPLACE, // StencilAction::Replace + GL_INCR, // StencilAction::Increment + GL_DECR, // StencilAction::Decrement + GL_INVERT // StencilAction::Invert + }; + + // Range check table for input + if ((unsigned)action >= ARRAY_SIZE(stencil_op_table)) { + LOG_CRITICAL(Render_OpenGL, "Unknown stencil op %d", action); + UNREACHABLE(); + + return GL_KEEP; + } + + return stencil_op_table[(unsigned)action]; +} + inline std::array<GLfloat, 4> ColorRGBA8(const u8* bytes) { return { { bytes[0] / 255.0f, bytes[1] / 255.0f, |