From e6aeb24b23097024ba60e1c49239a18692f781e1 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 22 Mar 2007 16:07:14 -0600 Subject: Overhaul emit_compare() function. Previously, comparing vec2, vec3, vec4 was broken. Added IR_EQUAL, IR_NOTEQUAL nodes/operators to compute boolean equality/inequality vs. IR_SEQUAL/IR_SNEQUAL which work component-wise. Use IR_EQUAL/IR_NOTEQUAL for the == and != operators. To compute vec4 equality, use SNE, DP4, SEQ instruction sequence. --- src/mesa/shader/slang/slang_ir.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/mesa/shader/slang/slang_ir.h') diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h index 3c5526e..cc9df69 100644 --- a/src/mesa/shader/slang/slang_ir.h +++ b/src/mesa/shader/slang/slang_ir.h @@ -69,6 +69,8 @@ typedef enum IR_CONT_IF_FALSE, IR_MOVE, + + /* vector ops: */ IR_ADD, IR_SUB, IR_MUL, @@ -80,12 +82,12 @@ typedef enum IR_CLAMP, IR_MIN, IR_MAX, - IR_SEQUAL, /* Set if args are equal */ - 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_SEQUAL, /* Set if args are equal (vector) */ + IR_SNEQUAL, /* Set if args are not equal (vector) */ + IR_SGE, /* Set if greater or equal (vector) */ + IR_SGT, /* Set if greater than (vector) */ + IR_SLE, /* Set if less or equal (vector) */ + IR_SLT, /* Set if less than (vector) */ IR_POW, /* x^y */ IR_EXP, /* e^x */ IR_EXP2, /* 2^x */ @@ -104,7 +106,10 @@ typedef enum IR_NOISE2, /* noise(x, y) */ IR_NOISE3, /* noise(x, y, z) */ IR_NOISE4, /* noise(x, y, z, w) */ - IR_NOT, /* logical not */ + + IR_EQUAL, /* boolean equality */ + IR_NOTEQUAL,/* boolean inequality */ + IR_NOT, /* boolean not */ IR_VAR, /* variable reference */ IR_VAR_DECL,/* var declaration */ -- cgit v1.1