summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_search.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-05-08 08:33:01 -0700
committerJason Ekstrand <[email protected]>2015-05-08 17:29:14 -0700
commit13facfbd5b067daedc972c1a4fb2f2142fcbc190 (patch)
treee925ac752c21e50196fd3554124b1ba182e0b236 /src/glsl/nir/nir_search.c
parentf752effa087f29faddabac047683d16416d178d9 (diff)
nir/search: handle explicitly sized sources in match_value
Previously, this case was being handled in match_expression prior to calling match_value. However, there is really no good reason for this given that match_value has all of the information it needs. Also, they weren't being handled properly in the commutative case and putting it in match_value gives us that for free. Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_search.c')
-rw-r--r--src/glsl/nir/nir_search.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/glsl/nir/nir_search.c b/src/glsl/nir/nir_search.c
index 490b31ffe8a..713dc4eedff 100644
--- a/src/glsl/nir/nir_search.c
+++ b/src/glsl/nir/nir_search.c
@@ -73,6 +73,14 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src,
{
uint8_t new_swizzle[4];
+ /* If the source is an explicitly sized source, then we need to reset
+ * both the number of components and the swizzle.
+ */
+ if (nir_op_infos[instr->op].input_sizes[src] != 0) {
+ num_components = nir_op_infos[instr->op].input_sizes[src];
+ swizzle = identity_swizzle;
+ }
+
for (int i = 0; i < num_components; ++i)
new_swizzle[i] = instr->src[src].swizzle[swizzle[i]];
@@ -200,14 +208,6 @@ match_expression(const nir_search_expression *expr, nir_alu_instr *instr,
bool matched = true;
for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
- /* If the source is an explicitly sized source, then we need to reset
- * both the number of components and the swizzle.
- */
- if (nir_op_infos[instr->op].input_sizes[i] != 0) {
- num_components = nir_op_infos[instr->op].input_sizes[i];
- swizzle = identity_swizzle;
- }
-
if (!match_value(expr->srcs[i], instr, i, num_components,
swizzle, state)) {
matched = false;