summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-08 15:52:22 -0700
committerBrian <brian@yutani.localnet.net>2007-03-08 15:52:22 -0700
commit5761a93bba11e8a47660f465b27485e130150242 (patch)
tree5e34122f787a8e13fcf51be0990cafb467c5fea6
parent3e0fbc7efcebdbef5698a270bd0192335a2d556b (diff)
Added IR_SLE and IR_SLT for <= and < operations.
Using IR_SGE and IR_SGT with transposed args doesn't work since the __asm calls don't do argument matching by name, but by position. This fixes the broken lessThan() and lessThanEqual() functions.
-rw-r--r--src/mesa/shader/slang/slang_codegen.c17
-rw-r--r--src/mesa/shader/slang/slang_emit.c4
-rw-r--r--src/mesa/shader/slang/slang_ir.h2
3 files changed, 15 insertions, 8 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 5da98550dc..ffc9b3eaf0 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -327,6 +327,8 @@ static slang_asm_info AsmInfo[] = {
{ "vec4_seq", IR_SEQ, 1, 2 },
{ "vec4_sge", IR_SGE, 1, 2 },
{ "vec4_sgt", IR_SGT, 1, 2 },
+ { "vec4_sle", IR_SLE, 1, 2 },
+ { "vec4_slt", IR_SLT, 1, 2 },
/* vec4 unary */
{ "vec4_floor", IR_FLOOR, 1, 1 },
{ "vec4_frac", IR_FRAC, 1, 1 },
@@ -609,6 +611,7 @@ _slang_is_noop(const slang_operation *oper)
/**
* Produce inline code for a call to an assembly instruction.
+ * XXX Note: children are passed as asm args in-order, not by name!
*/
static slang_operation *
slang_inline_asm_function(slang_assemble_ctx *A,
@@ -2299,19 +2302,17 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
_slang_gen_operation(A, &oper->children[0]),
_slang_gen_operation(A, &oper->children[1]));
case SLANG_OPER_LESS:
- /* child[0] < child[1] ----> child[1] > child[0] */
- return new_node2(IR_SGT,
- _slang_gen_operation(A, &oper->children[1]),
- _slang_gen_operation(A, &oper->children[0]));
+ return new_node2(IR_SLT,
+ _slang_gen_operation(A, &oper->children[0]),
+ _slang_gen_operation(A, &oper->children[1]));
case SLANG_OPER_GREATEREQUAL:
return new_node2(IR_SGE,
_slang_gen_operation(A, &oper->children[0]),
_slang_gen_operation(A, &oper->children[1]));
case SLANG_OPER_LESSEQUAL:
- /* child[0] <= child[1] ----> child[1] >= child[0] */
- return new_node2(IR_SGE,
- _slang_gen_operation(A, &oper->children[1]),
- _slang_gen_operation(A, &oper->children[0]));
+ return new_node2(IR_SLE,
+ _slang_gen_operation(A, &oper->children[0]),
+ _slang_gen_operation(A, &oper->children[1]));
case SLANG_OPER_ADD:
{
slang_ir_node *n;
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index c90bf34183..8ad61d8a3b 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -95,6 +95,8 @@ static const slang_ir_info IrInfo[] = {
{ IR_SNEQUAL, "IR_SNEQUAL", OPCODE_SNE, 4, 2 },
{ IR_SGE, "IR_SGE", OPCODE_SGE, 4, 2 },
{ IR_SGT, "IR_SGT", OPCODE_SGT, 4, 2 },
+ { IR_SLE, "IR_SLE", OPCODE_SLE, 4, 2 },
+ { IR_SLT, "IR_SLT", OPCODE_SLT, 4, 2 },
{ IR_POW, "IR_POW", OPCODE_POW, 1, 2 },
/* unary ops */
{ IR_I_TO_F, "IR_I_TO_F", OPCODE_NOP, 1, 1 },
@@ -1495,6 +1497,8 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
case IR_SNEQUAL:
case IR_SGE:
case IR_SGT:
+ case IR_SLE:
+ case IR_SLT:
case IR_POW:
case IR_EXP:
case IR_EXP2:
diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h
index d2985eabfe..b733d100dd 100644
--- a/src/mesa/shader/slang/slang_ir.h
+++ b/src/mesa/shader/slang/slang_ir.h
@@ -84,6 +84,8 @@ typedef enum
IR_SNEQUAL, /* Set if args are not equal */
IR_SGE, /* Set if greater or equal */
IR_SGT, /* Set if greater than */
+ IR_SLE, /* Set if less or equal */
+ IR_SLT, /* Set if less than */
IR_POW, /* x^y */
IR_EXP, /* e^x */
IR_EXP2, /* 2^x */