gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.23k stars 898 forks source link

Vulkan validation error triggered when binding a storage buffer array #3088

Open euanlacy opened 1 year ago

euanlacy commented 1 year ago

Description Creating a storage buffer array using create_buffer_init(), and placing it in a bind group with layout entry ty: BindingType::Buffer { ty: BufferBindingType::Storage, ..} and count N > 0, triggers the vulkan validation error, when bound in a render_pass and a draw command is issued.

Repro steps https://github.com/euanlacy/wgpu_validation_error

Expected vs observed behavior There should probably be no validation error triggered

Extra materials [2022-10-08T10:21:08Z ERROR wgpu_hal::vulkan::instance] objects: (type: DESCRIPTOR_SET, hndl: 0xa2eb680000000026, name: Materials Bind Group) [2022-10-08T10:21:08Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-vkCmdDrawIndexed-None-02699 (0xa44449d4)] Validation Error: [ VUID-vkCmdDrawIndexed-None-02699 ] Object 0: handle = 0xa2eb680000000026, name = Materials Bind Group, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = 0xa44449d4 | Descriptor set VkDescriptorSet 0xa2eb680000000026[Materials Bind Group] encountered the following validation error at vkCmdDrawIndexed time: Descriptor in binding #1 index 1 is being used in draw but has never been updated via vkUpdateDescriptorSets() or a similar call. The Vulkan spec states: Descriptors in each bound descriptor set, specified via vkCmdBindDescriptorSets, must be valid if they are statically used by the VkPipeline bound to the pipeline bind point used by this command (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDrawIndexed-None-02699)

Platform Linux kernel 5.19.12, running on a Ryzen7 3700U, using wgpu version 0.14

cwfitzgerald commented 1 year ago

Seems like the partial binding check is broken - when partial binding is off, it should be a validation error to make a bind group with a single element and not an array without the partial binding feature enabled.