engine
engine copied to clipboard
Implement video texture support for WebGPU
WebGL can play video textures, and we need to implement support for this for WebGPU.
https://playcanvas.github.io/#/graphics/video-texture
See the video section here: https://toji.dev/webgpu-best-practices/img-textures.html
As this needs to use a custom sampling instruction, it might be difficult to use video texture directly from the external texture, which would be the best performance. This instruction might not be available with our GLSL->WGSL compilation. Instead, we might write a custom WGSL shader, which copies the external texture, and from then on it can be used as any other texture. The extra cost here would be the additional copy.
A solution with a video -> normal texture copy is done here: https://github.com/playcanvas/engine/pull/6280 This matches our WebGL implementation.
This issue stays open, we we'd like to have a solution that avoids the copy, which is possible on WebGPU using WGSL shaders.