1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +00:00

LibGL: Implement glClearDepthf and store as float

Our API still specifies it as a double, but internally we communicate a
float to the rasterizer. Additionally, clamp the value to 0..1 as
described in the spec.
This commit is contained in:
Jelle Raaijmakers 2022-02-21 01:26:27 +01:00 committed by Linus Groh
parent 36a732e98e
commit 44a3d5c101
4 changed files with 9 additions and 3 deletions

View file

@ -267,7 +267,7 @@ void SoftwareGLContext::gl_clear(GLbitfield mask)
m_rasterizer.clear_color(m_clear_color);
if (mask & GL_DEPTH_BUFFER_BIT)
m_rasterizer.clear_depth(static_cast<float>(m_clear_depth));
m_rasterizer.clear_depth(m_clear_depth);
if (mask & GL_STENCIL_BUFFER_BIT)
m_rasterizer.clear_stencil(m_clear_stencil);
@ -288,7 +288,7 @@ void SoftwareGLContext::gl_clear_depth(GLdouble depth)
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
m_clear_depth = depth;
m_clear_depth = clamp(static_cast<float>(depth), 0.f, 1.f);
}
void SoftwareGLContext::gl_clear_stencil(GLint s)