[Mesa-dev] [PATCH v2 24/35] i965/miptree: Fill out the isl_surf::usage field

Pohjolainen, Topi topi.pohjolainen at intel.com
Thu Jul 28 07:36:15 UTC 2016


On Tue, Jul 26, 2016 at 03:02:15PM -0700, Jason Ekstrand wrote:
> ---
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

> 
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index 3860088..ba06ac9 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -3153,7 +3153,30 @@ intel_miptree_get_isl_surf(struct brw_context *brw,
>        unreachable("Invalid array layout");
>     }
>  
> -   surf->usage = 0; /* TODO */
> +   GLenum base_format = _mesa_get_format_base_format(mt->format);
> +   switch (base_format) {
> +   case GL_DEPTH_COMPONENT:
> +      surf->usage = ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT;
> +      break;
> +   case GL_STENCIL_INDEX:
> +      surf->usage = ISL_SURF_USAGE_STENCIL_BIT;
> +      if (brw->gen >= 8)
> +         surf->usage |= ISL_SURF_USAGE_TEXTURE_BIT;
> +      break;
> +   case GL_DEPTH_STENCIL:
> +      /* In this case we only texture from the depth part */
> +      surf->usage = ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_STENCIL_BIT |
> +                    ISL_SURF_USAGE_TEXTURE_BIT;
> +      break;
> +   default:
> +      surf->usage = ISL_SURF_USAGE_TEXTURE_BIT;
> +      if (brw->format_supported_as_render_target[mt->format])
> +         surf->usage = ISL_SURF_USAGE_RENDER_TARGET_BIT;
> +      break;
> +   }
> +
> +   if (_mesa_is_cube_map_texture(mt->target))
> +      surf->usage |= ISL_SURF_USAGE_CUBE_BIT;
>  }
>  
>  /* WARNING: THE SURFACE CREATED BY THIS FUNCTION IS NOT COMPLETE AND CANNOT BE
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list