[Mesa-dev] [PATCH 2/2] prog_optimize: Add reads without writes optimization pass

Tom Stellard tstellar at gmail.com
Tue Mar 29 20:34:56 PDT 2011


On Tue, Mar 29, 2011 at 02:11:01PM -0400, Jerome Glisse wrote:
> 
> Long time since i have look into mesa shader but your code seems to
> completely ignore program flow and thus might face wrong positive. For
> instance :
> 
> Consider a flow graph, in this flow graph consider B0 & B1 two
> different block where B0 dominate B1 (ie in all execution flow
> instruction that endup in B1 also goes through B0 before). Now
> consider some instruction using temp 10 (with temp 10 never being used
> outside B0 & B1) in B1 and some instruction defining temp 10 in B0. If
> B1 instruction are first in the gl_program instructions array then
> your algorithm will wrongly believe that temp 10 is never written
> before instruction using it.
> 
> IIRC correctly on how mesa ir this case can happen.
>

Ok, I didn't realize the instructions could be ordered that way
in the instruction array.  This patch is really only necessary on
hardware without support for control flow, so I'll try to modify it so
it doesn't run if there are flow control instructions.

-Tom


More information about the mesa-dev mailing list