Mesa (mesa_7_6_branch): glsl: add support for CMP instruction

Brian Paul brianp at kemper.freedesktop.org
Wed Sep 30 01:00:32 UTC 2009


Module: Mesa
Branch: mesa_7_6_branch
Commit: 3c794e45b02c66ce3f52fe359f733e4d7d2ce315
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c794e45b02c66ce3f52fe359f733e4d7d2ce315

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Sep 29 18:51:49 2009 -0600

glsl: add support for CMP instruction

---

 src/mesa/shader/slang/slang_codegen.c |    1 +
 src/mesa/shader/slang/slang_emit.c    |    1 +
 src/mesa/shader/slang/slang_ir.c      |    1 +
 src/mesa/shader/slang/slang_ir.h      |    1 +
 4 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 703af9f..344dfdc 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -422,6 +422,7 @@ static slang_asm_info AsmInfo[] = {
    { "vec4_lrp", IR_LRP, 1, 3 },
    { "vec4_min", IR_MIN, 1, 2 },
    { "vec4_max", IR_MAX, 1, 2 },
+   { "vec4_cmp", IR_CMP, 1, 3 },
    { "vec4_clamp", IR_CLAMP, 1, 3 },
    { "vec4_seq", IR_SEQUAL, 1, 2 },
    { "vec4_sne", IR_SNEQUAL, 1, 2 },
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index 3f455e0..3af301e 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -2287,6 +2287,7 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
    case IR_POW:
    /* trinary operators */
    case IR_LRP:
+   case IR_CMP:
       return emit_arith(emitInfo, n);
 
    case IR_EQUAL:
diff --git a/src/mesa/shader/slang/slang_ir.c b/src/mesa/shader/slang/slang_ir.c
index 1c7f747..6260350 100644
--- a/src/mesa/shader/slang/slang_ir.c
+++ b/src/mesa/shader/slang/slang_ir.c
@@ -80,6 +80,7 @@ static const slang_ir_info IrInfo[] = {
    { IR_NOISE4, "IR_NOISE4", OPCODE_NOISE4, 1, 1 },
 
    /* other */
+   { IR_CMP, "IR_CMP", OPCODE_CMP, 4, 3 },  /* compare/select */
    { IR_SEQ, "IR_SEQ", OPCODE_NOP, 0, 0 },
    { IR_SCOPE, "IR_SCOPE", OPCODE_NOP, 0, 0 },
    { IR_LABEL, "IR_LABEL", OPCODE_NOP, 0, 0 },
diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h
index e796693..166b4e8 100644
--- a/src/mesa/shader/slang/slang_ir.h
+++ b/src/mesa/shader/slang/slang_ir.h
@@ -91,6 +91,7 @@ typedef enum
    IR_CLAMP,
    IR_MIN,
    IR_MAX,
+   IR_CMP,     /* = (op0 < 0) ? op1 : op2 */
    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) */




More information about the mesa-commit mailing list