I am ok with either solution as long as it fixes <a href="https://bugs.freedesktop.org/show_bug.cgi?id=31827"><b>Bug 31827</b></a>.<br><br>I have tested my patch and it works. There was a bug in lower_jumps that made discard statements with a condition be treated as without it, causing the removal of all instructions after discard. This code from my patch fixes it:<br>
<br>--- a/src/glsl/lower_jumps.cpp<br>
+++ b/src/glsl/lower_jumps.cpp<br>
@@ -202,7 +202,9 @@ struct ir_lower_jumps_visitor : public ir_control_flow_visitor {<br>
<br>
virtual void visit(class ir_discard * ir)<br>
{<br>
- truncate_after_instruction(ir);<br><div id=":au">
+ if (!ir->condition) {<br>
+ truncate_after_instruction(ir);<br>
+ }<br>
this->block.min_strength = strength_discard;<br>
}<br>
</div><br>Marek<br><br><div class="gmail_quote">On Thu, Nov 25, 2010 at 12:40 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I was actually working on the same thing today, and wrote two passes for<br>
dealing with discards. I was just looking into adding ir_to_mesa and brw_fs<br>
support when I saw your patch, so I just split that out and reused it. Thanks<br>
for writing that!<br>
<br>
I'm not sure whether doing it in a separate pass (like I've done) or in<br>
lower_if_to_cond_assign is better.<br>
<br>
Also, I haven't been able to properly test any of this yet since I don't<br>
yet have brw_fs support. It may be completely broken, but I wanted to put it<br>
out there anyway so people know there are two possible solutions.<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br>