i965/vec4: Refactor sampler message setup.

The next patch adds an additional case where the message header is
necessary.  So we want to do the g0 copy if inst->header_present is set,
rather than inst->texture_offset.
Signed-off-by: Kenneth Graunke (semi-AFK still)'s avatarKenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner's avatarMatt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes's avatarChris Forbes <chrisf@ijw.co.nz>
parent e0a56029
...@@ -367,23 +367,28 @@ vec4_generator::generate_tex(vec4_instruction *inst, ...@@ -367,23 +367,28 @@ vec4_generator::generate_tex(vec4_instruction *inst,
* to set it up explicitly and load the offset bitfield. Otherwise, we can * to set it up explicitly and load the offset bitfield. Otherwise, we can
* use an implied move from g0 to the first message register. * use an implied move from g0 to the first message register.
*/ */
if (inst->texture_offset) { if (inst->header_present) {
/* Explicitly set up the message header by copying g0 to the MRF. */ if (brw->gen < 6 && !inst->texture_offset) {
brw_push_insn_state(p); /* Set up an implied move from g0 to the MRF. */
brw_set_mask_control(p, BRW_MASK_DISABLE); src = brw_vec8_grf(0, 0);
brw_MOV(p, retype(brw_message_reg(inst->base_mrf), BRW_REGISTER_TYPE_UD), } else {
retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD)); struct brw_reg header =
retype(brw_message_reg(inst->base_mrf), BRW_REGISTER_TYPE_UD);
/* Then set the offset bits in DWord 2. */
brw_set_access_mode(p, BRW_ALIGN_1); /* Explicitly set up the message header by copying g0 to the MRF. */
brw_MOV(p, brw_push_insn_state(p);
retype(brw_vec1_reg(BRW_MESSAGE_REGISTER_FILE, inst->base_mrf, 2), brw_set_mask_control(p, BRW_MASK_DISABLE);
BRW_REGISTER_TYPE_UD), brw_MOV(p, header, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD));
brw_imm_ud(inst->texture_offset));
brw_pop_insn_state(p); brw_set_access_mode(p, BRW_ALIGN_1);
} else if (inst->header_present) {
/* Set up an implied move from g0 to the MRF. */ if (inst->texture_offset) {
src = brw_vec8_grf(0, 0); /* Set the texel offset bits in DWord 2. */
brw_MOV(p, get_element_ud(header, 2),
brw_imm_ud(inst->texture_offset));
}
brw_pop_insn_state(p);
}
} }
uint32_t return_format; uint32_t return_format;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment