Open aleino-nv opened 1 week ago
Example WebGPU error message:
WGPU error: Buffer usages (BufferUsage::(MapWrite|CopySrc|CopyDst)) is invalid. If a buffer usage contains
BufferUsage::MapWrite the only other allowed usage is BufferUsage::CopySrc.
- While calling [Device].CreateBuffer([BufferDescriptor "Unnamed buffer (size=96, elementSize=0, format=Unknown,
memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"]).
Thus far, when I've run into this it has turned out that MemoryType::Upload
wasn't actually necessary -- the buffers typically get initialized with data at creation time and then never updated from the host.
Switching to MemoryType::DeviceLocal
is often a viable workaround.
It is a WebGPU limitation that mappable buffers can't have any other usages. (The spec mentions this clearly.)
Currently in Slang-RHI, if a buffer with
MemoryType::Upload
is created then this constraint will be violated and buffer creation just fails.