Mesa (master): glsl: Fix incorrect assertion

Ian Romanick idr at kemper.freedesktop.org
Tue Oct 12 19:57:59 UTC 2010


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Tue Oct 12 12:50:29 2010 -0700

glsl: Fix incorrect assertion

This assertion was added in commit f1c1ee11, but it did not notice
that the array is accessed with 'size-1' instead of 'size'.  As a
result, the assertion was off by one.  This caused failures in at
least glsl-orangebook-ch06-bump.

---

 src/mesa/program/ir_to_mesa.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index be162e7..da0d810 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -311,7 +311,7 @@ swizzle_for_size(int size)
       MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W),
    };
 
-   assert(size < 4);
+   assert((size >= 1) && (size <= 4));
    return size_swizzles[size - 1];
 }
 




More information about the mesa-commit mailing list