[Mesa-dev] [PATCH v3 02/10] i965/mipmap_tree: Add a depth parameter to create_for_bo

Jason Ekstrand jason at jlekstrand.net
Tue Jan 13 10:28:17 PST 2015


---
 src/mesa/drivers/dri/i965/intel_fbo.c         | 1 +
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 9 +++++++--
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 1 +
 src/mesa/drivers/dri/i965/intel_pixel_draw.c  | 2 +-
 src/mesa/drivers/dri/i965/intel_pixel_read.c  | 2 +-
 src/mesa/drivers/dri/i965/intel_tex_image.c   | 6 +++---
 6 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index 37ac613f..360c6de 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -389,6 +389,7 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx,
                                          image->offset,
                                          image->width,
                                          image->height,
+                                         1,
                                          image->pitch);
    if (!irb->mt)
       return;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index f815fbe..7d904b5 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -671,10 +671,12 @@ intel_miptree_create_for_bo(struct brw_context *brw,
                             uint32_t offset,
                             uint32_t width,
                             uint32_t height,
+                            uint32_t depth,
                             int pitch)
 {
    struct intel_mipmap_tree *mt;
    uint32_t tiling, swizzle;
+   GLenum target;
 
    drm_intel_bo_get_tiling(bo, &tiling, &swizzle);
 
@@ -689,9 +691,11 @@ intel_miptree_create_for_bo(struct brw_context *brw,
     */
    assert(pitch >= 0);
 
-   mt = intel_miptree_create_layout(brw, GL_TEXTURE_2D, format,
+   target = depth > 1 ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
+
+   mt = intel_miptree_create_layout(brw, target, format,
                                     0, 0,
-                                    width, height, 1,
+                                    width, height, depth,
                                     true, 0, false);
    if (!mt) {
       free(mt);
@@ -742,6 +746,7 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
                                                  0,
                                                  width,
                                                  height,
+                                                 1,
                                                  pitch);
    if (!singlesample_mt)
       goto fail;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 44ddc60..ee9cf1e 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -526,6 +526,7 @@ intel_miptree_create_for_bo(struct brw_context *brw,
                             uint32_t offset,
                             uint32_t width,
                             uint32_t height,
+                            uint32_t depth,
                             int pitch);
 
 void
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_draw.c b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
index 8222f33..e0904de 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
@@ -110,7 +110,7 @@ do_blit_drawpixels(struct gl_context * ctx,
                                   src_buffer,
                                   irb->mt->format,
                                   src_offset,
-                                  width, height,
+                                  width, height, 1,
                                   src_stride);
    if (!pbo_mt)
       return false;
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c
index beb3152..688a919 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
@@ -142,7 +142,7 @@ do_blit_readpixels(struct gl_context * ctx,
                                   dst_buffer,
                                   irb->mt->format,
                                   dst_offset,
-                                  width, height,
+                                  width, height, 1,
                                   dst_stride);
 
    if (!intel_miptree_blit(brw,
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index 855a6b4..b533dbd 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -143,7 +143,7 @@ try_pbo_upload(struct gl_context *ctx,
                                   src_buffer,
                                   intelImage->mt->format,
                                   src_offset,
-                                  image->Width, image->Height,
+                                  image->Width, image->Height, 1,
                                   src_stride);
    if (!pbo_mt)
       return false;
@@ -236,7 +236,7 @@ intel_set_texture_image_bo(struct gl_context *ctx,
    ctx->Driver.FreeTextureImageBuffer(ctx, image);
 
    intel_image->mt = intel_miptree_create_for_bo(brw, bo, image->TexFormat,
-                                                 0, width, height, pitch);
+                                                 0, width, height, 1, pitch);
    if (intel_image->mt == NULL)
        return;
    intel_image->mt->target = target;
@@ -489,7 +489,7 @@ blit_texture_to_pbo(struct gl_context *ctx,
                                   dst_buffer,
                                   intelImage->mt->format,
                                   dst_offset,
-                                  texImage->Width, texImage->Height,
+                                  texImage->Width, texImage->Height, 1,
                                   dst_stride);
 
    if (!pbo_mt)
-- 
2.2.0



More information about the mesa-dev mailing list