Mesa (master): intel/fs: Fix sampler message headers on Gen11+ when using scratch
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 18 23:37:43 UTC 2020
Module: Mesa
Branch: master
Commit: 31290f98061acc237ba0f5d9c8c4c38ad6075c70
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=31290f98061acc237ba0f5d9c8c4c38ad6075c70
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Tue Sep 15 10:54:05 2020 -0700
intel/fs: Fix sampler message headers on Gen11+ when using scratch
Icelake's sampler message header introduces a field in m0.3 bit 0
which controls whether the sampler state pointer should be relative
to bindless sampler state base address or dynamic state base address.
g0.3 bit 0 is part of the per-thread scratch space field. On older
hardware, we were able to copy that along because the sampler ignored
bits 4:0. Now, however, we need to mask them out.
Fixes various textureGatherOffsets piglit tests when forcing the FS
to run with 2048 bytes of per-thread scratch space (which is a
per-thread scratch space encoding of 1, meaning bit 0 will be set).
Cc: mesa-stable
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6735>
---
src/intel/compiler/brw_fs.cpp | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index eda234c838f..1352379de20 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -5015,21 +5015,38 @@ lower_sampler_logical_send_gen7(const fs_builder &bld, fs_inst *inst, opcode op,
*/
ubld1.MOV(component(header, 3), sampler_handle);
} else if (is_high_sampler(devinfo, sampler)) {
+ fs_reg sampler_state_ptr =
+ retype(brw_vec1_grf(0, 3), BRW_REGISTER_TYPE_UD);
+
+ /* Gen11+ sampler message headers include bits in 4:0 which conflict
+ * with the ones included in g0.3 bits 4:0. Mask them out.
+ */
+ if (devinfo->gen >= 11) {
+ sampler_state_ptr = ubld1.vgrf(BRW_REGISTER_TYPE_UD);
+ ubld1.AND(sampler_state_ptr,
+ retype(brw_vec1_grf(0, 3), BRW_REGISTER_TYPE_UD),
+ brw_imm_ud(INTEL_MASK(31, 5)));
+ }
+
if (sampler.file == BRW_IMMEDIATE_VALUE) {
assert(sampler.ud >= 16);
const int sampler_state_size = 16; /* 16 bytes */
- ubld1.ADD(component(header, 3),
- retype(brw_vec1_grf(0, 3), BRW_REGISTER_TYPE_UD),
+ ubld1.ADD(component(header, 3), sampler_state_ptr,
brw_imm_ud(16 * (sampler.ud / 16) * sampler_state_size));
} else {
fs_reg tmp = ubld1.vgrf(BRW_REGISTER_TYPE_UD);
ubld1.AND(tmp, sampler, brw_imm_ud(0x0f0));
ubld1.SHL(tmp, tmp, brw_imm_ud(4));
- ubld1.ADD(component(header, 3),
- retype(brw_vec1_grf(0, 3), BRW_REGISTER_TYPE_UD),
- tmp);
+ ubld1.ADD(component(header, 3), sampler_state_ptr, tmp);
}
+ } else if (devinfo->gen >= 11) {
+ /* Gen11+ sampler message headers include bits in 4:0 which conflict
+ * with the ones included in g0.3 bits 4:0. Mask them out.
+ */
+ ubld1.AND(component(header, 3),
+ retype(brw_vec1_grf(0, 3), BRW_REGISTER_TYPE_UD),
+ brw_imm_ud(INTEL_MASK(31, 5)));
}
}
More information about the mesa-commit
mailing list