Re: [Mesa-dev] [PATCH 5/9] glsl: change IR to add UBO information
On Thu, 1 Dec 2011 16:35:34 +0100, Vincent Lejeune v...@ovi.com wrote: This commit doesn't appear to change IR to add UBO information. It appears to actually add a member initialized to false and copy it around. The commit message is missing the why and how part that should follow that 1-line what summary, which I think would have pointed out that this commit is broken while it was being written. --- src/glsl/ir.cpp|1 + src/glsl/ir.h |6 ++ src/glsl/ir_clone.cpp |1 + src/glsl/opt_dead_code.cpp |6 ++ 4 files changed, 14 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) { diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp index 5b9546a..58ff534 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -27,6 +27,7 @@ * Eliminates dead assignments and variable declarations from the code. */ +#include ../mesa/main/mtypes.h #include ir.h #include ir_visitor.h #include ir_variable_refcount.h @@ -100,6 +101,11 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned) if (entry-var-mode == ir_var_uniform (uniform_locations_assigned || entry-var-constant_value)) continue; + /*if(entry-var-mode == ir_var_uniform entry-var-UBO) { + if(entry-var-UBO-UBO-Layout != packed) +continue; + }*/ + entry-var-remove(); progress = true; -- 1.7.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev pgp2cLeKhsgqK.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/9] glsl: change IR to add UBO information
--- src/glsl/ir.cpp|1 + src/glsl/ir.h |6 ++ src/glsl/ir_clone.cpp |1 + src/glsl/opt_dead_code.cpp |6 ++ 4 files changed, 14 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) { diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp index 5b9546a..58ff534 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -27,6 +27,7 @@ * Eliminates dead assignments and variable declarations from the code. */ +#include ../mesa/main/mtypes.h #include ir.h #include ir_visitor.h #include ir_variable_refcount.h @@ -100,6 +101,11 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned) if (entry-var-mode == ir_var_uniform (uniform_locations_assigned || entry-var-constant_value)) continue; + /*if(entry-var-mode == ir_var_uniform entry-var-UBO) { + if(entry-var-UBO-UBO-Layout != packed) +continue; + }*/ + entry-var-remove(); progress = true; -- 1.7.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/9] glsl: change IR to add UBO information
On Thu, Dec 1, 2011 at 3:35 PM, Vincent Lejeune v...@ovi.com wrote: --- src/glsl/ir.cpp | 1 + src/glsl/ir.h | 6 ++ src/glsl/ir_clone.cpp | 1 + src/glsl/opt_dead_code.cpp | 6 ++ 4 files changed, 14 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) { diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp index 5b9546a..58ff534 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -27,6 +27,7 @@ * Eliminates dead assignments and variable declarations from the code. */ +#include ../mesa/main/mtypes.h #include ir.h #include ir_visitor.h #include ir_variable_refcount.h @@ -100,6 +101,11 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned) if (entry-var-mode == ir_var_uniform (uniform_locations_assigned || entry-var-constant_value)) continue; + /*if(entry-var-mode == ir_var_uniform entry-var-UBO) { + if(entry-var-UBO-UBO-Layout != packed) + continue; + }*/ + Is this meant to be commented-out? Matt ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/9] glsl: change IR to add UBO information
--- src/glsl/ir.cpp|1 + src/glsl/ir.h |7 +++ src/glsl/ir_clone.cpp |1 + src/glsl/opt_dead_code.cpp |6 ++ 4 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 41ed4f1..8638bb6 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1336,6 +1336,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-UBO = NULL; 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 2e899f3..8648526 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -396,6 +396,13 @@ public: int location; /** +* If variable is part of an Uniform Buffer Object : +* - UBO is a pointer to program UBO information about this variable +* - removable_uniform is false if UBO layout force not to remove the uniform (ie is shared or std140) +*/ + struct UBOVariableInfo* UBO; + + /** * 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 f075736..cec970a 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -53,6 +53,7 @@ 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-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..2ffa10b 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -27,6 +27,7 @@ * Eliminates dead assignments and variable declarations from the code. */ +#include ../mesa/main/mtypes.h #include ir.h #include ir_visitor.h #include ir_variable_refcount.h @@ -99,6 +100,11 @@ 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-UBO) { + if(entry-var-UBO-UBO-Layout != packed) +continue; + } + entry-var-remove(); progress = true; -- 1.7.6.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/9] glsl: change IR to add UBO information
--- 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 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev