summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/nir/nir_search.c6
-rw-r--r--src/glsl/nir/nir_search.h7
2 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_search.c b/src/glsl/nir/nir_search.c
index 18e0330e4ae..ec898174364 100644
--- a/src/glsl/nir/nir_search.c
+++ b/src/glsl/nir/nir_search.c
@@ -78,6 +78,10 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src,
return true;
} else {
+ if (var->is_constant &&
+ instr->src[src].src.ssa->parent_instr->type != nir_instr_type_load_const)
+ return false;
+
state->variables_seen |= (1 << var->variable);
state->variables[var->variable].src = instr->src[src].src;
state->variables[var->variable].abs = false;
@@ -236,6 +240,8 @@ construct_value(const nir_search_value *value, nir_alu_type type,
nir_alu_src val;
nir_alu_src_copy(&val, &state->variables[var->variable], mem_ctx);
+ assert(!var->is_constant);
+
return val;
}
diff --git a/src/glsl/nir/nir_search.h b/src/glsl/nir/nir_search.h
index 8ec58b07139..18aa28dcc66 100644
--- a/src/glsl/nir/nir_search.h
+++ b/src/glsl/nir/nir_search.h
@@ -47,6 +47,13 @@ typedef struct {
/** The variable index; Must be less than NIR_SEARCH_MAX_VARIABLES */
unsigned variable;
+
+ /** Indicates that the given variable must be a constant
+ *
+ * This is only alloed in search expressions and indicates that the
+ * given variable is only allowed to match constant values.
+ */
+ bool is_constant;
} nir_search_variable;
typedef struct {