tgsi: added debugging code to catch divide by zero
authorBrian Paul <brianp@vmware.com>
Wed, 3 Feb 2010 15:50:32 +0000 (08:50 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 3 Feb 2010 15:50:32 +0000 (08:50 -0700)
src/gallium/auxiliary/tgsi/tgsi_exec.c

index c0d1b01183addd3f99961a8238c9f479a0b997fc..f7a1bb74a9d12f9858536c49dd67f84459404758 100644 (file)
@@ -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]));