[Mesa-dev] [Bug 83785] Shader branches excluded by uniform values are not optimized out
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Sep 11 19:43:05 PDT 2014
https://bugs.freedesktop.org/show_bug.cgi?id=83785
Roland Scheidegger <sroland at vmware.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |enhancement
Component|Mesa core |Other
--- Comment #1 from Roland Scheidegger <sroland at vmware.com> ---
Are you talking about specific drivers? Doesn't look like a mesa core problem
to me, since if it's a uniform glsl can't do anything, and drivers will have to
handle that appropriately (typically hw either has if/else constructs with
implicit built-in mask evaluation so there's jump addresses specified there
(intel hd graphics seems to work like that) or the jump is done explicitly
(radeon gcn seems to do that).
If you're talking llvmpipe, you would be right it always evaluates all
branches, no matter the current condition mask (which, in case the branch
condition is based only on uniforms, indeed means one part of the branch will
always be executed for nothing), and simply masks out the values for the not
taken branch part when storing the values. This is probably both due to
simplicity and historical reasons (don't forget early programmable hw did not
always have true branches neither). It is something I was thinking about, I
think there'd definitely be benefits but I never looked at it closely enough to
know how much work it would be. For starters, you'd need to put the code in the
branches into different basic blocks, and get all the things right related to
it. In some cases it could possibly be a loss due to missing some optimizations
(if both branches need to be evaluated - I don't think you'd want to do this
just in case of uniform branch condition, though this might be a start).
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140912/74ab1df3/attachment.html>
More information about the mesa-dev
mailing list