[Mesa-dev] [PATCH] i965: Fix a crash in the texture gradient lowering pass with cube samplers

Ian Romanick idr at freedesktop.org
Fri Feb 13 09:54:01 PST 2015


Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 02/12/2015 11:29 PM, Iago Toral Quiroga wrote:
> We need to swizzle the rhs to match the number of components in the writemask,
> otherwise we'll hit an assertion in ir_assignment.
> ---
>  src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp b/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp
> index 878a54e..7a5f983 100644
> --- a/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp
> @@ -123,7 +123,9 @@ lower_texture_grad_visitor::visit_leave(ir_texture *ir)
>        new(mem_ctx) ir_variable(grad_type, "size", ir_var_temporary);
>     if (ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) {
>        base_ir->insert_before(size);
> -      base_ir->insert_before(assign(size, expr(ir_unop_i2f, txs), WRITEMASK_XY));
> +      base_ir->insert_before(assign(size,
> +                                    swizzle_for_size(expr(ir_unop_i2f, txs), 2),
> +                                    WRITEMASK_XY));
>        base_ir->insert_before(assign(size, new(mem_ctx) ir_constant(1.0f), WRITEMASK_Z));
>     } else {
>        emit(size, expr(ir_unop_i2f,
> 



More information about the mesa-dev mailing list