glsl: Fix ir_print_visitor's handling of interpolation qualifiers.
authorPaul Berry <stereotype441@gmail.com>
Sun, 7 Apr 2013 02:16:58 +0000 (19:16 -0700)
committerPaul Berry <stereotype441@gmail.com>
Tue, 9 Apr 2013 17:19:11 +0000 (10:19 -0700)
This patch updates the interp[] array to match the enum
glsl_interp_qualifier.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
v2: Add a STATIC_ASSERT to make sure the array is the correct size.
This required adding INTERP_QUALIFIER_COUNT to the enum.

src/glsl/ir_print_visitor.cpp
src/mesa/main/mtypes.h

index 597d2813ff216f88c27a7846aa0d0bd9ef408d84..fb0dd08f810b74352a2bcc1c52a45747da72573c 100644 (file)
@@ -24,6 +24,7 @@
 #include "ir_print_visitor.h"
 #include "glsl_types.h"
 #include "glsl_parser_extras.h"
+#include "main/macros.h"
 #include "program/hash_table.h"
 
 static void print_type(const glsl_type *t);
@@ -149,7 +150,8 @@ void ir_print_visitor::visit(ir_variable *ir)
    const char *const mode[] = { "", "uniform ", "shader_in ", "shader_out ",
                                 "in ", "out ", "inout ",
                                "const_in ", "sys ", "temporary " };
-   const char *const interp[] = { "", "flat", "noperspective" };
+   const char *const interp[] = { "", "smooth", "flat", "noperspective" };
+   STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_QUALIFIER_COUNT);
 
    printf("(%s%s%s%s) ",
          cent, inv, mode[ir->mode], interp[ir->interpolation]);
index 008f68bda08d12abcc2b21b288946fa54abca35b..e46fa39ef5d3809b4b4dffc521792606cb79d4aa 100644 (file)
@@ -1829,7 +1829,8 @@ enum glsl_interp_qualifier
    INTERP_QUALIFIER_NONE = 0,
    INTERP_QUALIFIER_SMOOTH,
    INTERP_QUALIFIER_FLAT,
-   INTERP_QUALIFIER_NOPERSPECTIVE
+   INTERP_QUALIFIER_NOPERSPECTIVE,
+   INTERP_QUALIFIER_COUNT /**< Number of interpolation qualifiers */
 };