Closed Bug 1731758 Opened 3 years ago Closed 3 years ago

Image filters (brightness, contrast, grayscale etc) render with triangle artifacts [Adreno 3xx]

Categories

(Core :: Graphics: WebRender, defect)

Firefox 94
Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
94 Branch
Tracking Status
firefox92 --- wontfix
firefox93 --- wontfix
firefox94 --- fixed

People

(Reporter: ke5trel, Assigned: jnicol)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Samsung Galaxy Tab 4 (SM-T530)
Android 5.0.2
Qualcomm Adreno (TM) 305
OpenGL ES 3.0 V@84.0

Blur, opacity and drop-shadow image filters work but triangle artifacts appear for brightness, contrast, grayscale, hue-rotate, invert, saturate and sepia.

https://www.w3schools.com/css/tryit.asp?filename=trycss_ex_images_filters

The issue appears to stem from the ComponentTransfer filter code in the brush_blend shader. Even though component transfer is not used in this test case the presence of the code breaks the whole shader. (The working filters in the test case do not use that shader.)

For component transfers we encode the function to use for each component in the varying ivec4 v_funcs. We used to use an int[4] array rather than a vector, but on a different Adreno 3xx device there is a bug limiting the number of varying slots we can use (bug 1695912), so we changed this to use a vector, which unfortunately causes this bug. The only solution I've found which doesn't run in to either bug is to pack each of the function codes in to 4 bits each of an integer (like we do to pass the data in to the vertex shader in the first place). Then unpack them in the fragment shader rather than the vertex shader.

Additionally, however, due to bug 1630356 we cannot use a flat varying int, therefore we must use a flat varying ivec2, and pack the funcs as described in to just the x component.

Finally, after doing all this, component transfer filters are actually still broken on this device (but no more so than before). However it seems best to land the fix for the rest of the filters here, and address that in a follow up.

On some Adreno 3xx devices the brush blend shader renders
garbage. This appears to be due to declaring the v_funcs varying (used
for component transfer filters) as an ivec4, though it is unclear
exactly why this breaks it. Previously we used an int[4], but that ran
afoul of another driver bug on some Adreno 3xx devices (bug 1695912).

This patch alternatively packs each of the component functions in to 4
bits of an integer, and unpacks the values in the fragment
shader. However, due to yet another Adreno 3xx driver bug (bug
1630356) we cannot simply use an int, and instead must use the x
component of a vec2.

This fixes the brush_blend shader for the majority of blend modes,
whilst avoiding the known bugs above. Component transfer itself is
still broken, though no moreso than prior to this patch. Fixing
component transfer will be handled in a separate bug.

Assignee: nobody → jnicol
Status: NEW → ASSIGNED
Pushed by jnicol@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/95cf25be6228 Avoid Adreno 3xx driver bug in brush_blend shader. r=gfx-reviewers,nical
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
Blocks: 1734815
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: