summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-11-11 18:30:09 -0800
committerJason Ekstrand <[email protected]>2015-11-23 11:04:49 -0800
commit6921b17107d1a55582b174e6937fae22cdc65ee4 (patch)
tree31e56518f23c97fa79e74a046b0ff9298a3ab637
parent7e83fd85aa9e448aa588b3e981fdc8e026dd51b9 (diff)
nir: Add a tex_instr_is_query helper
Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r--src/glsl/nir/nir.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 2bdfcb80faf..1baef19812b 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1043,6 +1043,31 @@ nir_tex_instr_dest_size(nir_tex_instr *instr)
}
}
+/* Returns true if this texture operation queries something about the texture
+ * rather than actually sampling it.
+ */
+static inline bool
+nir_tex_instr_is_query(nir_tex_instr *instr)
+{
+ switch (instr->op) {
+ case nir_texop_txs:
+ case nir_texop_lod:
+ case nir_texop_texture_samples:
+ case nir_texop_query_levels:
+ return true;
+ case nir_texop_tex:
+ case nir_texop_txb:
+ case nir_texop_txl:
+ case nir_texop_txd:
+ case nir_texop_txf:
+ case nir_texop_txf_ms:
+ case nir_texop_tg4:
+ return false;
+ default:
+ unreachable("Invalid texture opcode");
+ }
+}
+
static inline unsigned
nir_tex_instr_src_size(nir_tex_instr *instr, unsigned src)
{