[Mesa-dev] [PATCH V3 06/11] i965: w/a for gather4 green RG32F

Kenneth Graunke kenneth at whitecape.org
Wed Sep 18 18:25:06 PDT 2013


On 09/15/2013 02:58 AM, Chris Forbes wrote:
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 4 ++++
>  src/mesa/drivers/dri/i965/brw_program.h        | 5 +++++
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 ++++
>  src/mesa/drivers/dri/i965/brw_wm.c             | 9 +++++++++
>  4 files changed, 22 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index be7aed7..6e1a3f5 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -1580,6 +1580,10 @@ uint32_t
>  fs_visitor::gather_channel(ir_texture *ir, int sampler)
>  {
>     int swiz = GET_SWZ(c->key.tex.swizzles[sampler], 0 /* red */);
> +   if (c->key.tex.gather_channel_quirk_mask & (1<<sampler))
> +      return 2;   /* gather4 sampler is broken for green channel on RG32F --
> +                   * we must ask for blue instead.
> +                   */
>     switch (swiz) {
>        case SWIZZLE_X: return 0;
>        case SWIZZLE_Y: return 1;
> diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h
> index e2ddaa8..07be4a0 100644
> --- a/src/mesa/drivers/dri/i965/brw_program.h
> +++ b/src/mesa/drivers/dri/i965/brw_program.h
> @@ -40,6 +40,11 @@ struct brw_sampler_prog_key_data {
>      */
>     uint16_t yuvtex_mask;
>     uint16_t yuvtex_swap_mask; /**< UV swaped */
> +
> +   /**
> +    * For RG32F, gather4's channel select is broken.
> +    */
> +   uint16_t gather_channel_quirk_mask;
>  };
>  
>  #ifdef __cplusplus
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index f23b235..23a6a48 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -2374,6 +2374,10 @@ uint32_t
>  vec4_visitor::gather_channel(ir_texture *ir, int sampler)
>  {
>     int swiz = GET_SWZ(key->tex.swizzles[sampler], 0 /* red */);
> +   if (key->tex.gather_channel_quirk_mask & (1<<sampler))
> +      return 2;   /* gather4 sampler is broken for green channel on RG32F --
> +                   * we must ask for blue instead.
> +                   */

Ew, right.  I should've kept reading...this function probably is useful
after all...

--Ken


More information about the mesa-dev mailing list