diff options
author | Chris Forbes <[email protected]> | 2014-08-10 11:58:06 +1200 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2014-08-15 19:13:32 +1200 |
commit | 4ba5171f307873c7f5d6ac07f86bfbc26a82e00e (patch) | |
tree | 7393d79ec1db511d6b1ab4fa905c4fb4f5df450d /src/mesa/drivers/dri/i965/brw_fs_generator.cpp | |
parent | 2b1204aa96cb2d1aa66cecde810b9224d457a580 (diff) |
i965/fs: Refactor generate_tex in prep for nonconst sampler indexing
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_generator.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index bc1e7bf9a44..c7c8c5f4f6c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -538,11 +538,8 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src src.nr++; } - assert(sampler_index.file == BRW_IMMEDIATE_VALUE); assert(sampler_index.type == BRW_REGISTER_TYPE_UD); - uint32_t sampler = sampler_index.dw1.ud; - /* Load the message header if present. If there's a texture offset, * we need to set it up explicitly and load the offset bitfield. * Otherwise, we can use an implied move from g0 to the first message reg. @@ -578,25 +575,31 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src } } - uint32_t surface_index = ((inst->opcode == SHADER_OPCODE_TG4 || - inst->opcode == SHADER_OPCODE_TG4_OFFSET) - ? prog_data->base.binding_table.gather_texture_start - : prog_data->base.binding_table.texture_start) + sampler; - - brw_SAMPLE(p, - retype(dst, BRW_REGISTER_TYPE_UW), - inst->base_mrf, - src, - surface_index, - sampler % 16, - msg_type, - rlen, - inst->mlen, - inst->header_present, - simd_mode, - return_format); - - brw_mark_surface_used(&prog_data->base, surface_index); + uint32_t base_binding_table_index = (inst->opcode == SHADER_OPCODE_TG4 || + inst->opcode == SHADER_OPCODE_TG4_OFFSET) + ? prog_data->base.binding_table.gather_texture_start + : prog_data->base.binding_table.texture_start; + + if (sampler_index.file == BRW_IMMEDIATE_VALUE) { + uint32_t sampler = sampler_index.dw1.ud; + + brw_SAMPLE(p, + retype(dst, BRW_REGISTER_TYPE_UW), + inst->base_mrf, + src, + sampler + base_binding_table_index, + sampler % 16, + msg_type, + rlen, + inst->mlen, + inst->header_present, + simd_mode, + return_format); + + brw_mark_surface_used(&prog_data->base, sampler + base_binding_table_index); + } else { + /* XXX: Non-const sampler index */ + } } |