Mesa (master): nir: add nir_tex_instr_need_sampler helper
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 22 22:07:51 UTC 2020
Module: Mesa
Branch: master
Commit: 9fd180394bddbb2abd7edb39852b1419249be450
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9fd180394bddbb2abd7edb39852b1419249be450
Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date: Wed Apr 22 23:32:47 2020 +0200
nir: add nir_tex_instr_need_sampler helper
That is basically nir_tex_instr sampler_index documentation comment
expressed as a helper.
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4677>
---
src/compiler/nir/nir.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 105e09347b5..04088fc99fa 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1949,6 +1949,30 @@ typedef struct {
unsigned sampler_index;
} nir_tex_instr;
+/*
+ * Returns true if the texture operation requires a sampler as a general rule,
+ * see the documentation of sampler_index.
+ *
+ * Note that the specific hw/driver backend could require to a sampler
+ * object/configuration packet in any case, for some other reason.
+ */
+static inline bool
+nir_tex_instr_need_sampler(const nir_tex_instr *instr)
+{
+ switch (instr->op) {
+ case nir_texop_txf:
+ case nir_texop_txf_ms:
+ case nir_texop_txs:
+ case nir_texop_lod:
+ case nir_texop_query_levels:
+ case nir_texop_texture_samples:
+ case nir_texop_samples_identical:
+ return false;
+ default:
+ return true;
+ }
+}
+
static inline unsigned
nir_tex_instr_dest_size(const nir_tex_instr *instr)
{
More information about the mesa-commit
mailing list