diff options
author | Ian Romanick <[email protected]> | 2013-03-06 11:05:14 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-05-13 12:05:18 -0700 |
commit | f274a2ca8733059bdd4f1c456ed4f6df7d7ec008 (patch) | |
tree | 002b5b4e0268463d283b4ab2cbcb757c97312533 /src/glsl/ir.h | |
parent | b0bb6103d23c16d23b0ec617746b4b0d1c22075d (diff) |
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 <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ir.h')
-rw-r--r-- | src/glsl/ir.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 6783ecaf2e9..e3e3b7119a8 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1136,9 +1136,17 @@ enum ir_expression_operation { ir_binop_ubo_load, /** + * Extract a scalar from a vector + * + * operand0 is the vector + * operand1 is the index of the field to read from operand0 + */ + ir_binop_vector_extract, + + /** * A sentinel marking the last of the binary operations. */ - ir_last_binop = ir_binop_ubo_load, + ir_last_binop = ir_binop_vector_extract, ir_triop_lrp, |