i965/mipmap_tree: Add a depth parameter to create_for_bo
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 8 Jan 2015 20:23:46 +0000 (12:23 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 22 Jan 2015 18:21:07 +0000 (10:21 -0800)
Reviewed-by: Neil Roberts <neil@linux.intel.com>
src/mesa/drivers/dri/i965/intel_fbo.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h
src/mesa/drivers/dri/i965/intel_pixel_draw.c
src/mesa/drivers/dri/i965/intel_pixel_read.c
src/mesa/drivers/dri/i965/intel_tex_image.c

index d12f4ae08214d070d3c4bdb0c0b7995e992b3543..7bdf99548f645c16da86ff3f4baafc6d24a683c6 100644 (file)
@@ -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;
index d44df1899be23b60040bcf242576a4c6f2860bfd..26e137d85a0dfdd349a722d49a4845c5f5adcdab 100644 (file)
@@ -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;
index 44ddc6070b69d9da17596b2b6b5bb860fb2cc013..ee9cf1ea4a9a892fdae17a97e1677b64b1400946 100644 (file)
@@ -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
index 8222f33f4ae89624f36137dee473d8c680208650..e0904de2ba37d727fde7a17fc0ac442c0217b73b 100644 (file)
@@ -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;
index beb31522c13e57af1760926e9550190aa7dc9728..688a91926970dfa1da1f1aeafb964535279c8c1d 100644 (file)
@@ -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,
index 855a6b4eab4701737a70614a63251d83d7a87604..b533dbde86faa9991e561f3f946f96a13310c5f9 100644 (file)
@@ -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)