<div dir="ltr">On 12 November 2013 17:51, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We need to SEND from a GRF, and we can only obtain those prior to<br>
register allocation.<br>
<br>
This allows us to do pull constant loads without the MRF hack.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 13 ++++++++++++-<br>
1 file changed, 12 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
index a036e2d..5f0d0b4 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
@@ -1582,7 +1582,13 @@ vec4_visitor::visit(ir_expression *ir)<br>
src_reg surf_index =<br>
src_reg(prog_data->base.binding_table.ubo_start + uniform_block->value.u[0]);<br>
if (const_offset_ir) {<br>
- offset = src_reg(const_offset / 16);<br>
+ if (brw->gen >= 8) {<br>
+ /* Put the offset in a GRF; we can't SEND from immediates. */<br>
+ offset = src_reg(this, glsl_type::int_type);<br>
+ emit(MOV(dst_reg(offset), src_reg(const_offset / 16)));<br>
+ } else {<br>
+ offset = src_reg(const_offset / 16);<br>
+ }<br>
} else {<br>
offset = src_reg(this, glsl_type::uint_type);<br>
emit(SHR(dst_reg(offset), op[1], src_reg(4)));<br>
@@ -2983,6 +2989,11 @@ vec4_visitor::get_pull_constant_offset(vec4_instruction *inst,<br>
}<br>
<br>
return index;<br>
+ } else if (brw->gen >= 8) {<br>
+ /* Put the offset in a GRF; we can't SEND from immediates. */<br>
+ src_reg offset = src_reg(this, glsl_type::int_type);<br>
+ emit_before(inst, MOV(dst_reg(offset), src_reg(reg_offset)));<br>
+ return offset;<br>
} else {<br>
int message_header_scale = brw->gen < 6 ? 16 : 1;<br>
return src_reg(reg_offset * message_header_scale);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.2<br></font></span></blockquote><div><br></div><div>Looking at the docs, it appears to me that SENDs from immediates have never been allowed. Is it possible that they have been working just by luck? Maybe we should make this change apply regardless of brw->gen.<br>
</div></div></div></div>