[Mesa-dev] [PATCH 1/6] i965/skl: Layout 3D textures the same as array textures

Ben Widawsky ben at bwidawsk.net
Tue Feb 24 22:06:02 PST 2015


On Fri, Feb 20, 2015 at 10:31:03PM +0000, Neil Roberts wrote:
> On Gen9+ the 3D textures use the same mipmap layout as 2D array
> textures.
> ---
>  src/mesa/drivers/dri/i965/brw_tex_layout.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> index 0e2841f..57922e9 100644
> --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
> +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> @@ -224,6 +224,9 @@ brw_miptree_layout_2d(struct intel_mipmap_tree *mt)
>  
>        width  = minify(width, 1);
>        height = minify(height, 1);
> +
> +      if (mt->target == GL_TEXTURE_3D)
> +         depth = minify(depth, 1);
>     }
>  }

assert(brw->gen >= 9)? (up to you, I'm very assert happy)

>  
> @@ -263,7 +266,7 @@ brw_miptree_layout_texture_array(struct brw_context *brw,
>        if (mt->compressed)
>           img_height /= mt->align_h;
>  
> -      for (int q = 0; q < mt->physical_depth0; q++) {
> +      for (int q = 0; q < mt->level[level].depth; q++) {
>           if (mt->array_layout == ALL_SLICES_AT_EACH_LOD) {
>              intel_miptree_set_image_offset(mt, level, q, 0, q * img_height);
>           } else {

Can you remind me how you can have different depths per level? Assuming they're
the same, I prefer this hunk removed because it's much clearer the old way in my
opinion.

> @@ -368,7 +371,10 @@ brw_miptree_layout(struct brw_context *brw, struct intel_mipmap_tree *mt)
>        break;
>  
>     case GL_TEXTURE_3D:
> -      brw_miptree_layout_texture_3d(brw, mt);
> +      if (brw->gen >= 9)
> +         brw_miptree_layout_texture_array(brw, mt);
> +      else
> +         brw_miptree_layout_texture_3d(brw, mt);
>        break;
>  
>     case GL_TEXTURE_1D_ARRAY:

Reviewed-by: Ben Widawsky <ben at bwidawsk.net>


More information about the mesa-dev mailing list