summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2013-03-06 11:05:14 -0800
committerIan Romanick <ian.d.romanick@intel.com>2013-05-13 12:05:18 -0700
commitf274a2ca8733059bdd4f1c456ed4f6df7d7ec008 (patch)
tree002b5b4e0268463d283b4ab2cbcb757c97312533 /src/glsl/ir.cpp
parentb0bb6103d23c16d23b0ec617746b4b0d1c22075d (diff)
downloadexternal_mesa3d-f274a2ca8733059bdd4f1c456ed4f6df7d7ec008.zip
external_mesa3d-f274a2ca8733059bdd4f1c456ed4f6df7d7ec008.tar.gz
external_mesa3d-f274a2ca8733059bdd4f1c456ed4f6df7d7ec008.tar.bz2
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>
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 2c54525..737d8d4 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -399,6 +399,10 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1)
this->type = op0->type;
break;
+ case ir_binop_vector_extract:
+ this->type = op0->type->get_scalar_type();
+ break;
+
default:
assert(!"not reached: missing automatic type setup for ir_expression");
this->type = glsl_type::float_type;
@@ -510,6 +514,7 @@ static const char *const operator_strs[] = {
"packHalf2x16_split",
"bfm",
"ubo_load",
+ "vector_extract",
"lrp",
"bfi",
"bitfield_extract",