Skip to content

rfc: Import Shared Texture #17

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

reitowo
Copy link
Member

@reitowo reitowo commented May 30, 2025

This feature provides a way to import a native shared texture handle into Electron, specifically in the form of VideoFrame, which by nature supports several Web rendering systems including WebGPU, WebGL. This enables developers to integrate arbitrary native rendered content with their web applications.

@reitowo reitowo force-pushed the main-shared-texture branch from 0c30774 to 05b8645 Compare May 31, 2025 07:36
@samuelmaddock samuelmaddock added the pending-review Waiting for reviewers to give feedback on the PR specifications label Jun 5, 2025
@erickzhao erickzhao added pending-changes Waiting for changes from the PR author based on feedback given and removed pending-review Waiting for reviewers to give feedback on the PR specifications labels Jul 3, 2025
@reitowo
Copy link
Member Author

reitowo commented Aug 9, 2025

I decided to add 2 methods about passing syncToken, then we can manage the lifecycle for user at pure JS.

@reitowo
Copy link
Member Author

reitowo commented Aug 13, 2025

Ready for review! I significantly polished up my API design, providing a more straight forward way to use, and use Electron IPC to automatically manage lifecycles for user.

@reitowo reitowo force-pushed the main-shared-texture branch from 18ce4d7 to 3c670e3 Compare August 13, 2025 18:42
@erickzhao erickzhao added pending-review Waiting for reviewers to give feedback on the PR specifications and removed pending-changes Waiting for changes from the PR author based on feedback given labels Aug 14, 2025
* `importedSharedTexture` [SharedTextureImported](#sharedtextureimported-object) - The imported shared texture.
* `...args` any[] - Additional arguments to pass to the renderer process.

Send the imported shared texture to a renderer process. You must register receiver at renderer process before calling this method. This method has a timeout.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method has a timeout.

What would cause this method to time out? Is the timeout configurable, or is it just a fixed timeout?

Copy link
Member Author

@reitowo reitowo Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it is set to 1000ms if the renderer process doesn't reply in this amount of time. The renderer process need to reply a sync token to main process to 1) make sure it received 2) extend the lifetime of main process's Chromium resource. (i.e. prevent SharedImage ref count -> 0 until renderer process done ref count +1, at gpu side, asyncly)

I think 1000ms is large enough, so I didn't make it configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-review Waiting for reviewers to give feedback on the PR specifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants