diff options
author | Alejandro Piñeiro <[email protected]> | 2020-04-22 23:32:47 +0200 |
---|---|---|
committer | Alejandro Piñeiro <[email protected]> | 2020-04-22 23:43:18 +0200 |
commit | 9fd180394bddbb2abd7edb39852b1419249be450 (patch) | |
tree | 2e2dbeea3b0072072c3bb50e9d605f584db596e5 /src/compiler | |
parent | 41bfd0812b4aef70a6acd6c4d389c722f45e29c5 (diff) |
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4677>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir.h | 24 |
1 files changed, 24 insertions, 0 deletions
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) { |