i965: use gather slots in the binding table for gather4.
authorChris Forbes <chrisf@ijw.co.nz>
Sun, 15 Sep 2013 06:23:14 +0000 (18:23 +1200)
committerChris Forbes <chrisf@ijw.co.nz>
Wed, 2 Oct 2013 18:56:34 +0000 (07:56 +1300)
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs_generator.cpp
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp

index 5672eaee915254e51ab0cc90a0a6f78ef18ee81b..5b1ecc8c819e6a8b2ed86fc449fefe4fad6f18f2 100644 (file)
@@ -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);
 }
 
 
index 6bdffb393926de62188e2a078de9aa9df10c15dd..00efb10f38b82aa1b65c1b30714b7faa3daeccd1 100644 (file)
@@ -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