Behavior of GPUDevice.createBuffer when exceeding maxBufferSize
0 reputation · 03 Aug 2024, 01:55 UTC
Goal: Zero‑Downtime Migration of a Small WebGPU Application
When porting a lightweight WebGPU app to a new browser or driver, the developer must adapt to the GPU’s reported limits. One critical limit is maxBufferSize, which caps the size of any buffer created with GPUDevice.createBuffer. The spec does not define what should happen if a buffer larger than this limit is requested.
Unresolved Decision
Different browsers appear to handle the over‑limit case in divergent ways: some throw an OperationError, while others silently clamp the buffer size to the maximum allowed value. This behavior directly affects whether the application can continue running without a full context reset during migration.
Key Questions
- What is the expected behavior of
GPUDevice.createBufferwhen the requested size exceedsmaxBufferSize? - Should developers proactively check
adapter.limits.maxBufferSizeand adjust buffer sizes, or rely on the browser’s fallback? - Is there a standardized way to detect which behavior a particular implementation follows?