[Mesa-dev] [PATCH 5/7] glsl: Add "typeless" constructor for quadop ir_expressions
Olivier Galibert
galibert at pobox.com
Fri Jul 27 11:27:12 PDT 2012
On Fri, Jul 27, 2012 at 10:49:23AM -0700, Kenneth Graunke wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This matches the typeless constructors for unop and binop
> ir_expressions.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/glsl/ir.cpp | 17 +++++++++++++++++
> src/glsl/ir.h | 2 ++
> 2 files changed, 19 insertions(+)
>
> diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
> index b0e38d8..5faf34a 100644
> --- a/src/glsl/ir.cpp
> +++ b/src/glsl/ir.cpp
> @@ -236,6 +236,23 @@ ir_expression::ir_expression(int op, const struct glsl_type *type,
> this->operands[3] = op3;
> }
>
> +ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1,
> + ir_rvalue *op2, ir_rvalue *op3)
> +{
> + assert(op0->type->is_scalar());
> + assert((op0->type == op1->type)
> + && (op0->type == op2->type)
> + && (op0->type == op3->type));
> +
> + this->ir_type = ir_type_expression;
> + this->type = glsl_type::get_instance(op0->type->base_type, 4, 1);
> + this->operation = ir_expression_operation(op);
You're hardcoding ir_quadop_vector's properties here. A comment
saying so could be useful, if other quadops with different properties
happen someday. In fact, you're hardcoding them so hard passing "op"
may not make sense. A static method
ir_expression *ir_expression::build_quadop_vector
perhaps?
OG.
More information about the mesa-dev
mailing list