From a4be1048870446a45a4a14178b47e2cb1a0d92d6 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 15 Dec 2006 17:05:53 -0700 Subject: start implementing relational operators --- src/mesa/shader/slang/slang_codegen.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/mesa/shader/slang/slang_codegen.c') diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 611b6145f57..f62ff01f2dd 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -963,10 +963,32 @@ slang_assemble_operation(slang_assemble_ctx * A, slang_operation *oper) ); } break; + case slang_oper_equal: + return new_node(IR_SEQUAL, + slang_assemble_operation(A, &oper->children[0]), + slang_assemble_operation(A, &oper->children[1])); + case slang_oper_notequal: + return new_node(IR_SNEQUAL, + slang_assemble_operation(A, &oper->children[0]), + slang_assemble_operation(A, &oper->children[1])); + case slang_oper_greater: + return new_node(IR_SGT, + slang_assemble_operation(A, &oper->children[0]), + slang_assemble_operation(A, &oper->children[1])); case slang_oper_less: - return new_node(IR_LESS, + /* child[0] < child[1] ----> child[1] > child[0] */ + return new_node(IR_SGT, + slang_assemble_operation(A, &oper->children[1]), + slang_assemble_operation(A, &oper->children[0])); + case slang_oper_greaterequal: + return new_node(IR_SGE, slang_assemble_operation(A, &oper->children[0]), slang_assemble_operation(A, &oper->children[1])); + case slang_oper_lessequal: + /* child[0] <= child[1] ----> child[1] >= child[0] */ + return new_node(IR_SGE, + slang_assemble_operation(A, &oper->children[1]), + slang_assemble_operation(A, &oper->children[0])); case slang_oper_add: { slang_ir_node *n; -- cgit v1.2.3