[Mesa-dev] [PATCH 05/17] glsl: Add a is_ubo_variable bit to ir_variable class
Vincent Lejeune
vljn at ovi.com
Sun Dec 25 10:17:04 PST 2011
A variable in a UBO is basically an uniform, and optimisation pass should sees them as
such. ir_variable::mode for variable in an uniform is thus set to ir_var_uniform.
However it is good to be able to quickly discriminate classic uniform vs variable in an
UBO so another flag is added to ir_variable class.
---
src/glsl/ir.cpp | 1 +
src/glsl/ir.h | 6 ++++++
src/glsl/ir_clone.cpp | 1 +
3 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index a5eca5a..bf11e4f 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1335,6 +1335,7 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
this->pixel_center_integer = false;
this->depth_layout = ir_depth_layout_none;
this->used = false;
+ this->is_ubo_variable = false;
if (type && type->base_type == GLSL_TYPE_SAMPLER)
this->read_only = true;
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 1faae3c..dc77dec 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -398,6 +398,12 @@ public:
int location;
/**
+ * True if the variable is defined in the scope of a shader range Uniform
+ * Buffer Object.
+ */
+ bool is_ubo_variable;
+
+ /**
* Built-in state that backs this uniform
*
* Once set at variable creation, \c state_slots must remain invariant.
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index c63615c..479f258 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -52,6 +52,7 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const
var->explicit_location = this->explicit_location;
var->has_initializer = this->has_initializer;
var->depth_layout = this->depth_layout;
+ var->is_ubo_variable = this->is_ubo_variable;
var->num_state_slots = this->num_state_slots;
if (this->state_slots) {
--
1.7.7
More information about the mesa-dev
mailing list