projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gallivm: fetch immediates to correct type (v2)
[mesa.git]
/
src
/
glsl
/
opt_structure_splitting.cpp
diff --git
a/src/glsl/opt_structure_splitting.cpp
b/src/glsl/opt_structure_splitting.cpp
index d6191002c2f05d0fccc22ee6126cb11137504e08..2c1f6bb227a96f15bb6c9cf83cd238b76ce686bd 100644
(file)
--- a/
src/glsl/opt_structure_splitting.cpp
+++ b/
src/glsl/opt_structure_splitting.cpp
@@
-65,7
+65,7
@@
public:
ir_variable **components;
ir_variable **components;
- /**
talloc_parent(this->var) -- the shader's t
alloc context. */
+ /**
ralloc_parent(this->var) -- the shader's r
alloc context. */
void *mem_ctx;
};
void *mem_ctx;
};
@@
-74,13
+74,13
@@
class ir_structure_reference_visitor : public ir_hierarchical_visitor {
public:
ir_structure_reference_visitor(void)
{
public:
ir_structure_reference_visitor(void)
{
- this->mem_ctx =
talloc_new
(NULL);
+ this->mem_ctx =
ralloc_context
(NULL);
this->variable_list.make_empty();
}
~ir_structure_reference_visitor(void)
{
this->variable_list.make_empty();
}
~ir_structure_reference_visitor(void)
{
-
t
alloc_free(mem_ctx);
+
r
alloc_free(mem_ctx);
}
virtual ir_visitor_status visit(ir_variable *);
}
virtual ir_visitor_status visit(ir_variable *);
@@
-151,6
+151,12
@@
ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir)
ir_visitor_status
ir_structure_reference_visitor::visit_enter(ir_assignment *ir)
{
ir_visitor_status
ir_structure_reference_visitor::visit_enter(ir_assignment *ir)
{
+ /* If there are no structure references yet, no need to bother with
+ * processing the expression tree.
+ */
+ if (this->variable_list.is_empty())
+ return visit_continue_with_parent;
+
if (ir->lhs->as_dereference_variable() &&
ir->rhs->as_dereference_variable() &&
!ir->condition) {
if (ir->lhs->as_dereference_variable() &&
ir->rhs->as_dereference_variable() &&
!ir->condition) {
@@
-322,7
+328,7
@@
do_structure_splitting(exec_list *instructions)
if (refs.variable_list.is_empty())
return false;
if (refs.variable_list.is_empty())
return false;
- void *mem_ctx =
talloc_new
(NULL);
+ void *mem_ctx =
ralloc_context
(NULL);
/* Replace the decls of the structures to be split with their split
* components.
/* Replace the decls of the structures to be split with their split
* components.
@@
-331,14
+337,14
@@
do_structure_splitting(exec_list *instructions)
variable_entry2 *entry = (variable_entry2 *)iter.get();
const struct glsl_type *type = entry->var->type;
variable_entry2 *entry = (variable_entry2 *)iter.get();
const struct glsl_type *type = entry->var->type;
- entry->mem_ctx =
t
alloc_parent(entry->var);
+ entry->mem_ctx =
r
alloc_parent(entry->var);
- entry->components =
t
alloc_array(mem_ctx,
+ entry->components =
r
alloc_array(mem_ctx,
ir_variable *,
type->length);
for (unsigned int i = 0; i < entry->var->type->length; i++) {
ir_variable *,
type->length);
for (unsigned int i = 0; i < entry->var->type->length; i++) {
- const char *name =
t
alloc_asprintf(mem_ctx, "%s_%s",
+ const char *name =
r
alloc_asprintf(mem_ctx, "%s_%s",
entry->var->name,
type->fields.structure[i].name);
entry->var->name,
type->fields.structure[i].name);
@@
-355,7
+361,7
@@
do_structure_splitting(exec_list *instructions)
ir_structure_splitting_visitor split(&refs.variable_list);
visit_list_elements(&split, instructions);
ir_structure_splitting_visitor split(&refs.variable_list);
visit_list_elements(&split, instructions);
-
t
alloc_free(mem_ctx);
+
r
alloc_free(mem_ctx);
return true;
}
return true;
}