[Mesa-dev] [PATCH] i965/skl: Fix the order of the arguments for the LD sampler message

Neil Roberts neil at linux.intel.com
Fri Mar 6 11:24:57 PST 2015


In Skylake the order of the arguments for sample messages with the LD
type are u, v, lod, r whereas previously they were u, lod, v, r. This
fixes 82 Piglit tests using texelFetch.
---

I have a feeling this probably isn't the right way to do this patch so
maybe someone who knows the compiler better can write a better one. If
the arguments are now in a convenient order at least for 2D textures
is it possible to avoid a MOV now or something?

I haven't run it though a full Piglit run to check for regressions but
instead I only ran it with -t texelFetch.

 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 6b48f70..7ce9dfa 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1742,15 +1742,24 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst,
       length++;
       break;
    case ir_txf:
-      /* Unfortunately, the parameters for LD are intermixed: u, lod, v, r. */
+      /* Unfortunately, the parameters for LD are intermixed: u, lod, v, r.
+       * On Gen9 they are u, v, lod, r
+       */
+
       emit(MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate));
       coordinate = offset(coordinate, 1);
       length++;
 
+      if (brw->gen >= 9 && coord_components >= 2) {
+         emit(MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate));
+         coordinate = offset(coordinate, 1);
+         length++;
+      }
+
       emit(MOV(retype(sources[length], BRW_REGISTER_TYPE_D), lod));
       length++;
 
-      for (int i = 1; i < coord_components; i++) {
+      for (int i = brw->gen >= 9 ? 2 : 1; i < coord_components; i++) {
 	 emit(MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate));
 	 coordinate = offset(coordinate, 1);
 	 length++;
-- 
1.9.3



More information about the mesa-dev mailing list