summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/tgsi
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-08-14 00:20:52 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-08-14 00:20:52 +1000
commit56f5c0c001c476b813c94d071ac880fbe8d9768b (patch)
tree257e2d7c3870a741ad30ea7bc38621d9eb728483 /src/gallium/auxiliary/tgsi
parentdf4228deddea36b9d5b41ea395a216137e046205 (diff)
parentd8be393cb60d908f98f0edb74c1c7964e8f690fe (diff)
Merge remote branch 'origin/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/gallium/auxiliary/tgsi')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c38
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sse2.c16
2 files changed, 46 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 8b430548bc..c4ba667d32 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -393,10 +393,18 @@ micro_div(
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1 )
{
- dst->f[0] = src0->f[0] / src1->f[0];
- dst->f[1] = src0->f[1] / src1->f[1];
- dst->f[2] = src0->f[2] / src1->f[2];
- dst->f[3] = src0->f[3] / src1->f[3];
+ if (src1->f[0] != 0) {
+ dst->f[0] = src0->f[0] / src1->f[0];
+ }
+ if (src1->f[1] != 0) {
+ dst->f[1] = src0->f[1] / src1->f[1];
+ }
+ if (src1->f[2] != 0) {
+ dst->f[2] = src0->f[2] / src1->f[2];
+ }
+ if (src1->f[3] != 0) {
+ dst->f[3] = src0->f[3] / src1->f[3];
+ }
}
static void
@@ -1181,8 +1189,8 @@ store_dest(
* Kill fragment if any of the four values is less than zero.
*/
static void
-exec_kilp(struct tgsi_exec_machine *mach,
- const struct tgsi_full_instruction *inst)
+exec_kil(struct tgsi_exec_machine *mach,
+ const struct tgsi_full_instruction *inst)
{
uint uniquemask;
uint chan_index;
@@ -1218,6 +1226,21 @@ exec_kilp(struct tgsi_exec_machine *mach,
mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= kilmask;
}
+/**
+ * Execute NVIDIA-style KIL which is predicated by a condition code.
+ * Kill fragment if the condition code is TRUE.
+ */
+static void
+exec_kilp(struct tgsi_exec_machine *mach,
+ const struct tgsi_full_instruction *inst)
+{
+ uint kilmask = 0; /* bit 0 = pixel 0, bit 1 = pixel 1, etc */
+
+ /* TODO: build kilmask from CC mask */
+
+ mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= kilmask;
+}
+
/*
* Fetch a texel using STR texture coordinates.
@@ -1963,8 +1986,7 @@ exec_instruction(
break;
case TGSI_OPCODE_KIL:
- /* for enabled ExecMask bits, set the killed bit */
- mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= mach->ExecMask;
+ exec_kil (mach, inst);
break;
case TGSI_OPCODE_PK2H:
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
index 0cb1f11ef2..47dc06faf6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
@@ -1096,6 +1096,15 @@ emit_kil(
x86_make_reg( file_REG32, reg_AX ) );
}
+
+static void
+emit_kilp(
+ struct x86_function *func )
+{
+ /* XXX todo / fix me */
+}
+
+
static void
emit_setcc(
struct x86_function *func,
@@ -1609,7 +1618,14 @@ emit_instruction(
return 0;
break;
+ case TGSI_OPCODE_KILP:
+ /* predicated kill */
+ emit_kilp( func );
+ return 0; /* XXX fix me */
+ break;
+
case TGSI_OPCODE_KIL:
+ /* conditional kill */
emit_kil( func, &inst->FullSrcRegisters[0] );
break;