summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_search.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-01-28 16:29:21 -0800
committerJason Ekstrand <[email protected]>2015-01-29 17:07:45 -0800
commit026b5cc79274af4a681d3ef41ccfd3b5fa5dc050 (patch)
treee1cd37daf11ba9959350897bfbb3286f130fdbec /src/glsl/nir/nir_search.h
parentd8999bcdce6a3c8ab63f06c7028fd6e927bb9acb (diff)
nir/search: Allow for matching variables based on types
This allows you to match on an unknown value but only if it is of a given type. 90% of the uses of this are for matching only booleans, but adding the generality of arbitrary types is no more complex. nir_algebraic.py doesn't handle this yet but that's ok because the C language will ensure that the default type on all variables is void. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_search.h')
-rw-r--r--src/glsl/nir/nir_search.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_search.h b/src/glsl/nir/nir_search.h
index 18aa28dcc66..7d47792945e 100644
--- a/src/glsl/nir/nir_search.h
+++ b/src/glsl/nir/nir_search.h
@@ -54,6 +54,18 @@ typedef struct {
* given variable is only allowed to match constant values.
*/
bool is_constant;
+
+ /** Indicates that the given variable must have a certain type
+ *
+ * This is only allowed in search expressions and indicates that the
+ * given variable is only allowed to match values that come from an ALU
+ * instruction with the given output type. A type of nir_type_void
+ * means it can match any type.
+ *
+ * Note: A variable that is both constant and has a non-void type will
+ * never match anything.
+ */
+ nir_alu_type type;
} nir_search_variable;
typedef struct {