mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-25 05:50:25 +01:00
mesa: Validate target before resolving tex obj in glTex(ture)SubImageXD
Currently, glTexSubImageXD attempt to resolve the texture object
(by calling _mesa_get_current_tex_object()) before validating the given
target. However, that method explicitly states that target must have been
validated before calling it, so it never returns a user error.
The target validation occurs later when texsubimage_error_check() is called.
This patch reorganizes target validation, taking it out from the error check
function and into a point before the texture object is resolved.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: 10.6 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5d64cae842)
[Emil Velikov: s/_mesa_enum_to_string/_mesa_lookup_enum_by_nr/]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Conflicts:
src/mesa/main/teximage.c
This commit is contained in:
parent
58b2e95c1f
commit
791cf8a025
1 changed files with 14 additions and 15 deletions
|
|
@ -2479,13 +2479,6 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions,
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* check target (proxies not allowed) */
|
||||
if (!legal_texsubimage_target(ctx, dimensions, target, dsa)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "%s(target=%s)",
|
||||
callerName, _mesa_lookup_enum_by_nr(target));
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* level check */
|
||||
if (level < 0 || level >= _mesa_max_texture_levels(ctx, target)) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "%s(level=%d)", callerName, level);
|
||||
|
|
@ -3515,14 +3508,6 @@ _mesa_texture_sub_image(struct gl_context *ctx, GLuint dims,
|
|||
{
|
||||
FLUSH_VERTICES(ctx, 0);
|
||||
|
||||
/* check target (proxies not allowed) */
|
||||
if (!legal_texsubimage_target(ctx, dims, target, dsa)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glTex%sSubImage%uD(target=%s)",
|
||||
dsa ? "ture" : "",
|
||||
dims, _mesa_lookup_enum_by_nr(target));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->NewState & _NEW_PIXEL)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
|
|
@ -3572,6 +3557,13 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
|
|||
struct gl_texture_object *texObj;
|
||||
struct gl_texture_image *texImage;
|
||||
|
||||
/* check target (proxies not allowed) */
|
||||
if (!legal_texsubimage_target(ctx, dims, target, false)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%uD(target=%s)",
|
||||
dims, _mesa_lookup_enum_by_nr(target));
|
||||
return;
|
||||
}
|
||||
|
||||
texObj = _mesa_get_current_tex_object(ctx, target);
|
||||
if (!texObj)
|
||||
return;
|
||||
|
|
@ -3632,6 +3624,13 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
|
|||
return;
|
||||
}
|
||||
|
||||
/* check target (proxies not allowed) */
|
||||
if (!legal_texsubimage_target(ctx, dims, texObj->Target, true)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "%s(target=%s)",
|
||||
callerName, _mesa_lookup_enum_by_nr(texObj->Target));
|
||||
return;
|
||||
}
|
||||
|
||||
if (texsubimage_error_check(ctx, dims, texObj, texObj->Target, level,
|
||||
xoffset, yoffset, zoffset,
|
||||
width, height, depth, format, type,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue