Decode the images with browser api, like createImageBitmap or ImageDecoder, and use the underlying api to update the texture manually.
See here for an example
But I am not satisfied because bitmaps need to be loaded in an offscreen canvas, then read back to the CPU, then uploaded back with the array to the GPU: quite inefficient.
Do we have a texture gpu copy mechanism in the engine? The solution from @kzhsw uses raw WebGL calls, while I am more interested in a WebGPU solution and ideally a backend agnostic solution if it is to be integrated in the engine
That’s crazy I had no idea it was that complicated x) I hope at least WebGPU copy on Chromium is gpu-gpu. Looks like there isn’t a best solution for all browsers then
Btw is there a way to create mip maps for the layers? If I understand correctly they can be generated at construction time, but since I am copying the textures after construction, I don’t have any mip map