From dd4c2a516cf2c700694bcbd37d644d7239f4cf48 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 15 Sep 2013 18:23:14 +1200 Subject: [PATCH] i965: use gather slots in the binding table for gather4. Signed-off-by: Chris Forbes Reviewed-by: Kenneth Graunke --- 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 5672eaee915..5b1ecc8c819 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 6bdffb39392..00efb10f38b 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 -- 2.30.2