summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-02 17:07:30 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-02 17:07:30 -0600
commit066ccec49485f0b6d314ef555e4b2a68f68c3804 (patch)
treedcefe22584be732027a39fc6d059aca190b867b3 /src
parentca34912bf7e57a01b180a3bb3b6e36331f442558 (diff)
Separate TGSI_OPCODE_KIL and TGSI_OPCODE_KILP (predicated).
These correspond to the NV and ARB-style fragment program KIL instructions. The former is really supposed to examine the NV condition codes but Mesa's GLSL compiler always emits unconditional KIL instructions.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/mesa/pipe/tgsi/exec/tgsi_dump.c6
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.c18
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_token.h7
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c6
4 files changed, 31 insertions, 6 deletions
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.c b/src/mesa/pipe/tgsi/exec/tgsi_dump.c
index 0b273cd6e5..c179659aee 100755
--- a/src/mesa/pipe/tgsi/exec/tgsi_dump.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_dump.c
@@ -270,7 +270,7 @@ static const char *TGSI_OPCODES[] =
"OPCODE_COS",
"OPCODE_DDX",
"OPCODE_DDY",
- "OPCODE_KIL",
+ "OPCODE_KILP",
"OPCODE_PK2H",
"OPCODE_PK2US",
"OPCODE_PK4B",
@@ -364,6 +364,7 @@ static const char *TGSI_OPCODES[] =
"OPCODE_IFC",
"OPCODE_BREAKC",
"OPCODE_TXP",
+ "OPCODE_KIL",
"OPCODE_END"
};
@@ -408,7 +409,7 @@ static const char *TGSI_OPCODES_SHORT[] =
"COS",
"DDX",
"DDY",
- "KIL",
+ "KILP",
"PK2H",
"PK2US",
"PK4B",
@@ -502,6 +503,7 @@ static const char *TGSI_OPCODES_SHORT[] =
"IFC",
"BREAKC",
"TXP",
+ "KIL",
"END"
};
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
index edd46100c5..b88620d71d 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
@@ -1129,8 +1129,12 @@ store_dest(
store_dest (mach, VAL, &inst->FullDstRegisters[INDEX], inst, CHAN )
+/**
+ * Execute ARB-style KIL which is predicated by a src register.
+ * Kill fragment if any of the four values is less than zero.
+ */
static void
-exec_kil (struct tgsi_exec_machine *mach,
+exec_kilp(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst)
{
GLuint uniquemask;
@@ -1168,6 +1172,14 @@ exec_kil (struct tgsi_exec_machine *mach,
}
+static void
+exec_kil(struct tgsi_exec_machine *mach,
+ const struct tgsi_full_instruction *inst)
+{
+ /* for enabled ExecMask bits, set the killed bit */
+ mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= mach->ExecMask;
+}
+
/*
@@ -1782,6 +1794,10 @@ exec_instruction(
}
break;
+ case TGSI_OPCODE_KILP:
+ exec_kilp (mach, inst);
+ break;
+
case TGSI_OPCODE_KIL:
exec_kil (mach, inst);
break;
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_token.h b/src/mesa/pipe/tgsi/exec/tgsi_token.h
index d2fa813815..8d5992facb 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_token.h
+++ b/src/mesa/pipe/tgsi/exec/tgsi_token.h
@@ -236,7 +236,7 @@ struct tgsi_immediate_float32
#define TGSI_OPCODE_EX2 TGSI_OPCODE_EXPBASE2
#define TGSI_OPCODE_FLR TGSI_OPCODE_FLOOR
#define TGSI_OPCODE_FRC TGSI_OPCODE_FRAC
-#define TGSI_OPCODE_KIL 39
+#define TGSI_OPCODE_KILP 39 /* predicated kill */
#define TGSI_OPCODE_LG2 TGSI_OPCODE_LOGBASE2
/* TGSI_OPCODE_LIT */
#define TGSI_OPCODE_LRP TGSI_OPCODE_LERP
@@ -1100,9 +1100,10 @@ struct tgsi_immediate_float32
/* TGSI_OPCODE_MOVA */
/* TGSI_OPCODE_LOGP */
-#define TGSI_OPCODE_END 133 /* aka HALT */
+#define TGSI_OPCODE_KIL 133 /* unpredicated kill */
+#define TGSI_OPCODE_END 134 /* aka HALT */
-#define TGSI_OPCODE_LAST 134
+#define TGSI_OPCODE_LAST 135
#define TGSI_SAT_NONE 0 /* do not saturate */
#define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
index 431b82a98f..2a2a1a0430 100644
--- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
+++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
@@ -336,6 +336,12 @@ compile_instruction(
fullinst->Instruction.Opcode = TGSI_OPCODE_INT;
break;
case OPCODE_KIL:
+ /* predicated w/ a register */
+ fullinst->Instruction.Opcode = TGSI_OPCODE_KILP;
+ break;
+ case OPCODE_KIL_NV:
+ /* unpredicated */
+ assert(inst->DstReg.CondMask == COND_TR);
fullinst->Instruction.Opcode = TGSI_OPCODE_KIL;
break;
case OPCODE_LG2: