On Thu, Jan 9, 2014 at 11:09 AM, Ian Romanick <i...@freedesktop.org> wrote: > On 01/08/2014 12:43 PM, Matt Turner wrote: >> Only implemented for ir_swizzles currently, but perhaps will be useful > > And ir_texture?
Whoops. >> for other IR types in the future. >> --- >> src/glsl/ir.h | 14 +++++------ >> src/glsl/ir_equals.cpp | 63 >> +++++++++++++++++++++++++++----------------------- >> 2 files changed, 41 insertions(+), 36 deletions(-) >> >> diff --git a/src/glsl/ir.h b/src/glsl/ir.h >> index 780959b..9968fb5 100644 >> --- a/src/glsl/ir.h >> +++ b/src/glsl/ir.h >> @@ -148,7 +148,7 @@ public: >> * in particular. No support for other instruction types (assignments, >> * jumps, calls, etc.) is planned. >> */ >> - virtual bool equals(ir_instruction *ir); >> + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = >> ir_type_unset); >> >> protected: >> ir_instruction() >> @@ -1429,7 +1429,7 @@ public: >> return this; >> } >> >> - virtual bool equals(ir_instruction *ir); >> + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = >> ir_type_unset); >> >> virtual ir_expression *clone(void *mem_ctx, struct hash_table *ht) const; >> >> @@ -1765,7 +1765,7 @@ public: >> >> virtual ir_visitor_status accept(ir_hierarchical_visitor *); >> >> - virtual bool equals(ir_instruction *ir); >> + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = >> ir_type_unset); >> >> /** >> * Return a string representing the ir_texture_opcode. >> @@ -1871,7 +1871,7 @@ public: >> >> virtual ir_visitor_status accept(ir_hierarchical_visitor *); >> >> - virtual bool equals(ir_instruction *ir); >> + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = >> ir_type_unset); >> >> bool is_lvalue() const >> { >> @@ -1937,7 +1937,7 @@ public: >> return this; >> } >> >> - virtual bool equals(ir_instruction *ir); >> + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = >> ir_type_unset); >> >> /** >> * Get the variable that is ultimately referenced by an r-value >> @@ -1997,7 +1997,7 @@ public: >> return this; >> } >> >> - virtual bool equals(ir_instruction *ir); >> + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = >> ir_type_unset); >> >> /** >> * Get the variable that is ultimately referenced by an r-value >> @@ -2133,7 +2133,7 @@ public: >> >> virtual ir_visitor_status accept(ir_hierarchical_visitor *); >> >> - virtual bool equals(ir_instruction *ir); >> + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = >> ir_type_unset); >> >> /** >> * Get a particular component of a constant as a specific type >> diff --git a/src/glsl/ir_equals.cpp b/src/glsl/ir_equals.cpp >> index 7cfe1e6..fa7fc72 100644 >> --- a/src/glsl/ir_equals.cpp >> +++ b/src/glsl/ir_equals.cpp >> @@ -28,12 +28,12 @@ >> * can't access a's vtable in that case. >> */ >> static bool >> -possibly_null_equals(ir_instruction *a, ir_instruction *b) >> +possibly_null_equals(ir_instruction *a, ir_instruction *b, enum >> ir_node_type ignore) >> { >> if (!a || !b) >> return !a && !b; >> >> - return a->equals(b); >> + return a->equals(b, ignore); >> } >> >> /** >> @@ -41,13 +41,13 @@ possibly_null_equals(ir_instruction *a, ir_instruction >> *b) >> * about. >> */ >> bool >> -ir_instruction::equals(ir_instruction *ir) >> +ir_instruction::equals(ir_instruction *ir, enum ir_node_type) >> { >> return false; >> } >> >> bool >> -ir_constant::equals(ir_instruction *ir) >> +ir_constant::equals(ir_instruction *ir, enum ir_node_type ignore) >> { >> const ir_constant *other = ir->as_constant(); >> if (!other) >> @@ -65,7 +65,7 @@ ir_constant::equals(ir_instruction *ir) >> } >> >> bool >> -ir_dereference_variable::equals(ir_instruction *ir) >> +ir_dereference_variable::equals(ir_instruction *ir, enum ir_node_type >> ignore) >> { >> const ir_dereference_variable *other = ir->as_dereference_variable(); >> if (!other) >> @@ -75,7 +75,7 @@ ir_dereference_variable::equals(ir_instruction *ir) >> } >> >> bool >> -ir_dereference_array::equals(ir_instruction *ir) >> +ir_dereference_array::equals(ir_instruction *ir, enum ir_node_type ignore) >> { >> const ir_dereference_array *other = ir->as_dereference_array(); >> if (!other) >> @@ -84,17 +84,17 @@ ir_dereference_array::equals(ir_instruction *ir) >> if (type != other->type) >> return false; >> >> - if (!array->equals(other->array)) >> + if (!array->equals(other->array, ignore)) >> return false; >> >> - if (!array_index->equals(other->array_index)) >> + if (!array_index->equals(other->array_index, ignore)) >> return false; >> >> return true; >> } >> >> bool >> -ir_swizzle::equals(ir_instruction *ir) >> +ir_swizzle::equals(ir_instruction *ir, enum ir_node_type ignore) >> { >> const ir_swizzle *other = ir->as_swizzle(); >> if (!other) >> @@ -103,18 +103,20 @@ ir_swizzle::equals(ir_instruction *ir) >> if (type != other->type) >> return false; >> >> - if (mask.x != other->mask.x || >> - mask.y != other->mask.y || >> - mask.z != other->mask.z || >> - mask.w != other->mask.w) { >> - return false; >> + if (ignore != ir_type_swizzle) { >> + if (mask.x != other->mask.x || >> + mask.y != other->mask.y || >> + mask.z != other->mask.z || >> + mask.w != other->mask.w) { >> + return false; >> + } >> } >> >> - return val->equals(other->val); >> + return val->equals(other->val, ignore); >> } >> >> bool >> -ir_texture::equals(ir_instruction *ir) >> +ir_texture::equals(ir_instruction *ir, enum ir_node_type ignore) >> { >> const ir_texture *other = ir->as_texture(); >> if (!other) >> @@ -123,22 +125,25 @@ ir_texture::equals(ir_instruction *ir) >> if (type != other->type) >> return false; >> >> + if (ignore == ir_type_texture) >> + return true; >> + I've removed these three additions. With those gone, R-b? >> if (op != other->op) >> return false; >> >> - if (!possibly_null_equals(coordinate, other->coordinate)) >> + if (!possibly_null_equals(coordinate, other->coordinate, ignore)) >> return false; >> >> - if (!possibly_null_equals(projector, other->projector)) >> + if (!possibly_null_equals(projector, other->projector, ignore)) >> return false; >> >> - if (!possibly_null_equals(shadow_comparitor, other->shadow_comparitor)) >> + if (!possibly_null_equals(shadow_comparitor, other->shadow_comparitor, >> ignore)) >> return false; >> >> - if (!possibly_null_equals(offset, other->offset)) >> + if (!possibly_null_equals(offset, other->offset, ignore)) >> return false; >> >> - if (!sampler->equals(other->sampler)) >> + if (!sampler->equals(other->sampler, ignore)) >> return false; >> >> switch (op) { >> @@ -147,26 +152,26 @@ ir_texture::equals(ir_instruction *ir) >> case ir_query_levels: >> break; >> case ir_txb: >> - if (!lod_info.bias->equals(other->lod_info.bias)) >> + if (!lod_info.bias->equals(other->lod_info.bias, ignore)) >> return false; >> break; >> case ir_txl: >> case ir_txf: >> case ir_txs: >> - if (!lod_info.lod->equals(other->lod_info.lod)) >> + if (!lod_info.lod->equals(other->lod_info.lod, ignore)) >> return false; >> break; >> case ir_txd: >> - if (!lod_info.grad.dPdx->equals(other->lod_info.grad.dPdx) || >> - !lod_info.grad.dPdy->equals(other->lod_info.grad.dPdy)) >> + if (!lod_info.grad.dPdx->equals(other->lod_info.grad.dPdx, ignore) || >> + !lod_info.grad.dPdy->equals(other->lod_info.grad.dPdy, ignore)) >> return false; >> break; >> case ir_txf_ms: >> - if (!lod_info.sample_index->equals(other->lod_info.sample_index)) >> + if (!lod_info.sample_index->equals(other->lod_info.sample_index, >> ignore)) >> return false; >> break; >> case ir_tg4: >> - if (!lod_info.component->equals(other->lod_info.component)) >> + if (!lod_info.component->equals(other->lod_info.component, ignore)) >> return false; >> break; >> default: >> @@ -177,7 +182,7 @@ ir_texture::equals(ir_instruction *ir) >> } >> >> bool >> -ir_expression::equals(ir_instruction *ir) >> +ir_expression::equals(ir_instruction *ir, enum ir_node_type ignore) >> { >> const ir_expression *other = ir->as_expression(); >> if (!other) >> @@ -190,7 +195,7 @@ ir_expression::equals(ir_instruction *ir) >> return false; >> >> for (unsigned i = 0; i < get_num_operands(); i++) { >> - if (!operands[i]->equals(other->operands[i])) >> + if (!operands[i]->equals(other->operands[i], ignore)) >> return false; >> } >> >> > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev