[Mesa-dev] [PATCH V4 11/13] i965: use gather slots in the binding table for gather4.

Chris Forbes chrisf at ijw.co.nz
Mon Sep 30 03:08:41 PDT 2013


Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp   | 8 ++++++--
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 2d59d1a..ed4ee51 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -522,11 +522,15 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
       src = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW);
    }
 
+   uint32_t surface_index = inst->opcode == SHADER_OPCODE_TG4
+      ? SURF_INDEX_GATHER_TEXTURE(inst->sampler)
+      : SURF_INDEX_TEXTURE(inst->sampler);
+
    brw_SAMPLE(p,
 	      retype(dst, BRW_REGISTER_TYPE_UW),
 	      inst->base_mrf,
 	      src,
-              SURF_INDEX_TEXTURE(inst->sampler),
+              surface_index,
 	      inst->sampler,
 	      msg_type,
 	      rlen,
@@ -535,7 +539,7 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
 	      simd_mode,
 	      return_format);
 
-   mark_surface_used(SURF_INDEX_TEXTURE(inst->sampler));
+   mark_surface_used(surface_index);
 }
 
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index 6bdffb3..00efb10 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -385,11 +385,15 @@ vec4_generator::generate_tex(vec4_instruction *inst,
       break;
    }
 
+   uint32_t surface_index = inst->opcode == SHADER_OPCODE_TG4
+      ? SURF_INDEX_VEC4_GATHER_TEXTURE(inst->sampler)
+      : SURF_INDEX_VEC4_TEXTURE(inst->sampler);
+
    brw_SAMPLE(p,
 	      dst,
 	      inst->base_mrf,
 	      src,
-	      SURF_INDEX_VEC4_TEXTURE(inst->sampler),
+              surface_index,
 	      inst->sampler,
 	      msg_type,
 	      1, /* response length */
@@ -398,7 +402,7 @@ vec4_generator::generate_tex(vec4_instruction *inst,
 	      BRW_SAMPLER_SIMD_MODE_SIMD4X2,
 	      return_format);
 
-   mark_surface_used(SURF_INDEX_VEC4_TEXTURE(inst->sampler));
+   mark_surface_used(surface_index);
 }
 
 void
-- 
1.8.4



More information about the mesa-dev mailing list