<div dir="ltr">On 3 August 2013 19:59, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_clip_tri.c | 7 +++++--<br>
1 file changed, 5 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c<br>
index bd3ffb3..4d2eb0a 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_clip_tri.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c<br>
@@ -241,16 +241,19 @@ load_clip_distance(struct brw_clip_compile *c, struct brw_indirect vtx,<br>
brw_AND(p, vec1(brw_null_reg()), c->reg.vertex_src_mask, brw_imm_ud(1));<br>
brw_IF(p, BRW_EXECUTE_1);<br>
{<br>
- brw_MOV(p, dst, deref_4f(vtx, clip_offset));<br>
+ struct brw_indirect temp_ptr = brw_indirect(7, 0);<br>
+ brw_ADD(p, get_addr_reg(temp_ptr), get_addr_reg(vtx), c->reg.clipdistance_offset);<br>
+ brw_MOV(p, vec1(dst), deref_1f(temp_ptr, 0));<br>
}<br>
brw_ELSE(p);<br>
{<br>
brw_MOV(p, dst, deref_4f(vtx, hpos_offset));<br>
+ brw_DP4(p, dst, dst, c->reg.plane_equation);<br>
}<br>
brw_ENDIF(p);<br>
<br>
brw_set_conditionalmod(p, cond);<br>
- brw_DP4(p, dst, dst, c->reg.plane_equation);<br>
+ brw_CMP(p, brw_null_reg(), cond, vec1(dst), brw_imm_f(0.0f));<br>
}<br></blockquote><div><br></div><div>I think you can use one less instruction if you do this instead:<br><br> brw_IF(p, BRW_EXECUTE_1);<br> {<br> struct brw_indirect temp_ptr = brw_indirect(7, 0);<br> brw_ADD(p, get_addr_reg(temp_ptr), get_addr_reg(vtx), c->reg.clipdistance_offset);<br>
brw_set_conditionalmod(p, cond);<br> brw_MOV(p, vec1(dst), deref_1f(temp_ptr, 0));<br> }<br> brw_ELSE(p);<br> {<br> brw_MOV(p, dst, deref_4f(vtx, hpos_offset));<br> brw_set_conditionalmod(p, cond);<br>
brw_DP4(p, dst, dst, c->reg.plane_equation);<br> }<br> brw_ENDIF(p);<br><br></div><div>But I haven't tried it so it's possible that it doesn't work for some non-obvious reason :)<br><br></div><div>
In any case, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div></div></div></div>