[Mesa-dev] [PATCH] glsl: Correctly validate fma()'s types.

Kenneth Graunke kenneth at whitecape.org
Mon Sep 9 14:16:24 PDT 2013


On 09/09/2013 11:23 AM, Matt Turner wrote:
> lrp() can take a scalar as a third argument, and fma() cannot.
> ---
>   src/glsl/ir_validate.cpp | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
> index 105f615..4898211 100644
> --- a/src/glsl/ir_validate.cpp
> +++ b/src/glsl/ir_validate.cpp
> @@ -531,6 +531,12 @@ ir_validate::visit_leave(ir_expression *ir)
>         break;
>
>      case ir_triop_fma:
> +      assert(ir->type->base_type == GLSL_TYPE_FLOAT);
> +      assert(ir->type == ir->operands[0]->type);
> +      assert(ir->type == ir->operands[1]->type);
> +      assert(ir->type == ir->operands[2]->type);
> +      break;
> +
>      case ir_triop_lrp:
>         assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
>         assert(ir->operands[0]->type == ir->operands[1]->type);
>

Always glad to see more validation.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list