glsl: Make sure that we don't put too many bitfields in ast_type_qualifier.
authorEric Anholt <eric@anholt.net>
Wed, 12 Jun 2013 20:46:57 +0000 (13:46 -0700)
committerPaul Berry <stereotype441@gmail.com>
Fri, 2 Aug 2013 03:23:28 +0000 (20:23 -0700)
We do some tests of qualifiers using a union containing an int and the
struct full of bitfields, so make sure the bitfields don't spill
outside the int.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast_to_hir.cpp

index 10c5425e8ee70e9d0d7e59aea73c4180015afaf8..f3c49d2271dfa395a90f5b1a6ed121938c501e98 100644 (file)
@@ -1936,6 +1936,8 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
                                 bool ubo_qualifiers_valid,
                                  bool is_parameter)
 {
+   STATIC_ASSERT(sizeof(qual->flags.q) <= sizeof(qual->flags.i));
+
    if (qual->flags.q.invariant) {
       if (var->used) {
         _mesa_glsl_error(loc, state,