Mesa (master): tgsi: added debugging code to catch divide by zero

Brian Paul brianp at kemper.freedesktop.org
Wed Feb 3 15:50:41 UTC 2010


Module: Mesa
Branch: master
Commit: f8d824e09a54871df899f368ebaadc9a4e5b62ff
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8d824e09a54871df899f368ebaadc9a4e5b62ff

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Feb  3 08:50:32 2010 -0700

tgsi: added debugging code to catch divide by zero

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index c0d1b01..f7a1bb7 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -264,6 +264,12 @@ static void
 micro_rcp(union tgsi_exec_channel *dst,
           const union tgsi_exec_channel *src)
 {
+#if 0 /* for debugging */
+   assert(src->f[0] != 0.0f);
+   assert(src->f[1] != 0.0f);
+   assert(src->f[2] != 0.0f);
+   assert(src->f[3] != 0.0f);
+#endif
    dst->f[0] = 1.0f / src->f[0];
    dst->f[1] = 1.0f / src->f[1];
    dst->f[2] = 1.0f / src->f[2];
@@ -284,6 +290,12 @@ static void
 micro_rsq(union tgsi_exec_channel *dst,
           const union tgsi_exec_channel *src)
 {
+#if 0 /* for debugging */
+   assert(src->f[0] != 0.0f);
+   assert(src->f[1] != 0.0f);
+   assert(src->f[2] != 0.0f);
+   assert(src->f[3] != 0.0f);
+#endif
    dst->f[0] = 1.0f / sqrtf(fabsf(src->f[0]));
    dst->f[1] = 1.0f / sqrtf(fabsf(src->f[1]));
    dst->f[2] = 1.0f / sqrtf(fabsf(src->f[2]));




More information about the mesa-commit mailing list