On certain Nvidia cards, using buffer offsets that aren't multiples of 256 creates problems and gives this error:
2019-05-07 22:04:45 ERROR [gfx_backend_vulkan] [Validation] [ VUID-vkCmdBindDescriptorSets-pDynamicOffsets-01971 ] Object: VK_NULL_HANDLE (Type = 2) | vkCmdBindDescriptorSets(): pDynamicOffsets[0] is 64 but must be a multiple of device limit minUniformBufferOffsetAlignment 0x100. The Vulkan spec states: Each element of pDynamicOffsets which corresponds to a descriptor binding with type VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC must be a multiple of VkPhysicalDeviceLimits::minUniformBufferOffsetAlignment (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkCmdBindDescriptorSets-pDynamicOffsets-01971)
I'm not sure what the right solution is, we can:
Thoughts?
Thank you for filing the issue!
The current status of WebGPU API requirements is that any offsets into buffers should be 256-aligned, but this isn't yet set in stone (i.e. there are concerns...).
While the working group is figuring this out, we should at least check the user-provided offsets against the actual adapter limits, like we do for the non-dynamic bind groups.
Hmm I see - I guess this number 256 should be exposed by wgpu somewhere in the API so that users can ensure their offsets are aligned?
Yes, we need to have it exposed as a public constant. Want to help with this PR? :)
We also need to validate the dynamic offsets against that alignment. We currently validate all the other offsets correctly, but not the dynamic ones.