Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate implementation of OffscreenCanvas API #2481

Open
mvaligursky opened this issue Oct 20, 2020 · 11 comments · Fixed by #5168
Open

Investigate implementation of OffscreenCanvas API #2481

mvaligursky opened this issue Oct 20, 2020 · 11 comments · Fixed by #5168
Assignees
Labels
area: graphics Graphics related issue performance Relating to load times or frame rate

Comments

@mvaligursky
Copy link
Contributor

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 mvaligursky added performance Relating to load times or frame rate area: graphics Graphics related issue labels Oct 20, 2020
@mvaligursky mvaligursky self-assigned this Oct 20, 2020
@issacclee
Copy link
Contributor

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

@slimbuck
Copy link
Member

slimbuck commented Jun 3, 2022

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

@slimbuck
Copy link
Member

slimbuck commented Jun 3, 2022

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

@mvaligursky
Copy link
Contributor Author

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

@issacclee
Copy link
Contributor

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

@mvaligursky
Copy link
Contributor Author

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.

@issacclee
Copy link
Contributor

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.

@mvaligursky
Copy link
Contributor Author

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.

@Maksims
Copy link
Contributor

Maksims commented Jun 6, 2023

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/

@mvaligursky
Copy link
Contributor Author

related: #5168

michaelfranzl added a commit to michaelfranzl/playcanvas that referenced this issue Jul 14, 2024
michaelfranzl added a commit to michaelfranzl/playcanvas that referenced this issue Jul 14, 2024
michaelfranzl added a commit to michaelfranzl/playcanvas that referenced this issue Jul 14, 2024
michaelfranzl added a commit to michaelfranzl/playcanvas that referenced this issue Jul 15, 2024
willeastcott added a commit that referenced this issue Jul 15, 2024
* Support for OffscreenCanvas in Web Workers #2481

* Update graphics-device.js

* Update platform.js

---------

Co-authored-by: Will Eastcott <willeastcott@gmail.com>
willeastcott added a commit that referenced this issue Jul 15, 2024
* Support for OffscreenCanvas in Web Workers #2481

* Update graphics-device.js

* Update platform.js

---------

Co-authored-by: Will Eastcott <willeastcott@gmail.com>
@mvaligursky
Copy link
Contributor Author

I'll reopen this as I don't think we have all we need to easily allow users to run the rendering on a worker, which is the goal here.

@mvaligursky mvaligursky reopened this Jul 16, 2024
MAG-AdrianMeredith added a commit to magnopus/playcanvas-engine that referenced this issue Aug 6, 2024