glsl: Add ir_binop_vector_extract
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 6 Mar 2013 19:05:14 +0000 (11:05 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 13 May 2013 19:05:18 +0000 (12:05 -0700)
commitf274a2ca8733059bdd4f1c456ed4f6df7d7ec008
tree002b5b4e0268463d283b4ab2cbcb757c97312533
parentb0bb6103d23c16d23b0ec617746b4b0d1c22075d
glsl: Add ir_binop_vector_extract

The new opcode is used to get a single field from a vector.  The field
index may not be constant.  This will eventually replace
ir_dereference_array of vectors.  This is similar to the extractelement
instruction in LLVM IR.

http://llvm.org/docs/LangRef.html#extractelement-instruction

v2: Convert tabs to spaces.  Suggested by Eric.

v3: Add array index range checking to ir_binop_vector_extract constant
expression handling.  Suggested by Ken.

v4: Use CLAMP instead of MIN2(MAX2()).  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ir.cpp
src/glsl/ir.h
src/glsl/ir_constant_expression.cpp
src/glsl/ir_validate.cpp
src/mesa/program/ir_to_mesa.cpp