nak: Fix multisampled textureing

Needed to handle txf_ms a few places and force LOD_MODE_ZERO

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Faith Ekstrand
2023-05-04 22:54:27 -05:00
committed by Marge Bot
parent cc88a1c78e
commit 9fcc0eaa8a
2 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -782,7 +782,7 @@ impl<'a> ShaderFromNir<'a> {
dim: dim,
mask: mask,
})));
} else if tex.op == nir_texop_txf {
} else if tex.op == nir_texop_txf || tex.op == nir_texop_txf_ms {
assert!(offset_mode != Tld4OffsetMode::PerPx);
self.instrs.push(Instr::new(Op::Tld(OpTld {
dsts: dsts,
@@ -790,7 +790,7 @@ impl<'a> ShaderFromNir<'a> {
srcs: srcs,
dim: dim,
lod_mode: lod_mode,
is_ms: false,
is_ms: tex.op == nir_texop_txf_ms,
offset: offset_mode == Tld4OffsetMode::AddOffI,
mask: mask,
})));
+6 -2
View File
@@ -54,7 +54,7 @@ lower_tex(nir_builder *b, nir_tex_instr *tex, const struct nak_compiler *nak)
*
* TODO: Use F2I.U32.RNE
*/
if (tex->op != nir_texop_txf)
if (tex->op != nir_texop_txf && tex->op != nir_texop_txf_ms)
arr_idx = nir_f2u32(b, nir_fadd_imm(b, arr_idx, 0.5));
arr_idx = nir_umin(b, arr_idx, nir_imm_int(b, UINT16_MAX));
@@ -62,7 +62,11 @@ lower_tex(nir_builder *b, nir_tex_instr *tex, const struct nak_compiler *nak)
}
enum nak_nir_lod_mode lod_mode = NAK_NIR_LOD_MODE_AUTO;
if (lod != NULL) {
if (tex->op == nir_texop_txf_ms) {
/* Multisampled textures do not have miplevels */
lod_mode = NAK_NIR_LOD_MODE_ZERO;
lod = NULL; /* We don't need this */
} else if (lod != NULL) {
nir_scalar lod_s = { .def = lod, .comp = 0 };
if (nir_scalar_is_const(lod_s) &&
nir_scalar_as_uint(lod_s) == 0) {