[Mesa-dev] [PATCH 18/19] i965/fs: Perform CSE on texture operations.

Kenneth Graunke kenneth at whitecape.org
Sat May 31 18:10:53 PDT 2014


On Tuesday, May 27, 2014 06:47:49 PM Matt Turner wrote:
> Helps Unigine Tropics and some (old) gstreamer shaders in shader-db.
> 
> instructions in affected programs:     792 -> 744 (-6.06%)
> ---
>  src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> index 75c6aab..6e36b8c 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> @@ -92,7 +92,7 @@ is_expression(const fs_inst *const inst)
>     case SHADER_OPCODE_LOAD_PAYLOAD:
>        return !is_copy_payload(inst);
>     default:
> -      return false;
> +      return inst->is_tex();
>     }
>  }
>  
> @@ -142,6 +142,16 @@ instructions_match(fs_inst *a, fs_inst *b)
>            a->conditional_mod == b->conditional_mod &&
>            a->dst.type == b->dst.type &&
>            a->sources == b->sources &&
> +          (a->is_tex() ? (a->texture_offset == b->texture_offset &&
> +                          a->mlen == b->mlen &&
> +                          a->regs_written == b->regs_written &&
> +                          a->base_mrf == b->base_mrf &&
> +                          a->sampler == b->sampler &&
> +                          a->target == b->target &&

target is a field for FB writes - it isn't used for sampling messages.
You should probably drop it.

Otherwise, this patch is (dubiously, given that I'm working backwards):
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> +                          a->eot == b->eot &&
> +                          a->header_present == b->header_present &&
> +                          a->shadow_compare == b->shadow_compare)
> +                       : true) &&
>            operands_match(a, b);
>  }
>  
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140531/c0b9d80e/attachment.sig>


More information about the mesa-dev mailing list