Closed Bug 2052528 Opened 2 months ago Closed 2 months ago

Metal ANGLE cannot draw a single vertex/instance if attribute size is not aligned to 4 bytes

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: jnicol, Assigned: jnicol)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxpe])

Attachments

(2 files)

We run into this issue when attempting to run webrender on Metal ANGLE (bug 2052515).

Metal does not support binding vertex attributes where the offset + stride > buffer_len. To work around this, ANGLE will in such cases set the stride to the size of the single attribute. However, Metal also requires that the strides are aligned to 4 bytes.

When we have instance attributes that are not 4-byte aligned, and attempt to draw a single instance, we therefore hit this assertion.

Specifically, this happens when drawing a single instance with cs_svg_filter_node, which has 2x u16 attributes.

If we pack these into a u16x2 we can avoid the crash.

Metal requires that vertex attributes' offsets + strides do not extend
beyond the end of their buffer. When drawing a single vertex or
instance, ANGLE therefore clamps the stride to the size of the single
attribute. Unfortunately, however, Metal also requires that vertex
attribute strides are aligned to 4 bytes.

This makes it impossible to use non-4-byte-aligned instance attributes
on Metal ANGLE, as attempting to draw a single instance will fail due
to invalid alignment.

To avoid this, we ensure instance attributes are always aligned to 4
bytes. Specifically, this means packing cs_svg_filter_node's filter
kind and input count attributes into a u16x2 vector, rather than as
2 separate u16 scalars.

Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch
Regressions: 2055541
No longer regressions: 2055541
QA Whiteboard: [qa-triage-done-c155/b154]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: