glsl: Consolidate ir_expression constructors that use explicit types.
authorKenneth Graunke <kenneth@whitecape.org>
Sun, 2 Dec 2012 07:40:42 +0000 (23:40 -0800)
committerMatt Turner <mattst88@gmail.com>
Thu, 28 Feb 2013 21:18:59 +0000 (13:18 -0800)
commit1afd33ec054f7c1741a01ce89301355a7074396f
tree3b89235482fc0c3df6ab0e724fd1263b97b9ae0f
parentf0213b124259804ce8e114575fe9058dffdf5864
glsl: Consolidate ir_expression constructors that use explicit types.

Previously, we had separate constructors for one, two, and four operand
expressions.  This patch consolidates them into a single constructor
which uses NULL default parameters.

The unary and binary operator constructors had assertions to verify that
the caller supplied the correct number of operands for the expression,
but the four-operand version did not.  Since get_num_operands for
ir_quadop_vector returns the number of vector_elements, we can safely
add that without breaking the semantics of ir_quadop_vector.

This also paves the way for expressions with three operands.  Currently,
none can be constructed since get_num_operands() never returns 3.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ir.cpp
src/glsl/ir.h