mesa: add renderbuffer attachment Layered field
authorJordan Justen <jordan.l.justen@intel.com>
Thu, 18 Apr 2013 17:08:50 +0000 (10:08 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Wed, 1 May 2013 22:31:44 +0000 (15:31 -0700)
If glFramebufferTexture is used, then the framebuffer attachment is
layered.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/fbobject.c
src/mesa/main/fbobject.h
src/mesa/main/mtypes.h

index 645a8a3d45f0e0c3ac5eef959fa269df6e42cc11..798466163de5903152975d98af235c1a40156fd8 100644 (file)
@@ -351,7 +351,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 */
@@ -373,6 +374,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)) {
@@ -2103,7 +2105,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;
@@ -2230,7 +2232,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
@@ -2296,7 +2298,7 @@ _mesa_FramebufferTexture1D(GLenum target, GLenum attachment,
    }
 
    framebuffer_texture(ctx, "1D", target, attachment, textarget, texture,
-                       level, 0);
+                       level, 0, GL_FALSE);
 }
 
 
@@ -2347,7 +2349,7 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum attachment,
    }
 
    framebuffer_texture(ctx, "2D", target, attachment, textarget, texture,
-                       level, 0);
+                       level, 0, GL_FALSE);
 }
 
 
@@ -2365,7 +2367,7 @@ _mesa_FramebufferTexture3D(GLenum target, GLenum attachment,
    }
 
    framebuffer_texture(ctx, "3D", target, attachment, textarget, texture,
-                       level, zoffset);
+                       level, zoffset, GL_FALSE);
 }
 
 
@@ -2376,7 +2378,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);
 }
 
 
index 9e934add424975603d2437f4ff6c71075c4010c7..5ebbb3538f8f1c62cea3b627b6142fd54ef86e1d 100644 (file)
@@ -99,7 +99,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,
index 130c7b7c03acd228fe355d82fd4d02eb88685115..8dda8e23f8e7854b9d2b486a63cb73554fcc318a 100644 (file)
@@ -2610,6 +2610,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;
 };