[Mesa-dev] [PATCH 1/2] glsl: validate IR after linking (debug builds only)
Kenneth Graunke
kenneth at whitecape.org
Fri Aug 5 18:30:54 PDT 2011
On 08/03/2011 05:07 PM, Paul Berry wrote:
> At least one of the invariants verified by IR validation concerns the
> relative ordering of toplevel constructs in the IR: references to
> global variables must come after the declarations of those global
> variables.
>
> Since linking affects the ordering of toplevel constructs in the IR,
> it's possible that a bug in the linker will cause invalid IR to be
> generated, even if all the pre-linked shaders are valid. (In fact,
> such a bug currently exists. I'll submit a follow-up patch which
> fixes it.)
>
> Bugs like this are easily masked by further optimization passes,
> particularly inlining. So to make them easier to track down, this
> patch addes an IR validation step right after linking, and before
> final optimization occurs. The validation only occurs on debug
> builds.
Really surprised to see that we weren't doing this. It absolutely
should happen. Though, I agree with Eric...reorder them so this becomes
patch #2.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the mesa-dev
mailing list