summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/pica_to_gl.h
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2015-08-20 17:11:09 +0200
committerSubv <subv2112@gmail.com>2015-08-20 17:11:09 +0200
commit46f660a789ff02f9cd86600ed82e0936b049b176 (patch)
treeddb2c54c86025ac338549922c7c548844e38a68e /src/video_core/renderer_opengl/pica_to_gl.h
parentGPU/Rasterizer: Corrected the stencil implementation. (diff)
downloadyuzu-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.h21
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,