mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 13:20:14 +01:00
mesa: fix target error checking in glGetTexLevelParameter
With non-dsa functions we need to do target error checking before _mesa_get_current_tex_object which would just call _mesa_problem without raising GL_INVALID_ENUM error. In other places of Mesa, target gets checked before this call. Fixes failures in: ES31-CTS.texture_storage_multisample.APIGLGetTexLevelParameterifv.* v2: do the target check also for dsa functions (Timothy) Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
This commit is contained in:
parent
2f5ee9bf27
commit
a7e6f8cc9f
1 changed files with 25 additions and 7 deletions
|
|
@ -1562,6 +1562,19 @@ invalid_pname:
|
||||||
_mesa_enum_to_string(pname));
|
_mesa_enum_to_string(pname));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
valid_tex_level_parameteriv_target(struct gl_context *ctx, GLenum target,
|
||||||
|
bool dsa)
|
||||||
|
{
|
||||||
|
const char *suffix = dsa ? "ture" : "";
|
||||||
|
if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
|
"glGetTex%sLevelParameter[if]v(target=%s)", suffix,
|
||||||
|
_mesa_enum_to_string(target));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This isn't exposed to the rest of the driver because it is a part of the
|
* This isn't exposed to the rest of the driver because it is a part of the
|
||||||
|
|
@ -1585,13 +1598,6 @@ get_tex_level_parameteriv(struct gl_context *ctx,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
|
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
|
||||||
"glGetTex%sLevelParameter[if]v(target=%s)", suffix,
|
|
||||||
_mesa_enum_to_string(target));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
maxLevels = _mesa_max_texture_levels(ctx, target);
|
maxLevels = _mesa_max_texture_levels(ctx, target);
|
||||||
assert(maxLevels != 0);
|
assert(maxLevels != 0);
|
||||||
|
|
||||||
|
|
@ -1619,6 +1625,9 @@ _mesa_GetTexLevelParameterfv( GLenum target, GLint level,
|
||||||
GLint iparam;
|
GLint iparam;
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
||||||
|
if (!valid_tex_level_parameteriv_target(ctx, target, false))
|
||||||
|
return;
|
||||||
|
|
||||||
texObj = _mesa_get_current_tex_object(ctx, target);
|
texObj = _mesa_get_current_tex_object(ctx, target);
|
||||||
if (!texObj)
|
if (!texObj)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1636,6 +1645,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
||||||
struct gl_texture_object *texObj;
|
struct gl_texture_object *texObj;
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
||||||
|
if (!valid_tex_level_parameteriv_target(ctx, target, false))
|
||||||
|
return;
|
||||||
|
|
||||||
texObj = _mesa_get_current_tex_object(ctx, target);
|
texObj = _mesa_get_current_tex_object(ctx, target);
|
||||||
if (!texObj)
|
if (!texObj)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1657,6 +1669,9 @@ _mesa_GetTextureLevelParameterfv(GLuint texture, GLint level,
|
||||||
if (!texObj)
|
if (!texObj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!valid_tex_level_parameteriv_target(ctx, texObj->Target, true))
|
||||||
|
return;
|
||||||
|
|
||||||
get_tex_level_parameteriv(ctx, texObj, texObj->Target, level,
|
get_tex_level_parameteriv(ctx, texObj, texObj->Target, level,
|
||||||
pname, &iparam, true);
|
pname, &iparam, true);
|
||||||
|
|
||||||
|
|
@ -1675,6 +1690,9 @@ _mesa_GetTextureLevelParameteriv(GLuint texture, GLint level,
|
||||||
if (!texObj)
|
if (!texObj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!valid_tex_level_parameteriv_target(ctx, texObj->Target, true))
|
||||||
|
return;
|
||||||
|
|
||||||
get_tex_level_parameteriv(ctx, texObj, texObj->Target, level,
|
get_tex_level_parameteriv(ctx, texObj, texObj->Target, level,
|
||||||
pname, params, true);
|
pname, params, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue