Open Bug 762973 Opened 12 years ago Updated 2 years ago

All Canvas2d globalCompositeOperations except "source-over" are very slow

Categories

(Core :: Graphics: Canvas2D, defect)

x86
Windows 7
defect

Tracking

()

People

(Reporter: gbarnett, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [games:p?])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19

Steps to reproduce:

Went to http://jsperf.com/canvas-global-composite-operations


Actual results:

The "source-atop" test achieved over 248,000 ops/sec.

Every other global composite operation achieved under 2,000 ops/sec



Expected results:

The other GCO's should have achieved higher than 2,000; in Firefox 11, they most achieved in the 60,000 range (see attached graph)

This issue affects FF 12 and FF 13
Summary: All Canvas2d globalCompositeOperations except "source-atop" are very slow in FF12 → All Canvas2d globalCompositeOperations except "source-atop" are very slow in FF12 and FF13
Summary: All Canvas2d globalCompositeOperations except "source-atop" are very slow in FF12 and FF13 → All Canvas2d globalCompositeOperations except "source-over" are very slow in FF12 and FF13
Oops, I said "source-atop", but meant "source-over"

"source-over" is the default, and the one that's really fast.
I use "lighter" extensively because it's the only remotely efficient way to approximate the GL_MULTIPLY blend equation in canvas. IIRC based on discussions with the GFX guys this problem is caused by Direct2D not exposing any control over blend operations, so any non-source-atop blend operation requires an expensive Direct3D fallback.
Hardware: x86_64 → x86
Component: Untriaged → Canvas: 2D
Product: Firefox → Core
QA Contact: untriaged → canvas.2d
For a real-world example, the level editor in http://playescapegoat.com/ gets absolutely murdered by this. Even caching the rendered output isn't enough.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Blocks: gecko-games
Summary: All Canvas2d globalCompositeOperations except "source-over" are very slow in FF12 and FF13 → All Canvas2d globalCompositeOperations except "source-over" are very slow
Whiteboard: [games:p2]
Note: This is still slow with Firefox 23 + Direct2D/Azure canvas.
Note also: CompositeOperations like "lighter" works pretty fast in other browsers like Chrome. It would be a nice feature for particle effects.
Version: 13 Branch → Trunk
This is still an issue.
I've checked the original test case at http://jsperf.com/canvas-global-composite-operations

Current beta (38.0.5) renders all composition modes other than "source-over" at 4% of the speed of "source-over".

In contrast, Chrome 42 renders at 40%-70% of the speed of "source-over" (which is 10% faster than Firefox on same PC anyway).

Thus, Chrome renders upto 10-20 times faster.
Whiteboard: [games:p2] → [games:p?]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: