[Mesa-dev] [PATCH 05/10] i965/vec4: Don't set header_present if texel offsets are all 0.

Matt Turner mattst88 at gmail.com
Tue Jan 21 18:50:27 PST 2014


On Sat, Jan 18, 2014 at 8:20 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> In theory, a shader might use textureOffset() but set all the texel
> offsets to zero.  In that case, we don't actually need to set up the
> message header - zero is the implicit default.
>
> By moving the texture_offset setup before the header_present setup, we
> can easily only set header_present when there are non-zero texel offset
> values.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index 3b8cef6..2b6f3e9 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -2363,10 +2363,16 @@ vec4_visitor::visit(ir_texture *ir)
>        assert(!"Unrecognized tex op");
>     }
>
> -   bool use_texture_offset = ir->offset != NULL && ir->op != ir_txf;
> +   if (ir->offset != NULL && ir->op != ir_txf)
> +      inst->texture_offset = brw_texture_offset(ctx, ir->offset->as_constant());
> +
> +   /* Stuff the channel select bits in the top of the texture offset */
> +   if (ir->op == ir_tg4)
> +      inst->texture_offset |= gather_channel(ir, sampler)<<16;

Put some spaces around << while we're modifying this line?


More information about the mesa-dev mailing list