[Mesa-dev] [PATCH 2/4] mesa: add renderbuffer attachment Layered field

Jordan Justen jordan.l.justen at intel.com
Sat Apr 27 16:37:53 PDT 2013


If glFramebufferTexture is used, then the framebuffer attachment is
layered.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/main/fbobject.c |   16 +++++++++-------
 src/mesa/main/fbobject.h |    3 ++-
 src/mesa/main/mtypes.h   |    1 +
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 6560408..ce1cb0e 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -350,7 +350,8 @@ _mesa_set_texture_attachment(struct gl_context *ctx,
                              struct gl_framebuffer *fb,
                              struct gl_renderbuffer_attachment *att,
                              struct gl_texture_object *texObj,
-                             GLenum texTarget, GLuint level, GLuint zoffset)
+                             GLenum texTarget, GLuint level, GLuint zoffset,
+                             GLboolean layered)
 {
    if (att->Texture == texObj) {
       /* re-attaching same texture */
@@ -372,6 +373,7 @@ _mesa_set_texture_attachment(struct gl_context *ctx,
    att->TextureLevel = level;
    att->CubeMapFace = _mesa_tex_target_to_face(texTarget);
    att->Zoffset = zoffset;
+   att->Layered = layered;
    att->Complete = GL_FALSE;
 
    if (_mesa_get_attachment_teximage(att)) {
@@ -2102,7 +2104,7 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb,
 static void
 framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, 
                     GLenum attachment, GLenum textarget, GLuint texture,
-                    GLint level, GLint zoffset)
+                    GLint level, GLint zoffset, GLboolean layered)
 {
    struct gl_renderbuffer_attachment *att;
    struct gl_texture_object *texObj = NULL;
@@ -2229,7 +2231,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
 	                                      BUFFER_DEPTH);
       } else {
 	 _mesa_set_texture_attachment(ctx, fb, att, texObj, textarget,
-				      level, zoffset);
+	                              level, zoffset, layered);
 	 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
 	    /* Above we created a new renderbuffer and attached it to the
 	     * depth attachment point. Now attach it to the stencil attachment
@@ -2295,7 +2297,7 @@ _mesa_FramebufferTexture1D(GLenum target, GLenum attachment,
    }
 
    framebuffer_texture(ctx, "1D", target, attachment, textarget, texture,
-                       level, 0);
+                       level, 0, GL_FALSE);
 }
 
 
@@ -2346,7 +2348,7 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum attachment,
    }
 
    framebuffer_texture(ctx, "2D", target, attachment, textarget, texture,
-                       level, 0);
+                       level, 0, GL_FALSE);
 }
 
 
@@ -2364,7 +2366,7 @@ _mesa_FramebufferTexture3D(GLenum target, GLenum attachment,
    }
 
    framebuffer_texture(ctx, "3D", target, attachment, textarget, texture,
-                       level, zoffset);
+                       level, zoffset, GL_FALSE);
 }
 
 
@@ -2375,7 +2377,7 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment,
    GET_CURRENT_CONTEXT(ctx);
 
    framebuffer_texture(ctx, "Layer", target, attachment, 0, texture,
-                       level, layer);
+                       level, layer, GL_FALSE);
 }
 
 
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 0358864..ba013fd 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -98,7 +98,8 @@ _mesa_set_texture_attachment(struct gl_context *ctx,
                              struct gl_framebuffer *fb,
                              struct gl_renderbuffer_attachment *att,
                              struct gl_texture_object *texObj,
-                             GLenum texTarget, GLuint level, GLuint zoffset);
+                             GLenum texTarget, GLuint level, GLuint zoffset,
+                             GLboolean layered);
 
 extern void
 _mesa_set_renderbuffer_attachment(struct gl_context *ctx,
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3cc4409..eb8ec3a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2609,6 +2609,7 @@ struct gl_renderbuffer_attachment
    GLuint CubeMapFace;  /**< 0 .. 5, for cube map textures. */
    GLuint Zoffset;      /**< Slice for 3D textures,  or layer for both 1D
                          * and 2D array textures */
+   GLboolean Layered;
 };
 
 
-- 
1.7.10.4



More information about the mesa-dev mailing list