summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-04-10 15:25:18 -0700
committerZack Rusin <[email protected]>2013-04-16 23:38:46 -0700
commit88db6f0a73cd988b14e95e5f506b4e5ac355f065 (patch)
treed7362df706fc849127b4ff45a3e38603e54f16ea /src/gallium/auxiliary
parentb8f6858fcb762b47ca2ad30efd286bd203042f17 (diff)
tgsi/exec: fix the udiv and umod instructions
Same as with llvmpipe: we can't be divind/moding by zero and we need to make sure that dividing/moding by zero produces 0xffffffff. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 05f749ed6c1..3de15730e75 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -3445,10 +3445,10 @@ micro_udiv(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1)
{
- dst->u[0] = src0->u[0] / src1->u[0];
- dst->u[1] = src0->u[1] / src1->u[1];
- dst->u[2] = src0->u[2] / src1->u[2];
- dst->u[3] = src0->u[3] / src1->u[3];
+ dst->u[0] = src1->u[0] ? src0->u[0] / src1->u[0] : ~0u;
+ dst->u[1] = src1->u[1] ? src0->u[1] / src1->u[1] : ~0u;
+ dst->u[2] = src1->u[2] ? src0->u[2] / src1->u[2] : ~0u;
+ dst->u[3] = src1->u[3] ? src0->u[3] / src1->u[3] : ~0u;
}
static void
@@ -3490,10 +3490,10 @@ micro_umod(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1)
{
- dst->u[0] = src0->u[0] % src1->u[0];
- dst->u[1] = src0->u[1] % src1->u[1];
- dst->u[2] = src0->u[2] % src1->u[2];
- dst->u[3] = src0->u[3] % src1->u[3];
+ dst->u[0] = src1->u[0] ? src0->u[0] % src1->u[0] : ~0u;
+ dst->u[1] = src1->u[1] ? src0->u[1] % src1->u[1] : ~0u;
+ dst->u[2] = src1->u[2] ? src0->u[2] % src1->u[2] : ~0u;
+ dst->u[3] = src1->u[3] ? src0->u[3] % src1->u[3] : ~0u;
}
static void