mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-26 10:00:22 +01:00
nir/builder: infer txf_ms/txl/txb opcodes
I'm not convinced these really should be separate opcodes at all in NIR, but that's not what this patch is about. Here we just infer the opcodes in the texture builder to allow simplified usage. This lets us drop nir_txl() & nir_txb() helpers in favour of nir_tex(.lod/bias) which is more normalized. We could also drop nir_txf_ms in favour of nir_txf but that affects more callsites and is not obviously a win (unlike nir_txl which is used once and nir_txb which is unused). Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39271>
This commit is contained in:
parent
76e7a1cde4
commit
41cdc548ee
3 changed files with 12 additions and 11 deletions
|
|
@ -274,6 +274,15 @@ nir_build_tex_struct(nir_builder *build, nir_texop op, struct nir_tex_builder f)
|
|||
glsl_get_sampler_result_type(type));
|
||||
}
|
||||
|
||||
/* Fix up the opcode to allow simplified usage. This helps ergonomics. */
|
||||
if (op == nir_texop_txf && f.ms_index) {
|
||||
op = nir_texop_txf_ms;
|
||||
} else if (op == nir_texop_tex && f.lod) {
|
||||
op = nir_texop_txl;
|
||||
} else if (op == nir_texop_tex && f.bias) {
|
||||
op = nir_texop_txb;
|
||||
}
|
||||
|
||||
if (lod == NULL && nir_dim_has_lod(dim) &&
|
||||
(op == nir_texop_txs || op == nir_texop_txf)) {
|
||||
|
||||
|
|
|
|||
|
|
@ -2209,19 +2209,11 @@ nir_def *nir_build_tex_struct(nir_builder *build, nir_texop op,
|
|||
#define nir_tex(build, coord_, ...) \
|
||||
nir_build_tex(build, nir_texop_tex, .coord = coord_, __VA_ARGS__)
|
||||
|
||||
#define nir_txl(build, coord_, lod_, ...) \
|
||||
nir_build_tex(build, nir_texop_txl, .coord = coord_, .lod = lod_, \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define nir_txb(build, coord_, bias_, ...) \
|
||||
nir_build_tex(build, nir_texop_txb, .coord = coord_, .bias = bias, \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define nir_txf(build, coord_, ...) \
|
||||
nir_build_tex(build, nir_texop_txf, .coord = coord_, __VA_ARGS__)
|
||||
|
||||
#define nir_txf_ms(build, coord_, ms_index_, ...) \
|
||||
nir_build_tex(build, nir_texop_txf_ms, .coord = coord_, \
|
||||
#define nir_txf_ms(build, coord_, ms_index_, ...) \
|
||||
nir_build_tex(build, nir_texop_txf, .coord = coord_, \
|
||||
.ms_index = ms_index_, __VA_ARGS__)
|
||||
|
||||
#define nir_txs(build, ...) nir_build_tex(build, nir_texop_txs, __VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ build_blit_shader(const struct vk_meta_blit_key *key)
|
|||
|
||||
nir_def *val;
|
||||
if (resolve_mode == VK_RESOLVE_MODE_NONE) {
|
||||
val = nir_txl(b, src_coord, nir_imm_float(b, 0),
|
||||
val = nir_tex(b, src_coord, .lod = nir_imm_float(b, 0),
|
||||
.texture_deref = t, .sampler_deref = s);
|
||||
} else {
|
||||
val = build_tex_resolve(b, t, nir_f2u32(b, src_coord),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue