[Mesa-stable] [PATCH] i965/fs: Gracefully handle TXS on multisampled textures with no LOD

Jason Ekstrand jason at jlekstrand.net
Wed Mar 29 22:22:40 UTC 2017


This can happen for multisampled textures since they are never mipmapped
and textureSize(gsampler2DMS*) does not take an LOD parameter.  This
fixes a shader validation error in the new Sascha deferredmultisampling
demo.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100391
Cc: "13.0 17.0" <mesa-stable at lists.freedesktop.org>
---

We could also easily enough handle this in spirv_to_nir like we do with
GLSL.  However, it seems perfectly reasonable that multisampled txs should
allow no LOD in NIR.

 src/intel/compiler/brw_fs_nir.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index bc1ccfb..60604e1 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -4381,9 +4381,12 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
    srcs[TEX_LOGICAL_SRC_GRAD_COMPONENTS] = brw_imm_d(lod_components);
 
    if (instr->op == nir_texop_query_levels ||
+       (instr->op == nir_texop_txs &&
+        instr->sampler_dim == GLSL_SAMPLER_DIM_MS) ||
        (instr->op == nir_texop_tex && stage != MESA_SHADER_FRAGMENT)) {
-      /* textureQueryLevels() and texture() are implemented in terms of TXS
-       * and TXL respectively, so we need to pass a valid LOD argument.
+      /* textureQueryLevels(), textureSize(), and texture() are implemented in
+       * terms of TXS and TXL respectively, so we need to pass a valid LOD
+       * argument.
        */
       assert(srcs[TEX_LOGICAL_SRC_LOD].file == BAD_FILE);
       srcs[TEX_LOGICAL_SRC_LOD] = brw_imm_ud(0u);
-- 
2.5.0.400.gff86faf



More information about the mesa-stable mailing list