summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@serenityos.org>2021-12-22 23:38:13 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-24 05:10:28 -0800
commit74ed7713faaf5f7ebf378445ab5096f242a4ef22 (patch)
tree255c0c6098fcf40f3a316c95834087e32b1b63ca /Userland/Libraries/LibGL
parent33e601800c4295796deb2f4800f96e46a3611532 (diff)
downloadserenity-74ed7713faaf5f7ebf378445ab5096f242a4ef22.zip
LibSoftGPU: Remove OpenGL type for depth test func
Replaces the GLenum used in the RasterizerConfig for selecting the depth test function with out own enum.
Diffstat (limited to 'Userland/Libraries/LibGL')
-rw-r--r--Userland/Libraries/LibGL/SoftwareGLContext.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
index e17f0661e1..dcf8225779 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
@@ -2130,7 +2130,36 @@ void SoftwareGLContext::gl_depth_func(GLenum func)
GL_INVALID_ENUM);
auto options = m_rasterizer.options();
- options.depth_func = func;
+
+ switch (func) {
+ case GL_NEVER:
+ options.depth_func = SoftGPU::DepthTestFunction::Never;
+ break;
+ case GL_ALWAYS:
+ options.depth_func = SoftGPU::DepthTestFunction::Always;
+ break;
+ case GL_LESS:
+ options.depth_func = SoftGPU::DepthTestFunction::Less;
+ break;
+ case GL_LEQUAL:
+ options.depth_func = SoftGPU::DepthTestFunction::LessOrEqual;
+ break;
+ case GL_EQUAL:
+ options.depth_func = SoftGPU::DepthTestFunction::Equal;
+ break;
+ case GL_NOTEQUAL:
+ options.depth_func = SoftGPU::DepthTestFunction::NotEqual;
+ break;
+ case GL_GEQUAL:
+ options.depth_func = SoftGPU::DepthTestFunction::GreaterOrEqual;
+ break;
+ case GL_GREATER:
+ options.depth_func = SoftGPU::DepthTestFunction::Greater;
+ break;
+ default:
+ VERIFY_NOT_REACHED();
+ }
+
m_rasterizer.set_options(options);
}