[Mesa-dev] [PATCH V2 10/16] mesa: add frame_buffer_texture_layer_no_error() helper

Timothy Arceri tarceri at itsqueeze.com
Wed May 10 01:56:53 UTC 2017


To be used to add KHR_no_error support while sharing code between
the DSA and non-DSA OpenGL function.
---
 src/mesa/main/fbobject.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ba01d0c..3338974 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3423,20 +3423,48 @@ _mesa_FramebufferTexture3D_no_error(GLenum target, GLenum attachment,
 void GLAPIENTRY
 _mesa_FramebufferTexture3D(GLenum target, GLenum attachment,
                            GLenum textarget, GLuint texture,
                            GLint level, GLint layer)
 {
    framebuffer_texture_with_dims(3, target, attachment, textarget, texture,
                                  level, layer, "glFramebufferTexture3D");
 }
 
 
+static void
+frame_buffer_texture_layer_no_error(struct gl_context *ctx,
+                                    struct gl_framebuffer *fb,
+                                    GLenum attachment, GLuint texture,
+                                    GLint level, GLint layer,
+                                    const char *func)
+{
+   /* Get the texture object */
+   struct gl_texture_object *texObj =
+      get_texture_for_framebuffer(ctx, texture);
+
+   struct gl_renderbuffer_attachment *att =
+      get_attachment(ctx, fb, attachment, NULL);
+
+   GLenum textarget = 0;
+   if (texObj) {
+      if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
+         assert(layer >= 0 && layer < 6);
+         textarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer;
+         layer = 0;
+      }
+   }
+
+   _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, textarget,
+                             level, layer, GL_FALSE);
+}
+
+
 void GLAPIENTRY
 _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment,
                               GLuint texture, GLint level, GLint layer)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_framebuffer *fb;
    struct gl_texture_object *texObj;
    GLenum textarget = 0;
 
    const char *func = "glFramebufferTextureLayer";
-- 
2.9.3



More information about the mesa-dev mailing list