[Mesa-dev] [PATCH 09/57] main: Fix an error generated by FramebufferTexture

Fredrik Höglund fredrik at kde.org
Mon May 11 10:27:06 PDT 2015


From: Laura Ekstrand <laura at jlekstrand.net>

gl*FramebufferTexture should generate GL_INVALID_VALUE when the
texture doesn't exist.

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

Cc: "10.4 10.5" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Fredrik Höglund <fredrik at kde.org>
Signed-off-by: Fredrik Höglund <fredrik at kde.org>
---
 src/mesa/main/fbobject.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 20a4e86..09dbf33 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -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;
       }
 
-- 
2.1.4



More information about the mesa-dev mailing list