From c01c045fc4c642c578f985926a7461d1df59e547 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 20 Jun 2011 16:59:26 -0400 Subject: [PATCH] r600g: fix fbo depth/stencil texture allocation for evergreen+ evergreen+ stores depth and stencil separately so when we allocate a depth/stencil fbo, make sure we allocate enough memory for both depth and stencil buffers. Signed-off-by: Alex Deucher --- src/gallium/drivers/r600/r600_texture.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 470d26e..13473f3 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -247,6 +247,7 @@ static void r600_setup_miptree(struct pipe_screen *screen, for (i = 0, offset = 0; i <= ptex->last_level; i++) { unsigned blocksize = util_format_get_blocksize(ptex->format); + unsigned base_align = r600_get_base_alignment(screen, ptex->format, array_mode); r600_texture_set_array_mode(screen, rtex, i, array_mode); @@ -265,9 +266,13 @@ static void r600_setup_miptree(struct pipe_screen *screen, else size = layer_size * ptex->array_size; + /* evergreen stores depth and stencil separately */ + if ((chipc >= EVERGREEN) && util_format_is_depth_or_stencil(ptex->format)) + size = align(size + (nblocksx * nblocksy * 1), base_align); + /* align base image and start of miptree */ if ((i == 0) || (i == 1)) - offset = align(offset, r600_get_base_alignment(screen, ptex->format, array_mode)); + offset = align(offset, base_align); rtex->offset[i] = offset; rtex->layer_size[i] = layer_size; rtex->pitch_in_blocks[i] = nblocksx; /* CB talks in elements */ -- 1.7.1.1