Module: Mesa
Branch: master
Commit: e6c79329dd6fe011e995f9ea7c99f2a57a3619c7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6c79329dd6fe011e995f9ea7c99f2a57a3619c7

Author: Jason Ekstrand <[email protected]>
Date:   Tue Apr  6 15:54:07 2021 -0700

intel: fix querying mip levels on null surfaces on SKL and prior

When a surface of type SURFTYPE_NULL is accessed by resinfo, the MIPCount
returned is undefined instead of 0.

Closes #4309
Fixes dEQP-VK.robustness.robustness2.*.sampled_image.*.null_descriptor.*

Reviewed-by: Ivan Briano <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10147>

---

 src/intel/compiler/brw_fs_nir.cpp | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_fs_nir.cpp 
b/src/intel/compiler/brw_fs_nir.cpp
index 2e0e5907ca4..5feac0a17f0 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -6041,7 +6041,21 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, 
nir_tex_instr *instr)
 
    if (instr->op == nir_texop_query_levels) {
       /* # levels is in .w */
-      nir_dest[0] = offset(dst, bld, 3);
+      if (devinfo->ver <= 9) {
+         /**
+          * Wa_1940217:
+          *
+          * When a surface of type SURFTYPE_NULL is accessed by resinfo, the
+          * MIPCount returned is undefined instead of 0.
+          */
+         fs_inst *mov = bld.MOV(bld.null_reg_d(), dst);
+         mov->conditional_mod = BRW_CONDITIONAL_NZ;
+         nir_dest[0] = bld.vgrf(BRW_REGISTER_TYPE_D);
+         fs_inst *sel = bld.SEL(nir_dest[0], offset(dst, bld, 3), 
brw_imm_d(0));
+         sel->predicate = BRW_PREDICATE_NORMAL;
+      } else {
+         nir_dest[0] = offset(dst, bld, 3);
+      }
    } else if (instr->op == nir_texop_txs &&
               dest_size >= 3 && devinfo->ver < 7) {
       /* Gfx4-6 return 0 instead of 1 for single layer surfaces. */

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to