[Mesa-dev] [PATCH 07/10] i965: Move texture swizzle resolving into dispatcher

Francisco Jerez currojerez at riseup.net
Wed Aug 19 07:54:18 PDT 2015


Topi Pohjolainen <topi.pohjolainen at intel.com> writes:

> v2: Non-trivial rebase
>
> Reviewed-by: Matt Turner <mattst88 at gmail.com> (v1)
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org> (v1)
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
>
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

Uhm, and here you dropped my "[ Francisco Jerez: Non-trivial rebase. ]"
and R-b tags and replaced them with a duplicate S-o-b line?  Fine.

> ---
>  src/mesa/drivers/dri/i965/brw_context.h           |  2 +-
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c  | 14 ++++++++++++--
>  src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 13 +------------
>  src/mesa/drivers/dri/i965/gen8_surface_state.c    | 13 +------------
>  4 files changed, 15 insertions(+), 27 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index ef9bb87..061600f 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -983,7 +983,7 @@ struct brw_context
>        void (*update_texture_surface)(struct gl_context *ctx,
>                                       const struct intel_mipmap_tree *mt,
>                                       struct gl_texture_object *tex_obj,
> -                                     uint32_t tex_format,
> +                                     uint32_t tex_format, int swizzle,
>                                       uint32_t *surf_offset,
>                                       bool for_gather);
>        uint32_t (*update_renderbuffer_surface)(struct brw_context *brw,
> 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 b68b136..4afdc23 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -310,7 +310,7 @@ static void
>  brw_update_texture_surface(struct gl_context *ctx,
>                             const struct intel_mipmap_tree *mt,
>                             struct gl_texture_object *tObj,
> -                           uint32_t tex_format,
> +                           uint32_t tex_format, int swizzle /* unused */,
>                             uint32_t *surf_offset,
>                             bool for_gather)
>  {
> @@ -842,8 +842,18 @@ update_stage_texture_surfaces(struct brw_context *brw,
>           assert(brw->gen >= 8);
>        }
>  
> +      /* Handling GL_ALPHA as a surface format override breaks 1.30+ style
> +       * texturing functions that return a float, as our code generation always
> +       * selects the .x channel (which would always be 0).
> +       */
> +      const bool alpha_depth = tex->DepthMode == GL_ALPHA &&
> +         (first_img->_BaseFormat == GL_DEPTH_COMPONENT ||
> +          first_img->_BaseFormat == GL_DEPTH_STENCIL);
> +      const unsigned swizzle = unlikely(alpha_depth) ?
> +         SWIZZLE_XYZW : brw_get_texture_swizzle(ctx, tex);
> +
>        /* _NEW_TEXTURE */
> -      brw->vtbl.update_texture_surface(ctx, mt, tex, format,
> +      brw->vtbl.update_texture_surface(ctx, mt, tex, format, swizzle,
>                                         surf_offset + s, for_gather);
>     }
>  }
> diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> index 26d080f..0de43a4 100644
> --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> @@ -351,7 +351,7 @@ static void
>  gen7_update_texture_surface(struct gl_context *ctx,
>                              const struct intel_mipmap_tree *mt,
>                              struct gl_texture_object *obj,
> -                            uint32_t format,
> +                            uint32_t format, int swizzle,
>                              uint32_t *surf_offset,
>                              bool for_gather)
>  {
> @@ -368,17 +368,6 @@ gen7_update_texture_surface(struct gl_context *ctx,
>        const unsigned depth = (obj->Immutable && obj->Target != GL_TEXTURE_3D ?
>                                obj->NumLayers : mt->logical_depth0);
>  
> -      /* Handling GL_ALPHA as a surface format override breaks 1.30+ style
> -       * texturing functions that return a float, as our code generation always
> -       * selects the .x channel (which would always be 0).
> -       */
> -      struct gl_texture_image *firstImage = obj->Image[0][obj->BaseLevel];
> -      const bool alpha_depth = obj->DepthMode == GL_ALPHA &&
> -         (firstImage->_BaseFormat == GL_DEPTH_COMPONENT ||
> -          firstImage->_BaseFormat == GL_DEPTH_STENCIL);
> -      const unsigned swizzle = (unlikely(alpha_depth) ? SWIZZLE_XYZW :
> -                                brw_get_texture_swizzle(&brw->ctx, obj));
> -
>        if (for_gather && format == BRW_SURFACEFORMAT_R32G32_FLOAT)
>           format = BRW_SURFACEFORMAT_R32G32_FLOAT_LD;
>  
> diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
> index b6766ef..c4eed08 100644
> --- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
> @@ -302,7 +302,7 @@ static void
>  gen8_update_texture_surface(struct gl_context *ctx,
>                              const struct intel_mipmap_tree *mt,
>                              struct gl_texture_object *obj,
> -                            uint32_t format,
> +                            uint32_t format, int swizzle,
>                              uint32_t *surf_offset,
>                              bool for_gather)
>  {
> @@ -312,7 +312,6 @@ gen8_update_texture_surface(struct gl_context *ctx,
>        brw_update_buffer_texture_surface(brw, obj, surf_offset);
>  
>     } else {
> -      struct gl_texture_image *firstImage = obj->Image[0][obj->BaseLevel];
>        struct intel_texture_object *intel_obj = intel_texture_object(obj);
>        /* If this is a view with restricted NumLayers, then our effective depth
>         * is not just the miptree depth.
> @@ -320,16 +319,6 @@ gen8_update_texture_surface(struct gl_context *ctx,
>        const unsigned depth = (obj->Immutable && obj->Target != GL_TEXTURE_3D ?
>                                obj->NumLayers : mt->logical_depth0);
>  
> -      /* Handling GL_ALPHA as a surface format override breaks 1.30+ style
> -       * texturing functions that return a float, as our code generation always
> -       * selects the .x channel (which would always be 0).
> -       */
> -      const bool alpha_depth = obj->DepthMode == GL_ALPHA &&
> -         (firstImage->_BaseFormat == GL_DEPTH_COMPONENT ||
> -          firstImage->_BaseFormat == GL_DEPTH_STENCIL);
> -      const unsigned swizzle = (unlikely(alpha_depth) ? SWIZZLE_XYZW :
> -                                brw_get_texture_swizzle(&brw->ctx, obj));
> -
>        gen8_emit_texture_surface_state(brw, mt, obj->Target,
>                                        obj->MinLayer, obj->MinLayer + depth,
>                                        obj->MinLevel + obj->BaseLevel,
> -- 
> 1.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150819/c68a2d72/attachment.sig>


More information about the mesa-dev mailing list