[Bug 74113] New: GLSL: vectorize optimization does not take branches into account
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Mon Jan 27 03:05:43 PST 2014
https://bugs.freedesktop.org/show_bug.cgi?id=74113
Priority: medium
Bug ID: 74113
Assignee: idr at freedesktop.org
Summary: GLSL: vectorize optimization does not take branches
into account
QA Contact: intel-3d-bugs at lists.freedesktop.org
Severity: normal
Classification: Unclassified
OS: All
Reporter: aras at unity3d.com
Hardware: All
Status: NEW
Version: git
Component: glsl-compiler
Product: Mesa
"Vectorize multiple scalar assignments" optimization (added in 4bd6e0d7c69 on
master) does not take possible branches into account.
For example, on a fragment shader like this:
uniform sampler2D maintex;
uniform float factor;
varying vec2 uv;
void main()
{
vec4 c = texture2D (maintex, uv);
vec2 coord = c.xy;
bool cond = c.w >= 0.5;
if (!cond)
coord.x += factor;
if (cond)
coord.y += factor;
gl_FragColor = vec4(coord,0,0);
}
It does try to merge both coord.x and coord.y assignments into one, even if
they are under different branch conditions. Effectively it ends up with "if
(cond) coord.xy += ..." which is wrong.
Real-life shaders like FXAA3.11 have a code very similar to the above, and it
regresses under this optimization.
As a simple stop-gap solution the optimization could just never go into any
branch-like structures (return visit_continue_with_parent from
visit_enter(ir_if) etc.
--
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20140127/e2fbc540/attachment.html>
More information about the intel-3d-bugs
mailing list