*/
glsl_interp_qualifier determine_interpolation_mode(bool flat_shade);
+ /**
+ * Determine whether or not a variable is part of a uniform block.
+ */
+ inline bool is_in_uniform_block() const
+ {
+ return this->mode == ir_var_uniform && this->uniform_block != -1;
+ }
+
/**
* Declared type of the variable
*/
ir_variable *var)
{
ubo_var = NULL;
- if (var->uniform_block != -1) {
+ if (var->is_in_uniform_block()) {
struct gl_uniform_block *block =
&shader->UniformBlocks[var->uniform_block];
foreach_list(node, shader->ir) {
ir_variable *const var = ((ir_instruction *) node)->as_variable();
- if ((var == NULL) || (var->uniform_block == -1))
+ if ((var == NULL) || !var->is_in_uniform_block())
continue;
assert(var->mode == ir_var_uniform);
* will not be eliminated. Since we always do std140, just
* don't resize arrays in UBOs.
*/
- if (var->uniform_block != -1)
+ if (var->is_in_uniform_block())
continue;
unsigned int size = var->max_array_access;
return;
ir_variable *var = deref->variable_referenced();
- if (!var || var->uniform_block == -1)
+ if (!var || !var->is_in_uniform_block())
return;
mem_ctx = ralloc_parent(*rvalue);
if (entry->var->mode == ir_var_uniform &&
(uniform_locations_assigned ||
entry->var->constant_value ||
- entry->var->uniform_block != -1))
+ entry->var->is_in_uniform_block()))
continue;
entry->var->remove();
* ir_binop_ubo_load expressions and not ir_dereference_variable for UBO
* variables, so no need for them to be in variable_ht.
*/
- if (ir->uniform_block != -1)
+ if (ir->is_in_uniform_block())
return;
if (dispatch_width == 16) {
* ir_binop_ubo_load expressions and not ir_dereference_variable for UBO
* variables, so no need for them to be in variable_ht.
*/
- if (ir->uniform_block != -1)
+ if (ir->is_in_uniform_block())
return;
/* Track how big the whole uniform variable is, in case we need to put a
ir_variable *var = ((ir_instruction *) node)->as_variable();
if ((var == NULL) || (var->mode != ir_var_uniform)
- || var->uniform_block != -1 || (strncmp(var->name, "gl_", 3) == 0))
+ || var->is_in_uniform_block() || (strncmp(var->name, "gl_", 3) == 0))
continue;
add.process(var);