1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:57:45 +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); 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); RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
if (target == GL_TEXTURE_ENV) { // FIXME: We currently only support a subset of possible target values. Implement the rest!
if (pname == GL_TEXTURE_ENV_MODE) { RETURN_WITH_ERROR_IF(target != GL_TEXTURE_ENV, GL_INVALID_ENUM);
auto param_enum = static_cast<GLenum>(param);
switch (param_enum) { // FIXME: We currently only support a subset of possible pname values. Implement the rest!
case GL_MODULATE: RETURN_WITH_ERROR_IF(pname != GL_TEXTURE_ENV_MODE, GL_INVALID_ENUM);
case GL_REPLACE:
case GL_DECAL: auto param_enum = static_cast<GLenum>(param);
m_active_texture_unit->set_env_mode(param_enum);
break; switch (param_enum) {
default: case GL_MODULATE:
// FIXME: We currently only support a subset of possible param values. Implement the rest! case GL_REPLACE:
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM); case GL_DECAL:
break; m_active_texture_unit->set_env_mode(param_enum);
} break;
} else { default:
// FIXME: We currently only support a subset of possible pname values. Implement the rest! // FIXME: We currently only support a subset of possible param values. Implement the rest!
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM); dbgln_if(GL_DEBUG, "gl_tex_env({:#x}, {:#x}, {}): param unimplemented", target, pname, param);
}
} else {
// FIXME: We currently only support a subset of possible target values. Implement the rest!
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM); RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
} }
} }