bool ir_texture::equals(ir_instruction *ir) { const ir_texture *other = ir->as_texture(); if (!other) return false; if (type != other->type) return false; if (op != other->op) return false; if (!possibly_null_equals(coordinate, other->coordinate)) return false; if (!possibly_null_equals(projector, other->projector)) return false; if (!possibly_null_equals(shadow_comparitor, other->shadow_comparitor)) return false; if (!possibly_null_equals(offset, other->offset)) return false; if (!sampler->equals(other->sampler)) return false; switch (op) { case ir_tex: case ir_lod: case ir_query_levels: break; case ir_txb: if (!lod_info.bias->equals(other->lod_info.bias)) return false; break; case ir_txl: case ir_txf: case ir_txs: if (!lod_info.lod->equals(other->lod_info.lod)) 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)) return false; break; case ir_txf_ms: if (!lod_info.sample_index->equals(other->lod_info.sample_index)) return false; break; case ir_tg4: if (!lod_info.component->equals(other->lod_info.component)) return false; break; default: assert(!"Unrecognized texture op"); } return true; }
bool ir_texture::equals(ir_instruction *ir, enum ir_node_type ignore) { const ir_texture *other = ir->as_texture(); if (!other) return false; if (type != other->type) return false; if (op != other->op) return false; if (!possibly_null_equals(coordinate, other->coordinate, ignore)) return false; #if 0 // Note: glsl optimizer removed projector & shadow_comparitor fields if (!possibly_null_equals(projector, other->projector, ignore)) return false; if (!possibly_null_equals(shadow_comparitor, other->shadow_comparitor, ignore)) return false; #endif if (!possibly_null_equals(offset, other->offset, ignore)) return false; if (!sampler->equals(other->sampler, ignore)) return false; switch (op) { case ir_tex: case ir_lod: case ir_query_levels: break; case ir_txb: 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, ignore)) return false; break; case ir_txd: 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, ignore)) return false; break; case ir_tg4: if (!lod_info.component->equals(other->lod_info.component, ignore)) return false; break; default: assert(!"Unrecognized texture op"); } return true; }