[Mesa-dev] [PATCH] glsl: Don't convert reductions of ivec to a dot-product

Christoph Brill egore911 at gmail.com
Tue Jun 24 22:21:08 PDT 2014


Reviewed-by: Christoph Brill <egore911 at gmail.com>
Am 25.06.2014 04:15 schrieb "Ian Romanick" <idr at freedesktop.org>:

> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Mesa has an optimization that converts expressions like "v.x + v.y + v.z
> + v.w" into dot(v, 1.0).  And therein lies the rub: the other operand to
> the dot-product is always a float... even if the vector is an ivec or
> uvec.  This results in an assertion failure in ir_builder.
>
> If the base type of the operand is not float, don't try the
> optimization.  Dot-product is not valid on integer data.
>
> Fixes piglit vs-integer-reduction.shader_test and OpenGL ES conformance
> test ES2-CTS.gtf.GL2Tests.glGetUniform.glGetUniform.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Matt Turner <mattst88 at gmail.com>
> ---
>  src/glsl/opt_algebraic.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
> index 448af6b..ac7514a 100644
> --- a/src/glsl/opt_algebraic.cpp
> +++ b/src/glsl/opt_algebraic.cpp
> @@ -124,7 +124,9 @@ static ir_expression *
>  try_replace_with_dot(ir_expression *expr0, ir_expression *expr1, void
> *mem_ctx)
>  {
>     if (expr0 && expr0->operation == ir_binop_add &&
> -       expr1 && expr1->operation == ir_binop_add) {
> +       expr0->type->is_float() &&
> +       expr1 && expr1->operation == ir_binop_add &&
> +       expr1->type->is_float()) {
>        ir_swizzle *x = expr0->operands[0]->as_swizzle();
>        ir_swizzle *y = expr0->operands[1]->as_swizzle();
>        ir_swizzle *z = expr1->operands[0]->as_swizzle();
> --
> 1.8.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140625/9db6e2de/attachment.html>


More information about the mesa-dev mailing list