main: Fix an error generated by FramebufferTexture
authorLaura Ekstrand <laura@jlekstrand.net>
Mon, 20 Apr 2015 15:21:20 +0000 (17:21 +0200)
committerFredrik Höglund <fredrik@kde.org>
Thu, 14 May 2015 13:48:12 +0000 (15:48 +0200)
gl*FramebufferTexture should generate GL_INVALID_VALUE when the
texture doesn't exist.

[Fredrik: Split this change out from the next commit]

Signed-off-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
src/mesa/main/fbobject.c

index 20a4e86007cf424741258c59a0b20e4a305f84d0..09dbf338a51719a2f40a3d2fbb0b7a946455a729 100644 (file)
@@ -2654,10 +2654,19 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
          }
       }
       else {
-         /* can't render to a non-existant texture */
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glFramebufferTexture%s(non existant texture)",
-                     caller);
+         /* Can't render to a non-existent texture object.
+          *
+          * The OpenGL 4.5 core spec (02.02.2015) in Section 9.2 Binding and
+          * Managing Framebuffer Objects specifies a different error
+          * depending upon the calling function (PDF pages 325-328).
+          * *FramebufferTexture (where layered = GL_TRUE) throws invalid
+          * value, while the other commands throw invalid operation (where
+          * layered = GL_FALSE).
+          */
+         const GLenum error = layered ? GL_INVALID_VALUE :
+                              GL_INVALID_OPERATION;
+         _mesa_error(ctx, error,
+                     "%s(non-existent texture %u)", caller, texture);
          return;
       }