[Mesa-dev] [PATCH] intel/fs: Always use sampler 0 for MCS fetches

Jason Ekstrand jason at jlekstrand.net
Fri Feb 8 21:54:48 UTC 2019


It doesn't matter what we use as the MCS fetch will ignore it.  Using
zero means we'll naver trigger a header because of it.  We have an
optimization in the indirect message case for when the texture and
sampler are the same but we also have one for when the texture is
indirect and the sampler is an immediate that's just as efficient so
this generates no more code than we had before.
---
 src/intel/compiler/brw_fs_visitor.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_fs_visitor.cpp b/src/intel/compiler/brw_fs_visitor.cpp
index 51a0ca2374a..259a56245ca 100644
--- a/src/intel/compiler/brw_fs_visitor.cpp
+++ b/src/intel/compiler/brw_fs_visitor.cpp
@@ -42,7 +42,8 @@ fs_visitor::emit_mcs_fetch(const fs_reg &coordinate, unsigned components,
    fs_reg srcs[TEX_LOGICAL_NUM_SRCS];
    srcs[TEX_LOGICAL_SRC_COORDINATE] = coordinate;
    srcs[TEX_LOGICAL_SRC_SURFACE] = texture;
-   srcs[TEX_LOGICAL_SRC_SAMPLER] = texture;
+   /* sampler is ignored for a MCS fetch so it doesn't matter */
+   srcs[TEX_LOGICAL_SRC_SAMPLER] = brw_imm_ud(0);
    srcs[TEX_LOGICAL_SRC_COORD_COMPONENTS] = brw_imm_d(components);
    srcs[TEX_LOGICAL_SRC_GRAD_COMPONENTS] = brw_imm_d(0);
 
-- 
2.20.1



More information about the mesa-dev mailing list