summaryrefslogtreecommitdiff
path: root/dist/Mesa/src/glsl/ir_clone.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dist/Mesa/src/glsl/ir_clone.cpp')
-rw-r--r--dist/Mesa/src/glsl/ir_clone.cpp47
1 files changed, 33 insertions, 14 deletions
diff --git a/dist/Mesa/src/glsl/ir_clone.cpp b/dist/Mesa/src/glsl/ir_clone.cpp
index dffa57844..c00adc564 100644
--- a/dist/Mesa/src/glsl/ir_clone.cpp
+++ b/dist/Mesa/src/glsl/ir_clone.cpp
@@ -45,18 +45,25 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const
var->data.max_array_access = this->data.max_array_access;
if (this->is_interface_instance()) {
- var->u.max_ifc_array_access =
+ var->max_ifc_array_access =
rzalloc_array(var, unsigned, this->interface_type->length);
- memcpy(var->u.max_ifc_array_access, this->u.max_ifc_array_access,
+ memcpy(var->max_ifc_array_access, this->max_ifc_array_access,
this->interface_type->length * sizeof(unsigned));
}
memcpy(&var->data, &this->data, sizeof(var->data));
- if (this->get_state_slots()) {
- ir_state_slot *s = var->allocate_state_slots(this->get_num_state_slots());
- memcpy(s, this->get_state_slots(),
- sizeof(s[0]) * var->get_num_state_slots());
+ var->warn_extension = this->warn_extension;
+
+ var->num_state_slots = this->num_state_slots;
+ if (this->state_slots) {
+ /* FINISHME: This really wants to use something like talloc_reference, but
+ * FINISHME: ralloc doesn't have any similar function.
+ */
+ var->state_slots = ralloc_array(var, ir_state_slot,
+ this->num_state_slots);
+ memcpy(var->state_slots, this->state_slots,
+ sizeof(this->state_slots[0]) * var->num_state_slots);
}
if (this->constant_value)
@@ -116,11 +123,13 @@ ir_if::clone(void *mem_ctx, struct hash_table *ht) const
{
ir_if *new_if = new(mem_ctx) ir_if(this->condition->clone(mem_ctx, ht));
- foreach_in_list(ir_instruction, ir, &this->then_instructions) {
+ foreach_list(n, &this->then_instructions) {
+ ir_instruction *ir = (ir_instruction *) n;
new_if->then_instructions.push_tail(ir->clone(mem_ctx, ht));
}
- foreach_in_list(ir_instruction, ir, &this->else_instructions) {
+ foreach_list(n, &this->else_instructions) {
+ ir_instruction *ir = (ir_instruction *) n;
new_if->else_instructions.push_tail(ir->clone(mem_ctx, ht));
}
@@ -132,7 +141,8 @@ ir_loop::clone(void *mem_ctx, struct hash_table *ht) const
{
ir_loop *new_loop = new(mem_ctx) ir_loop();
- foreach_in_list(ir_instruction, ir, &this->body_instructions) {
+ foreach_list(n, &this->body_instructions) {
+ ir_instruction *ir = (ir_instruction *) n;
new_loop->body_instructions.push_tail(ir->clone(mem_ctx, ht));
}
@@ -148,7 +158,8 @@ ir_call::clone(void *mem_ctx, struct hash_table *ht) const
exec_list new_parameters;
- foreach_in_list(ir_instruction, ir, &this->actual_parameters) {
+ foreach_list(n, &this->actual_parameters) {
+ ir_instruction *ir = (ir_instruction *) n;
new_parameters.push_tail(ir->clone(mem_ctx, ht));
}
@@ -267,7 +278,10 @@ ir_function::clone(void *mem_ctx, struct hash_table *ht) const
{
ir_function *copy = new(mem_ctx) ir_function(this->name);
- foreach_in_list(const ir_function_signature, sig, &this->signatures) {
+ foreach_list_const(node, &this->signatures) {
+ const ir_function_signature *const sig =
+ (const ir_function_signature *const) node;
+
ir_function_signature *sig_copy = sig->clone(mem_ctx, ht);
copy->add_signature(sig_copy);
@@ -288,7 +302,9 @@ ir_function_signature::clone(void *mem_ctx, struct hash_table *ht) const
/* Clone the instruction list.
*/
- foreach_in_list(const ir_instruction, inst, &this->body) {
+ foreach_list_const(node, &this->body) {
+ const ir_instruction *const inst = (const ir_instruction *) node;
+
ir_instruction *const inst_copy = inst->clone(mem_ctx, ht);
copy->body.push_tail(inst_copy);
}
@@ -308,7 +324,9 @@ ir_function_signature::clone_prototype(void *mem_ctx, struct hash_table *ht) con
/* Clone the parameter list, but NOT the body.
*/
- foreach_in_list(const ir_variable, param, &this->parameters) {
+ foreach_list_const(node, &this->parameters) {
+ const ir_variable *const param = (const ir_variable *) node;
+
assert(const_cast<ir_variable *>(param)->as_variable() != NULL);
ir_variable *const param_copy = param->clone(mem_ctx, ht);
@@ -412,7 +430,8 @@ clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in)
struct hash_table *ht =
hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
- foreach_in_list(const ir_instruction, original, in) {
+ foreach_list_const(node, in) {
+ const ir_instruction *const original = (ir_instruction *) node;
ir_instruction *copy = original->clone(mem_ctx, ht);
out->push_tail(copy);