1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:57:44 +00:00

LibGL: Reduce nesting levels in gl_tex_env

This commit is contained in:
Jelle Raaijmakers 2021-12-30 00:40:42 +01:00 committed by Andreas Kling
parent 8cf91a5ae5
commit 92ecd66490

View file

@ -1970,27 +1970,23 @@ void SoftwareGLContext::gl_tex_env(GLenum target, GLenum pname, GLfloat param)
APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_tex_env, target, pname, param);
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
if (target == GL_TEXTURE_ENV) {
if (pname == GL_TEXTURE_ENV_MODE) {
auto param_enum = static_cast<GLenum>(param);
// FIXME: We currently only support a subset of possible target values. Implement the rest!
RETURN_WITH_ERROR_IF(target != GL_TEXTURE_ENV, GL_INVALID_ENUM);
switch (param_enum) {
case GL_MODULATE:
case GL_REPLACE:
case GL_DECAL:
m_active_texture_unit->set_env_mode(param_enum);
break;
default:
// FIXME: We currently only support a subset of possible param values. Implement the rest!
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
break;
}
} else {
// FIXME: We currently only support a subset of possible pname values. Implement the rest!
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
}
} else {
// FIXME: We currently only support a subset of possible target values. Implement the rest!
// FIXME: We currently only support a subset of possible pname values. Implement the rest!
RETURN_WITH_ERROR_IF(pname != GL_TEXTURE_ENV_MODE, GL_INVALID_ENUM);
auto param_enum = static_cast<GLenum>(param);
switch (param_enum) {
case GL_MODULATE:
case GL_REPLACE:
case GL_DECAL:
m_active_texture_unit->set_env_mode(param_enum);
break;
default:
// FIXME: We currently only support a subset of possible param values. Implement the rest!
dbgln_if(GL_DEBUG, "gl_tex_env({:#x}, {:#x}, {}): param unimplemented", target, pname, param);
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
}
}