mesa: check numlevels and numlayers when creating a texture view
v2: Compare against zero only, because the values are unsigned and
can't be negative (Tapani Pälli)
CC: mesa-stable
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net> (v1)
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25532>
This commit is contained in:
@@ -608,6 +608,22 @@ texture_view(struct gl_context *ctx, struct gl_texture_object *origTexObj,
|
||||
}
|
||||
|
||||
if (!no_error) {
|
||||
/* OpenGL 4.6 (Core Profile) - May 14, 2018, 8.18 Texture Views, p.271
|
||||
* An INVALID_OPERATION error is generated if the computed values of
|
||||
* TEXTURE_VIEW_NUM_LEVELS or TEXTURE_VIEW_NUM_LAYERS for texture,
|
||||
* as described above, are less than or equal to zero.
|
||||
*/
|
||||
if (newViewNumLevels == 0) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glTextureView(invalid minlevels or numlevels)");
|
||||
return;
|
||||
}
|
||||
if (newViewNumLayers == 0) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glTextureView(invalid minlayers or numlayers)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the dimensions of the original texture are larger than the maximum
|
||||
* supported dimensions of the new target, the error INVALID_OPERATION is
|
||||
* generated. For example, if the original texture has a TEXTURE_2D_ARRAY
|
||||
|
||||
Reference in New Issue
Block a user