glsl: Check the size of ir_print_visitor's mode[] array with STATIC_ASSERT.
ir_print_visitor::visit(ir_variable *)'s mode[] array needs to match the declaration of the enum ir_variable_mode. It's hard to verify that at compile time, but at least we can use a STATIC_ASSERT to make sure it's the right size. This required adding ir_var_mode_count to the enum.
This commit is contained in:
@@ -273,7 +273,8 @@ enum ir_variable_mode {
|
||||
ir_var_function_inout,
|
||||
ir_var_const_in, /**< "in" param that must be a constant expression */
|
||||
ir_var_system_value, /**< Ex: front-face, instance-id, etc. */
|
||||
ir_var_temporary /**< Temporary variable generated during compilation. */
|
||||
ir_var_temporary, /**< Temporary variable generated during compilation. */
|
||||
ir_var_mode_count /**< Number of variable modes */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -150,6 +150,7 @@ void ir_print_visitor::visit(ir_variable *ir)
|
||||
const char *const mode[] = { "", "uniform ", "shader_in ", "shader_out ",
|
||||
"in ", "out ", "inout ",
|
||||
"const_in ", "sys ", "temporary " };
|
||||
STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count);
|
||||
const char *const interp[] = { "", "smooth", "flat", "noperspective" };
|
||||
STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_QUALIFIER_COUNT);
|
||||
|
||||
|
Reference in New Issue
Block a user