mesa: pass rb attachment to _mesa_framebuffer_texture()
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 5 May 2017 07:00:34 +0000 (17:00 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 11 May 2017 03:53:39 +0000 (13:53 +1000)
This change will help us add KHR_no_error support to the caller.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/common/meta.c
src/mesa/main/fbobject.c
src/mesa/main/fbobject.h

index f4c91ac22cce973aeb1f4a5b7e85ae1d1e8ed3ad..47ef16b3e7d2721c8ef5dbe6f236c7a7153cb1a7 100644 (file)
@@ -118,8 +118,12 @@ _mesa_meta_framebuffer_texture_image(struct gl_context *ctx,
       ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face
       : texObj->Target;
 
-   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, texTarget,
-                             level, layer, false, __func__);
+   struct gl_renderbuffer_attachment *att =
+      _mesa_get_and_validate_attachment(ctx, fb, attachment, __func__);
+   assert(att);
+
+   _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, texTarget,
+                             level, layer, false);
 }
 
 static struct gl_shader *
index 88679215c2775e1bfe44acc527275a80c1f215d1..fb8fbe900d6c68134b302eacf8d446b2294a52b1 100644 (file)
@@ -3224,15 +3224,10 @@ _mesa_get_and_validate_attachment(struct gl_context *ctx,
 void
 _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
                           GLenum attachment,
+                          struct gl_renderbuffer_attachment *att,
                           struct gl_texture_object *texObj, GLenum textarget,
-                          GLint level, GLuint layer, GLboolean layered,
-                          const char *caller)
+                          GLint level, GLuint layer, GLboolean layered)
 {
-   struct gl_renderbuffer_attachment *att =
-      _mesa_get_and_validate_attachment(ctx, fb, attachment, caller);
-   if (!att)
-      return;
-
    FLUSH_VERTICES(ctx, _NEW_BUFFERS);
 
    mtx_lock(&fb->Mutex);
@@ -3331,8 +3326,13 @@ framebuffer_texture_with_dims(int dims, GLenum target,
          return;
    }
 
-   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, textarget, level,
-                             layer, GL_FALSE, caller);
+   struct gl_renderbuffer_attachment *att =
+      _mesa_get_and_validate_attachment(ctx, fb, attachment, caller);
+   if (!att)
+      return;
+
+   _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, textarget,
+                             level, layer, GL_FALSE);
 }
 
 
@@ -3405,8 +3405,13 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment,
       }
    }
 
-   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, textarget, level,
-                             layer, GL_FALSE, func);
+   struct gl_renderbuffer_attachment *att =
+      _mesa_get_and_validate_attachment(ctx, fb, attachment, func);
+   if (!att)
+      return;
+
+   _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, textarget,
+                             level, layer, GL_FALSE);
 }
 
 
@@ -3447,8 +3452,13 @@ _mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment,
       }
    }
 
-   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, textarget, level,
-                             layer, GL_FALSE, func);
+   struct gl_renderbuffer_attachment *att =
+      _mesa_get_and_validate_attachment(ctx, fb, attachment, func);
+   if (!att)
+      return;
+
+   _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, textarget,
+                             level, layer, GL_FALSE);
 }
 
 
@@ -3490,8 +3500,13 @@ _mesa_FramebufferTexture(GLenum target, GLenum attachment,
          return;
    }
 
-   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, 0, level,
-                             0, layered, func);
+   struct gl_renderbuffer_attachment *att =
+      _mesa_get_and_validate_attachment(ctx, fb, attachment, func);
+   if (!att)
+      return;
+
+   _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, 0, level,
+                             0, layered);
 }
 
 
@@ -3530,8 +3545,13 @@ _mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment,
          return;
    }
 
-   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, 0, level,
-                             0, layered, func);
+   struct gl_renderbuffer_attachment *att =
+      _mesa_get_and_validate_attachment(ctx, fb, attachment, func);
+   if (!att)
+      return;
+
+   _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, 0, level,
+                             0, layered);
 }
 
 
index aef2755c661e37511b22f5a5cdb67ee0c1f4daf5..d0f905e46b0fc237a491132e0c787997b8ce5d4b 100644 (file)
@@ -127,9 +127,9 @@ _mesa_get_and_validate_attachment(struct gl_context *ctx,
 extern void
 _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
                           GLenum attachment,
+                          struct gl_renderbuffer_attachment *att,
                           struct gl_texture_object *texObj, GLenum textarget,
-                          GLint level, GLuint layer, GLboolean layered,
-                          const char *caller);
+                          GLint level, GLuint layer, GLboolean layered);
 
 extern GLenum
 _mesa_check_framebuffer_status(struct gl_context *ctx,