-
Notifications
You must be signed in to change notification settings - Fork 345
Description
The spec currently enforces that "The binding of each entry in descriptor must be < 65536"
I propose lowering this limit to 512.
The reason for this is that wgpu implements createBindGroupLayout directly on top of vulkan's vkCreateDescriptorSetLayout. Vulkan drivers don't have a particular limit for binding indices but the spec is designed to encourage allocating a contiguous buffer for binding slots which size is a function of the maximum binding index. We observed that some drivers can run into serious issues with large binding indices, including failing to perform the allocation and issuing writes into the buffer. An easy oversight when vulkan good practices recommend using small, mostly contiguous binding indices and therefore it is very unlikely for the allocation to fail with a well behaved program.
I realize that Dawn is not affected as it renames binding indices on all platforms. We think that there is value in keeping the direct implementation for at least one backend in wgpu in part because the renaming forces postponing some validation. So we would like to avoid making the spec impossible to implement robustly without renaming.
512 is a low enough number to make the risk of driver unsafety very low, while not limiting the number of bindings that can be used by a large margin since GPUs rarely have more than about 32 binding slot per resource type.
The limit could be backward-compatibly relaxed in the future if need be.