engine icon indicating copy to clipboard operation
engine copied to clipboard

Investigate implementation of OffscreenCanvas API

Open mvaligursky opened this issue 4 years ago • 11 comments

Investigate implementation of https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas. This would give us:

  • possible additional performance for the application, as playcanvas part of the application including webgl would execute on separate thread
  • ability to use Atomics library https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics on both webgl and worker threads, allowing us to write a job system which can execute jobs triggered on webgl thread and get results back inside the same frame, without using messages for synchronization.

mvaligursky avatar Oct 20 '20 16:10 mvaligursky

Hi guys, Is there any update regarding to implement this feature?

issacclee avatar Jun 03 '22 08:06 issacclee

Hi @issacclee, we've not spent time investigating this yet. Probably not high priority until there is support in Safari?

slimbuck avatar Jun 03 '22 09:06 slimbuck

@mvaligursky wondering whether webgpu supports this out of the box?

slimbuck avatar Jun 03 '22 09:06 slimbuck

it does not in the initial release, but the support is expected later.

mvaligursky avatar Jun 05 '22 21:06 mvaligursky

Thanks for answering guys, am I right to assume that this probably won't get implemented unless Safari starts to support the spec?

issacclee avatar Jun 06 '22 08:06 issacclee

It will be implemented, when somebody has some time and considers this a high priority, regardless of the Safari (and Firefox by the way) support. Benefits on the android platform which is mostly using Chrome browser could be very nice. Perhaps somebody from our community of contributors could implement this as well, as this is an open source engine.

mvaligursky avatar Jun 06 '22 08:06 mvaligursky

https://webkit.org/blog/13686/release-notes-for-safari-technology-preview-161/ FYI, safari will be getting offscreencanvas as shown here in the new tech review release announcement.

issacclee avatar Jan 13 '23 08:01 issacclee

Based on this: https://www.construct.net/en/blogs/ashleys-blog-2/safari-releases-development-1616

Safari 16.4 rolled out in March 2023. Safari 16.4 adds support for OffscreenCanvas, but only the "2d" context - WebGL remains unsupported.

mvaligursky avatar May 30 '23 11:05 mvaligursky

This fall webgl context will be added for offscreencanvas to Safari. https://webkit.org/blog/14205/news-from-wwdc23-webkit-features-in-safari-17-beta/

Maksims avatar Jun 06 '23 15:06 Maksims

related: https://github.com/playcanvas/engine/pull/5168

mvaligursky avatar Jan 19 '24 11:01 mvaligursky