Inrterop between WebGL2 and WebGPU
Asked Answered
H

1

6

My question is short: Is it possible, and if so how, to read a texture or framebuffer created by WebGPU in WebGL2?

I've googled, and the only thing I found is this bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1200466, but I can't say, that i fully understand it, or where the documentation is.

The overall goal is to create a render engine in WebGPU, copy it to a WebGL texture and use it in a QML app compiled for WebAssembly. QML does not yet support WebGPU, and it's unclear when support will come.

Hatchet answered 2/11, 2023 at 17:42 Comment(0)
S
4

There is no special interop between webgl and webgpu. In WebGL you can call texImage2D and pass it a canvas element. In WebGPU you can call copyExternalImageToTexture and pass it a canvas element. In both cases that can be a 2d canvas, a webgl canvas, a webgl2 canvas, a bitmap canvas or a webgpu canvas

Shirlshirlee answered 11/11, 2023 at 6:30 Comment(2)
do you know, whether these will trigger gpu -> gpu copies or gpu -> main memory -> gpu?Hatchet
There is no guarantee what path it will take. That said, browsers generally want it to go fast so they will try to make it gpu->gpu where possibleShirlshirlee

© 2022 - 2024 — McMap. All rights reserved.