mesa: Returns a GL_INVALID_VALUE error if num of texs in glDeleteTextures is negative
authorEduardo Lima Mitev <elima@igalia.com>
Thu, 11 Dec 2014 22:34:20 +0000 (23:34 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Tue, 13 Jan 2015 11:19:32 +0000 (12:19 +0100)
Per GLES3 manual for glDeleteTextures
<https://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteTextures.xhtml>,
GL_INVALID_VALUE is generated if n is negative.

Fixes 1 dEQP test:
* dEQP-GLES3.functional.negative_api.texture.deletetextures

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/texobj.c

index 6e5eb7398f11342d2ea2a312cf212486e64eb957..a99dd7ad7c7eabe80946385a9d5b749531381aaa 100644 (file)
@@ -1406,6 +1406,11 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
    if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
       _mesa_debug(ctx, "glDeleteTextures %d\n", n);
 
+   if (n < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteTextures(n < 0)");
+      return;
+   }
+
    FLUSH_VERTICES(ctx, 0); /* too complex */
 
    if (n < 0) {