[Mesa-dev] [PATCH v3 (part1) 03/26] mesa: rename is_in_uniform_block to is_in_buffer_block
Iago Toral Quiroga
itoral at igalia.com
Fri Jul 10 03:13:22 PDT 2015
Since this now checks if a variable is inside a uniform or a shader
storage block.
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/glsl/ast_to_hir.cpp | 2 +-
src/glsl/ir.h | 5 +++--
src/glsl/link_uniform_block_active_visitor.cpp | 6 +++---
src/glsl/link_uniform_initializers.cpp | 4 ++--
src/glsl/link_uniforms.cpp | 6 +++---
src/glsl/linker.cpp | 2 +-
src/glsl/lower_ubo_reference.cpp | 2 +-
src/glsl/opt_dead_code.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 2 +-
src/mesa/program/ir_to_mesa.cpp | 2 +-
10 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index de6a86d..00f35eb 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2007,7 +2007,7 @@ validate_matrix_layout_for_type(struct _mesa_glsl_parse_state *state,
const glsl_type *type,
ir_variable *var)
{
- if (var && !var->is_in_uniform_block()) {
+ if (var && !var->is_in_buffer_block()) {
/* Layout qualifiers may only apply to interface blocks and fields in
* them.
*/
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 2b9533a..1c7829b 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -442,9 +442,10 @@ public:
glsl_interp_qualifier determine_interpolation_mode(bool flat_shade);
/**
- * Determine whether or not a variable is part of a uniform block.
+ * Determine whether or not a variable is part of a uniform or
+ * shader storage block.
*/
- inline bool is_in_uniform_block() const
+ inline bool is_in_buffer_block() const
{
return (this->data.mode == ir_var_uniform ||
this->data.mode == ir_var_shader_storage) &&
diff --git a/src/glsl/link_uniform_block_active_visitor.cpp b/src/glsl/link_uniform_block_active_visitor.cpp
index 292cde3..ddfd2b2 100644
--- a/src/glsl/link_uniform_block_active_visitor.cpp
+++ b/src/glsl/link_uniform_block_active_visitor.cpp
@@ -73,7 +73,7 @@ process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var)
ir_visitor_status
link_uniform_block_active_visitor::visit(ir_variable *var)
{
- if (!var->is_in_uniform_block())
+ if (!var->is_in_buffer_block())
return visit_continue;
const glsl_type *const block_type = var->is_interface_instance()
@@ -124,7 +124,7 @@ link_uniform_block_active_visitor::visit_enter(ir_dereference_array *ir)
* function.
*/
if (var == NULL
- || !var->is_in_uniform_block()
+ || !var->is_in_buffer_block()
|| !var->is_interface_instance())
return visit_continue;
@@ -194,7 +194,7 @@ link_uniform_block_active_visitor::visit(ir_dereference_variable *ir)
{
ir_variable *var = ir->var;
- if (!var->is_in_uniform_block())
+ if (!var->is_in_buffer_block())
return visit_continue;
assert(!var->is_interface_instance() || !var->type->is_array());
diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp
index 204acfa..d1f904e 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -267,7 +267,7 @@ link_set_uniform_initializers(struct gl_shader_program *prog,
if (type->without_array()->is_sampler()) {
linker::set_sampler_binding(prog, var->name, var->data.binding);
- } else if (var->is_in_uniform_block()) {
+ } else if (var->is_in_buffer_block()) {
const glsl_type *const iface_type = var->get_interface_type();
/* If the variable is an array and it is an interface instance,
@@ -280,7 +280,7 @@ link_set_uniform_initializers(struct gl_shader_program *prog,
* float f[4];
* };
*
- * In this case "f" would pass is_in_uniform_block (above) and
+ * In this case "f" would pass is_in_buffer_block (above) and
* type->is_array(), but it will fail is_interface_instance().
*/
if (var->is_interface_instance() && var->type->is_array()) {
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 11ae06f..5fdf25e 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -298,7 +298,7 @@ public:
void process(ir_variable *var)
{
- this->is_ubo_var = var->is_in_uniform_block();
+ this->is_ubo_var = var->is_in_buffer_block();
if (var->is_interface_instance())
program_resource_visitor::process(var->get_interface_type(),
var->get_interface_type()->name);
@@ -431,7 +431,7 @@ public:
field_counter = 0;
ubo_block_index = -1;
- if (var->is_in_uniform_block()) {
+ if (var->is_in_buffer_block()) {
if (var->is_interface_instance() && var->type->is_array()) {
unsigned l = strlen(var->get_interface_type()->name);
@@ -763,7 +763,7 @@ link_update_uniform_buffer_variables(struct gl_shader *shader)
foreach_in_list(ir_instruction, node, shader->ir) {
ir_variable *const var = node->as_variable();
- if ((var == NULL) || !var->is_in_uniform_block())
+ if ((var == NULL) || !var->is_in_buffer_block())
continue;
assert(var->data.mode == ir_var_uniform);
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index b7a783c..3005b70 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1873,7 +1873,7 @@ update_array_sizes(struct gl_shader_program *prog)
* locations assigned based on the declaration ordering and
* sizes, array compaction would mess that up.
*/
- if (var->is_in_uniform_block() || var->type->contains_atomic())
+ if (var->is_in_buffer_block() || var->type->contains_atomic())
continue;
unsigned int size = var->data.max_array_access;
diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
index 4ea4ccb..a61ff29 100644
--- a/src/glsl/lower_ubo_reference.cpp
+++ b/src/glsl/lower_ubo_reference.cpp
@@ -228,7 +228,7 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue)
return;
ir_variable *var = deref->variable_referenced();
- if (!var || !var->is_in_uniform_block())
+ if (!var || !var->is_in_buffer_block())
return;
mem_ctx = ralloc_parent(*rvalue);
diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp
index f45bf5d..7b4730a 100644
--- a/src/glsl/opt_dead_code.cpp
+++ b/src/glsl/opt_dead_code.cpp
@@ -115,7 +115,7 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
* If the variable is in a uniform block with one of those
* layouts, do not eliminate it.
*/
- if (entry->var->is_in_uniform_block()) {
+ if (entry->var->is_in_buffer_block()) {
const glsl_type *const block_type =
entry->var->is_interface_instance()
? entry->var->type : entry->var->get_interface_type();
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index c9c2661..67f2b5c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1063,7 +1063,7 @@ vec4_visitor::visit(ir_variable *ir)
* Some uniforms, such as samplers and atomic counters, have no actual
* storage, so we should ignore them.
*/
- if (ir->is_in_uniform_block() || type_size(ir->type) == 0)
+ if (ir->is_in_buffer_block() || type_size(ir->type) == 0)
return;
/* Track how big the whole uniform variable is, in case we need to put a
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 0b2eb12..2bd212e 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2384,7 +2384,7 @@ _mesa_generate_parameters_list_for_uniforms(struct gl_shader_program
ir_variable *var = node->as_variable();
if ((var == NULL) || (var->data.mode != ir_var_uniform)
- || var->is_in_uniform_block() || (strncmp(var->name, "gl_", 3) == 0))
+ || var->is_in_buffer_block() || (strncmp(var->name, "gl_", 3) == 0))
continue;
add.process(var);
--
1.9.1
More information about the mesa-dev
mailing list