For rendering to <canvas>
, it seems that navigator.getPreferredCanvasFormat()
is the only way to get a valid format.
As per the docs, it will always return either rgba8unorm
or bgra8unorm
, both f32
types. If I try to set the format to anything other than those, e.g. to rgba8uint
, I get GPUCanvasContext.getCurrentTexture: Canvas not configured
on render.
Yet the documentation implies that other formats are possible, by stating that
if you don’t use the preferred format when configuring the canvas
context, you may incur additional overhead, such as additional texture
copies, depending on the platform.
I’d like to use vec<u32>
on GPU and Uint32Array
(decomposable RGBA) or Uint8Array
on CPU, to reduce CPU->GPU bandwidth by 4x. Quite happy to accept the texture-conversion hit.
Am I missing something here? Is this possible?