html5_webgpu.h missing (import/export for device/texure) #25657
-
| trying to import the device and texture from JavaScript WebXR, the html5_webgpu.h also went away in favor of the dawn port #25398 . the previous implementation looked like this: is there any proper way now to import the device? (I also planned to make a getter for the WGPUTexture from the WebXR frame to render into on the C++ side of code. | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
| Apologies we haven't really documented this! Emdawnwebgpu has - for all objects, but with Texture as an example: 
 These are both called from JS - you no longer need to explicitly call any C API to export something before getting it from JS. We haven't totally committed to a stable API for this. I don't think it will change too much, but note in particular that  (EDIT: Added some extra details) Dawn tracking bug for documentation/samples: https://crbug.com/416377157 | 
Beta Was this translation helpful? Give feedback.
-
| BTW, I should have mentioned - if you just need  | 
Beta Was this translation helpful? Give feedback.
Apologies we haven't really documented this! Emdawnwebgpu has - for all objects, but with Texture as an example:
WebGPU.importJsTexture(obj)takes a JS object, puts it in the Wasm object table, and returns its ID which you need to cast toWGPUTexture. (Imports it with a C refcount of 1 and, once we implement auto-destroy, imported objects probably won't be auto-destroyed.) Then if you want that in C++, usewgpu::Texture::Acquire(WGPUTexture).WebGPU.getJsObject(id)for getting the JS object from a WasmWGPUTextureID. (Doesn't affect the C refcount.)These are both called from JS - you no longer need to explicitly call any C API to export something before getting it from JS.
We haven't …