Review: improve adjust_varying (issue204046)


Reviewers: ,

adjust_varying is the function that doctors whether a variable is
uniform or varying based on what is about to be assigned to it. But if
a uniform is being assigned from within a conditional, it needs to be a
varying assignment, since it should only happen on some shading points.

A few days back, Chris Kulla observed that adjust_varying was making
this decision based on all_points_on() as a proxy for whether we were in
a conditional or not... BUT... with the "sparse" batches we are shading
for secondary rays, all points are not turned on, even when we aren't
inside a conditional! So in theory, we weren't taking nearly as much
advantage of uniforms as we should be on secondary rays (and therefore
not getting full performance from batching).

The attached patch addresses this by directly tracking when we are in
nested conditionals, and using that as the basis for the decision.
Result: at least 25% rendering speedup on production assets!

There's also a little bit of additional infrastructure to ensure we
handle orig_runflags carefully, and optionally (by compile-time #define)
gather stats about adjust_varying to verify that it works as expected.

Please review this at

Affected files:

Join to automatically receive all group messages.