Skip to content

Commit

Permalink
Bug 1884791 - Avoid shader miscompilation on some Adreno drivers. r=gw
Browse files Browse the repository at this point in the history
Webrender's glslopt-optimized shaders encounter a miscompilation on
some Adreno driver versions regarding fetching empty clip tasks. This
patch reshuffles the code in such a way as to avoid the
bug. Unfortunately the specific cause of the miscompilation remains
unknown, meaning we must take extra care not to regress it in the
future.

Differential Revision: https://phabricator.services.mozilla.com/D204864
  • Loading branch information
jamienicol committed Mar 17, 2024
1 parent 0304f8c commit 2d3233c
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions gfx/wr/webrender/res/render_task.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,22 @@ struct ClipArea {
};

ClipArea fetch_clip_area(int index) {
ClipArea area;

RenderTaskData task_data;
if (index >= CLIP_TASK_EMPTY) {
area.task_rect = RectWithEndpoint(vec2(0.0), vec2(0.0));
area.device_pixel_scale = 0.0;
area.screen_origin = vec2(0.0);
// We deliberately create a dummy RenderTaskData here then convert to a
// ClipArea after this if-else statement, rather than initialize the
// ClipArea in separate branches, to avoid a miscompile in some Adreno
// drivers. See bug 1884791. Unfortunately the specific details of the bug
// are unknown, so please take extra care not to regress this when
// refactoring.
task_data = RenderTaskData(RectWithEndpoint(vec2(0.0), vec2(0.0)),
vec4(0.0));
} else {
RenderTaskData task_data = fetch_render_task_data(index);

area.task_rect = task_data.task_rect;
area.device_pixel_scale = task_data.user_data.x;
area.screen_origin = task_data.user_data.yz;
task_data = fetch_render_task_data(index);
}

return area;
return ClipArea(task_data.task_rect, task_data.user_data.x,
task_data.user_data.yz);
}

#endif //WR_VERTEX_SHADER

0 comments on commit 2d3233c

Please sign in to comment.