diff options
author | marha <marha@users.sourceforge.net> | 2013-11-18 09:21:27 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-11-18 09:21:27 +0100 |
commit | 7c20de6c7fb53ed404d4df0d975328318810ce01 (patch) | |
tree | 8f837042966482fd961444153eabbc46cb9141eb /mesalib/src/glsl/opt_cse.cpp | |
parent | aa095d69b3874eb179cb77f033109a7f8f351041 (diff) | |
download | vcxsrv-7c20de6c7fb53ed404d4df0d975328318810ce01.tar.gz vcxsrv-7c20de6c7fb53ed404d4df0d975328318810ce01.tar.bz2 vcxsrv-7c20de6c7fb53ed404d4df0d975328318810ce01.zip |
libXext mesa xkeyboard-config pixman 18 nov 2013
xkeyboard-config commit 51ab5c95e48b2a040fc132bb5c1a5e8bbe86c8f4
libXext commit bb24f2970f2e425f4df90c9b73d078ad15a73fbb
pixman commit f473fd1e7553a4e92a0d72bea360f05d005c9a88
mesa commit 2cfbf84dadc915b7075a3f1cbb569daf699d5ff0
Diffstat (limited to 'mesalib/src/glsl/opt_cse.cpp')
-rw-r--r-- | mesalib/src/glsl/opt_cse.cpp | 180 |
1 files changed, 1 insertions, 179 deletions
diff --git a/mesalib/src/glsl/opt_cse.cpp b/mesalib/src/glsl/opt_cse.cpp index c53b4c6e7..8f73940d8 100644 --- a/mesalib/src/glsl/opt_cse.cpp +++ b/mesalib/src/glsl/opt_cse.cpp @@ -243,184 +243,6 @@ is_cse_candidate(ir_rvalue *ir) return v.ok; } -static bool -equals(ir_rvalue *a, ir_rvalue *b); - -static bool -equals(ir_constant *a, ir_constant *b) -{ - if (!a || !b) - return false; - - if (a->type != b->type) - return false; - - for (unsigned i = 0; i < a->type->components(); i++) { - if (a->value.u[i] != b->value.u[i]) - return false; - } - - return true; -} - -static bool -equals(ir_dereference_variable *a, ir_dereference_variable *b) -{ - if (!a || !b) - return false; - - return a->var == b->var; -} - -static bool -equals(ir_dereference_array *a, ir_dereference_array *b) -{ - if (!a || !b) - return false; - - if (!equals(a->array, b->array)) - return false; - - if (!equals(a->array_index, b->array_index)) - return false; - - return true; -} - -static bool -equals(ir_swizzle *a, ir_swizzle *b) -{ - if (!a || !b) - return false; - - if (a->type != b->type) - return false; - - if (a->mask.x != b->mask.x || - a->mask.y != b->mask.y || - a->mask.z != b->mask.z || - a->mask.w != b->mask.w) { - return false; - } - - return equals(a->val, b->val); -} - -static bool -equals(ir_texture *a, ir_texture *b) -{ - if (!a || !b) - return false; - - if (a->type != b->type) - return false; - - if (a->op != b->op) - return false; - - if (!equals(a->coordinate, b->coordinate)) - return false; - - if (!equals(a->projector, b->projector)) - return false; - - if (!equals(a->shadow_comparitor, b->shadow_comparitor)) - return false; - - if (!equals(a->offset, b->offset)) - return false; - - if (!equals(a->sampler, b->sampler)) - return false; - - switch (a->op) { - case ir_tex: - case ir_lod: - case ir_query_levels: - break; - case ir_txb: - if (!equals(a->lod_info.bias, b->lod_info.bias)) - return false; - break; - case ir_txl: - case ir_txf: - case ir_txs: - if (!equals(a->lod_info.lod, b->lod_info.lod)) - return false; - break; - case ir_txd: - if (!equals(a->lod_info.grad.dPdx, b->lod_info.grad.dPdx) || - !equals(a->lod_info.grad.dPdy, b->lod_info.grad.dPdy)) - return false; - break; - case ir_txf_ms: - if (!equals(a->lod_info.sample_index, b->lod_info.sample_index)) - return false; - break; - case ir_tg4: - if (!equals(a->lod_info.component, b->lod_info.component)) - return false; - break; - default: - assert(!"Unrecognized texture op"); - } - - return true; -} - -static bool -equals(ir_expression *a, ir_expression *b) -{ - if (!a || !b) - return false; - - if (a->type != b->type) - return false; - - if (a->operation != b->operation) - return false; - - for (unsigned i = 0; i < a->get_num_operands(); i++) { - if (!equals(a->operands[i], b->operands[i])) - return false; - } - - return true; -} - -static bool -equals(ir_rvalue *a, ir_rvalue *b) -{ - if (!a || !b) - return !a && !b; - - if (a->type != b->type) - return false; - - switch (a->ir_type) { - case ir_type_texture: - return equals(a->as_texture(), b->as_texture()); - - case ir_type_constant: - return equals(a->as_constant(), b->as_constant()); - - case ir_type_expression: - return equals(a->as_expression(), b->as_expression()); - - case ir_type_dereference_variable: - return equals(a->as_dereference_variable(), b->as_dereference_variable()); - - case ir_type_dereference_array: - return equals(a->as_dereference_array(), b->as_dereference_array()); - - case ir_type_swizzle: - return equals(a->as_swizzle(), b->as_swizzle()); - - default: - return false; - } -} - /** * Tries to find and return a reference to a previous computation of a given * expression. @@ -441,7 +263,7 @@ cse_visitor::try_cse(ir_rvalue *rvalue) printf("\n"); } - if (!equals(rvalue, *entry->val)) + if (!rvalue->equals(*entry->val)) continue; if (debug) { |