最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - WebGPU passing texture handle between CC++ and browser - Stack Overflow

programmeradmin1浏览0评论

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)

  1. 暂无评论