1

TL;DR

Can a texture created in C/C++ (e.g. in a node addon) can be shared with browser-side WebGPU via a handle?

Can a texture created browser-side can be shared with native WebGPU, via a handle?

Context

NB: My own problem is on macOS platform, but this question is not specific to any platform.

I'm a beginner in WebGPU, writing a more general purpose library (node-syphon) that can be used in Electron, and that:

  • Consumes an external Metal texture / IOSurface and send its pixels via IPC to the browser (renderer process) to be displayed in an HTMLCanvasElement;
  • Gets an HTMLCanvasElement content (pixels as Uint8Array for now) and send it via IPC to node (main process) to be passed to an external library.

Performances are obviously quite bad, but for the time being, I'm also able to get a handle from an Electron window rendered offscreen and treat it on C++ side in a node addon.

Question

Is it and how would it be possible to:

  1. Create a WebGPU texture C++-side, get a handle from this texture and treat it in the browser?

This comment in Electron suggests it is possible (note that Electron's sharedTextureHandle is actually an IOSurface on macOS and a HANDLE to the shared D3D11 texture on Windows).

  1. Create a WebGPU texture in the browser, get a handle and send it to C++ native WebGPU?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.