From 404660e3c7bc6d13ae1d40185a02bfff6b956ac9 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 8 Jan 2015 12:23:46 -0800 Subject: [PATCH] i965/mipmap_tree: Add a depth parameter to create_for_bo Reviewed-by: Neil Roberts --- 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 d12f4ae0821..7bdf99548f6 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 d44df1899be..26e137d85a0 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 44ddc6070b6..ee9cf1ea4a9 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 8222f33f4ae..e0904de2ba3 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 beb31522c13..688a9192697 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 855a6b4eab4..b533dbde86f 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.30.2