Mesa (main): tgsi_exec: Fix inf/nan handling for divide by zero.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 7 03:04:36 UTC 2022
Module: Mesa
Branch: main
Commit: 594d3982f759a55fbeddcffb47b19c8ec32ca7ad
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=594d3982f759a55fbeddcffb47b19c8ec32ca7ad
Author: Emma Anholt <emma at anholt.net>
Date: Wed Jun 1 12:49:59 2022 -0700
tgsi_exec: Fix inf/nan handling for divide by zero.
For RCP and for DDIV, we do division without any src1 != 0 checks, and we
should do the same here so that we get infs or nans as appropriate instead
of undefined.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index ae1daa6dca2..ca92a7714d4 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1288,18 +1288,10 @@ micro_div(
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1 )
{
- 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];
- }
+ 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];
}
static void
More information about the mesa-commit
mailing list