[Mesa-dev] [PATCH 08/22] i965/wm: Prepare image surfaces for isl based

Jason Ekstrand jason at jlekstrand.net
Tue Jul 18 20:49:18 UTC 2017


On Tue, Jul 18, 2017 at 1:46 AM, Topi Pohjolainen <
topi.pohjolainen at gmail.com> wrote:

> There is a functional change: Before update_image_surface() didn't
> shift the number of layers for 3D, now it does like
> update_texture_image_param() did.
>

I've got a patch in one of my trees to fix this same bug.

5-8 are Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>


> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 22
> +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index ab6b9cdd29..a8c40d54d8 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -1632,6 +1632,23 @@ update_buffer_image_param(struct brw_context *brw,
>     param->stride[0] = _mesa_get_format_bytes(u->_ActualFormat);
>  }
>
> +static unsigned
> +get_image_num_layers(const struct intel_mipmap_tree *mt, GLenum target,
> +                     unsigned level)
> +{
> +   if (target == GL_TEXTURE_CUBE_MAP)
> +      return 6;
> +
> +   if (mt->surf.size > 0) {
> +      return target == GL_TEXTURE_3D ?
> +         minify(mt->surf.logical_level0_px.depth, level) :
> +         mt->surf.logical_level0_px.array_len;
> +   }
> +
> +   return target == GL_TEXTURE_3D ?
> +      minify(mt->logical_depth0, level) : mt->logical_depth0;
> +}
> +
>  static void
>  update_image_surface(struct brw_context *brw,
>                       struct gl_image_unit *u,
> @@ -1660,9 +1677,8 @@ update_image_surface(struct brw_context *brw,
>        } else {
>           struct intel_texture_object *intel_obj =
> intel_texture_object(obj);
>           struct intel_mipmap_tree *mt = intel_obj->mt;
> -         const unsigned num_layers = (!u->Layered ? 1 :
> -                                      obj->Target == GL_TEXTURE_CUBE_MAP
> ? 6 :
> -                                      mt->logical_depth0);
> +         const unsigned num_layers = u->Layered ?
> +            get_image_num_layers(mt, obj->Target, u->Level) : 1;
>
>           struct isl_view view = {
>              .format = format,
> --
> 2.11.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170718/ed67d1e0/attachment.html>


More information about the mesa-dev mailing list