-
Notifications
You must be signed in to change notification settings - Fork 344
Description
Copying into depth textures is problematic today in WebGPU - see #997 .
First, because there are depth formats without concrete formats, like depth24plus*.
Secondly, because the native API require floating point depth to be in 0.0 to 1.0 range, or otherwise declare it to be undefined behavior.
This means we can't copy from buffers into even depth32float textures. We can't even copy from r32float into them, safely! Unless we do sophisticated on-GPU processing of the data, that is.
There is one place, however, where we do have a luxury of processing the data, practically for free. It's writeTexture. The implementation needs to copy the data anyway, so it may as well clamp the values into 0-1 range. Possibly, even convert the data into the format that the depth actually expects (e.g. D24X8).
This might as well be the only way to upload data into depth textures. Should we make it possible?