[Mesa-dev] [PATCH 5/9] glsl: change IR to add UBO information

vlj vljn at ovi.com
Fri Sep 23 06:53:10 PDT 2011


---
 src/glsl/ir.h              |    2 ++
 src/glsl/ir_clone.cpp      |    2 ++
 src/glsl/opt_dead_code.cpp |    2 ++
 3 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 2e899f3..cf57b3e 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -394,6 +394,8 @@ public:
     * slot has not been assigned, the value will be -1.
     */
    int location;
+   struct UBOVariableInfo* UBO;
+   bool removable_uniform;
 
    /**
     * Built-in state that backs this uniform
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index f075736..f4848fb 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -53,6 +53,8 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const
    var->origin_upper_left = this->origin_upper_left;
    var->pixel_center_integer = this->pixel_center_integer;
    var->explicit_location = this->explicit_location;
+   var->UBO = this->UBO;
+   var->removable_uniform = this->removable_uniform;
 
    var->num_state_slots = this->num_state_slots;
    if (this->state_slots) {
diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp
index cb500d2..ee57231 100644
--- a/src/glsl/opt_dead_code.cpp
+++ b/src/glsl/opt_dead_code.cpp
@@ -99,6 +99,8 @@ do_dead_code(exec_list *instructions)
 	 if (entry->var->mode == ir_var_uniform &&
 	     entry->var->constant_value)
 	    continue;
+       if(entry->var->mode == ir_var_uniform && !(entry->var->removable_uniform) )
+          continue;
 
 	 entry->var->remove();
 	 progress = true;
-- 
1.7.6.3



More information about the mesa-dev mailing list