| Summary: |
GLSL: vectorize optimization does not take branches into account |
| Product: |
Mesa
|
Reporter: |
Aras Pranckevicius <aras> |
| Component: |
glsl-compiler | Assignee: |
Matt Turner <mattst88> |
| Status: |
RESOLVED
FIXED
|
QA Contact: |
Intel 3D Bugs Mailing List <intel-3d-bugs> |
| Severity: |
normal
|
|
|
| Priority: |
medium
|
|
|
| Version: |
git | |
|
| Hardware: |
All | |
|
| OS: |
All | |
|
| URL: |
http://patchwork.freedesktop.org/patch/18837/
|
| Whiteboard: |
|
|
i915 platform:
|
|
i915 features:
|
|
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.
"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.