From c7a002b668470d650ab3b99711b6c657cdcd0e22 Mon Sep 17 00:00:00 2001 From: spencer-lunarg Date: Thu, 12 Dec 2024 22:32:40 +0900 Subject: [PATCH] tests: Create a OneOffDescriptorIndexingSet --- tests/framework/descriptor_helper.cpp | 81 +++- tests/framework/descriptor_helper.h | 38 +- tests/unit/best_practices.cpp | 24 +- tests/unit/descriptor_indexing.cpp | 6 +- tests/unit/descriptor_indexing_positive.cpp | 30 +- tests/unit/descriptors.cpp | 25 +- ...gpu_av_descriptor_class_general_buffer.cpp | 10 +- ...scriptor_class_general_buffer_positive.cpp | 10 +- tests/unit/gpu_av_descriptor_indexing.cpp | 443 ++++++------------ .../gpu_av_descriptor_indexing_positive.cpp | 239 ++++------ tests/unit/gpu_av_descriptor_post_process.cpp | 106 ++--- ...pu_av_descriptor_post_process_positive.cpp | 100 ++-- tests/unit/gpu_av_image_layout.cpp | 20 +- tests/unit/gpu_av_image_layout_positive.cpp | 20 +- tests/unit/gpu_av_positive.cpp | 4 +- tests/unit/gpu_av_ray_tracing.cpp | 13 +- tests/unit/graphics_library.cpp | 16 +- tests/unit/image_layout_positive.cpp | 20 +- tests/unit/pipeline.cpp | 14 +- tests/unit/pipeline_positive.cpp | 37 +- tests/unit/ray_tracing_nv.cpp | 2 +- tests/unit/ray_tracing_pipeline.cpp | 18 +- tests/unit/render_pass_positive.cpp | 3 +- tests/unit/shader_image_access_positive.cpp | 80 ++-- tests/unit/shader_spirv_positive.cpp | 6 +- tests/unit/sync_val.cpp | 2 +- tests/unit/sync_val_positive.cpp | 32 +- tests/unit/threading_positive.cpp | 48 +- 28 files changed, 537 insertions(+), 910 deletions(-) diff --git a/tests/framework/descriptor_helper.cpp b/tests/framework/descriptor_helper.cpp index 334197caa47..675a336390f 100644 --- a/tests/framework/descriptor_helper.cpp +++ b/tests/framework/descriptor_helper.cpp @@ -12,23 +12,78 @@ #include "descriptor_helper.h" -OneOffDescriptorSet::OneOffDescriptorSet(vkt::Device *device, const Bindings &bindings, +OneOffDescriptorSet::OneOffDescriptorSet(vkt::Device *device, const std::vector &bindings, VkDescriptorSetLayoutCreateFlags layout_flags, void *layout_pnext, - VkDescriptorPoolCreateFlags poolFlags, void *allocate_pnext, void *create_pool_pnext) - : device_{device}, pool_{}, layout_(*device, bindings, layout_flags, layout_pnext), set_(VK_NULL_HANDLE) { - VkResult err; - std::vector sizes; - for (const auto &b : bindings) sizes.emplace_back(VkDescriptorPoolSize{b.descriptorType, std::max(1u, b.descriptorCount)}); - - VkDescriptorPoolCreateInfo dspci = { - VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, create_pool_pnext, poolFlags, 1, uint32_t(sizes.size()), sizes.data()}; - err = vk::CreateDescriptorPool(device_->handle(), &dspci, nullptr, &pool_); + VkDescriptorPoolCreateFlags pool_flags, void *allocate_pnext, void *create_pool_pnext) + : device_{device}, layout_(*device, bindings, layout_flags, layout_pnext) { + std::vector pool_sizes; + for (const auto &b : bindings) { + pool_sizes.emplace_back(VkDescriptorPoolSize{b.descriptorType, std::max(1u, b.descriptorCount)}); + } + + VkDescriptorPoolCreateInfo pool_ci = vku::InitStructHelper(create_pool_pnext); + pool_ci.flags = pool_flags; + pool_ci.maxSets = 1; + pool_ci.poolSizeCount = pool_sizes.size(); + pool_ci.pPoolSizes = pool_sizes.data(); + VkResult err = vk::CreateDescriptorPool(device_->handle(), &pool_ci, nullptr, &pool_); + if (err != VK_SUCCESS) return; + + if ((layout_flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT) == 0) { + VkDescriptorSetAllocateInfo ds_alloc_info = vku::InitStructHelper(allocate_pnext); + ds_alloc_info.descriptorPool = pool_; + ds_alloc_info.descriptorSetCount = 1; + ds_alloc_info.pSetLayouts = &layout_.handle(); + err = vk::AllocateDescriptorSets(device_->handle(), &ds_alloc_info, &set_); + } +} + +OneOffDescriptorIndexingSet::OneOffDescriptorIndexingSet(vkt::Device *device, const OneOffDescriptorIndexingSet::Bindings &bindings, + void *allocate_pnext, void *create_pool_pnext) { + device_ = device; + std::vector pool_sizes; + VkDescriptorSetLayoutCreateFlags layout_flags = 0; + VkDescriptorPoolCreateFlags pool_flags = 0; + std::vector ds_layout_bindings; + std::vector ds_binding_flags; + + for (const auto &b : bindings) { + pool_sizes.emplace_back(VkDescriptorPoolSize{b.descriptorType, std::max(1u, b.descriptorCount)}); + ds_layout_bindings.emplace_back( + VkDescriptorSetLayoutBinding{b.binding, b.descriptorType, b.descriptorCount, b.stageFlags, b.pImmutableSamplers}); + ds_binding_flags.emplace_back(b.flag); + + // Automatically set the needed flags if using UAB + if (b.flag & VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT) { + layout_flags = VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT; + pool_flags = VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT; + } + } + + VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); + flags_create_info.bindingCount = ds_binding_flags.size(); + flags_create_info.pBindingFlags = ds_binding_flags.data(); + + VkDescriptorSetLayoutCreateInfo ds_layout_ci = vku::InitStructHelper(&flags_create_info); + ds_layout_ci.flags = layout_flags; + ds_layout_ci.bindingCount = ds_layout_bindings.size(); + ds_layout_ci.pBindings = ds_layout_bindings.data(); + layout_.init(*device, ds_layout_ci); + + VkDescriptorPoolCreateInfo pool_ci = vku::InitStructHelper(create_pool_pnext); + pool_ci.flags = pool_flags; + pool_ci.maxSets = 1; + pool_ci.poolSizeCount = pool_sizes.size(); + pool_ci.pPoolSizes = pool_sizes.data(); + VkResult err = vk::CreateDescriptorPool(device_->handle(), &pool_ci, nullptr, &pool_); if (err != VK_SUCCESS) return; if ((layout_flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT) == 0) { - VkDescriptorSetAllocateInfo alloc_info = {VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, allocate_pnext, pool_, 1, - &layout_.handle()}; - err = vk::AllocateDescriptorSets(device_->handle(), &alloc_info, &set_); + VkDescriptorSetAllocateInfo ds_alloc_info = vku::InitStructHelper(allocate_pnext); + ds_alloc_info.descriptorPool = pool_; + ds_alloc_info.descriptorSetCount = 1; + ds_alloc_info.pSetLayouts = &layout_.handle(); + err = vk::AllocateDescriptorSets(device_->handle(), &ds_alloc_info, &set_); } } diff --git a/tests/framework/descriptor_helper.h b/tests/framework/descriptor_helper.h index c07d6a286a2..b6f8a9a5bf1 100644 --- a/tests/framework/descriptor_helper.h +++ b/tests/framework/descriptor_helper.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2023 The Khronos Group Inc. - * Copyright (c) 2023 Valve Corporation - * Copyright (c) 2023 LunarG, Inc. + * Copyright (c) 2023-2024 The Khronos Group Inc. + * Copyright (c) 2023-2024 Valve Corporation + * Copyright (c) 2023-2024 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,12 @@ #include "layer_validation_tests.h" -struct OneOffDescriptorSet { +class OneOffDescriptorSet { + public: vkt::Device *device_; - VkDescriptorPool pool_; + VkDescriptorPool pool_{}; vkt::DescriptorSetLayout layout_; - VkDescriptorSet set_; - typedef std::vector Bindings; + VkDescriptorSet set_{VK_NULL_HANDLE}; // Only one member of ResourceInfo object contains a value. // The pointers to Image/Buffer/BufferView info structures can't be stored in 'descriptor_writes' @@ -34,9 +34,11 @@ struct OneOffDescriptorSet { std::vector resource_infos; std::vector descriptor_writes; - OneOffDescriptorSet(vkt::Device *device, const Bindings &bindings, VkDescriptorSetLayoutCreateFlags layout_flags = 0, - void *layout_pnext = nullptr, VkDescriptorPoolCreateFlags poolFlags = 0, void *allocate_pnext = nullptr, + OneOffDescriptorSet(vkt::Device *device, const std::vector &bindings, + VkDescriptorSetLayoutCreateFlags layout_flags = 0, void *layout_pnext = nullptr, + VkDescriptorPoolCreateFlags pool_flags = 0, void *allocate_pnext = nullptr, void *create_pool_pnext = nullptr); + OneOffDescriptorSet(){}; ~OneOffDescriptorSet(); bool Initialized(); void Clear(); @@ -56,3 +58,21 @@ struct OneOffDescriptorSet { void AddDescriptorWrite(uint32_t binding, uint32_t array_element, VkDescriptorType descriptor_type, uint32_t descriptor_count = 1); }; + +// Descriptor Indexing focused variation +class OneOffDescriptorIndexingSet : public OneOffDescriptorSet { + public: + // Same as VkDescriptorSetLayoutBinding but ties the flags into it + struct Binding { + uint32_t binding; + VkDescriptorType descriptorType; + uint32_t descriptorCount; + VkShaderStageFlags stageFlags; + const VkSampler *pImmutableSamplers; + VkDescriptorBindingFlags flag; + }; + typedef std::vector Bindings; + + OneOffDescriptorIndexingSet(vkt::Device *device, const Bindings &bindings, void *allocate_pnext = nullptr, + void *create_pool_pnext = nullptr); +}; \ No newline at end of file diff --git a/tests/unit/best_practices.cpp b/tests/unit/best_practices.cpp index 29d82a44870..7ac1166a0f1 100644 --- a/tests/unit/best_practices.cpp +++ b/tests/unit/best_practices.cpp @@ -1159,25 +1159,17 @@ TEST_F(VkBestPracticesLayerTest, ThreadUpdateDescriptorUpdateAfterBindNoCollisio RETURN_IF_SKIP(Init()); InitRenderTarget(); - std::array flags = { - {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = (uint32_t)flags.size(); - flags_create_info.pBindingFlags = flags.data(); - - OneOffDescriptorSet normal_descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); - + OneOffDescriptorIndexingSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, + nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, + nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); vkt::Buffer buffer(*m_device, 256, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); ThreadTestData data; data.device = device(); - data.descriptorSet = normal_descriptor_set.set_; + data.descriptorSet = descriptor_set.set_; data.binding = 0; data.buffer = buffer.handle(); std::atomic bailout{false}; @@ -1190,7 +1182,7 @@ TEST_F(VkBestPracticesLayerTest, ThreadUpdateDescriptorUpdateAfterBindNoCollisio ThreadTestData data2; data2.device = device(); - data2.descriptorSet = normal_descriptor_set.set_; + data2.descriptorSet = descriptor_set.set_; data2.binding = 1; data2.buffer = buffer.handle(); data2.bailout = &bailout; diff --git a/tests/unit/descriptor_indexing.cpp b/tests/unit/descriptor_indexing.cpp index b00f671afaa..676ca837352 100644 --- a/tests/unit/descriptor_indexing.cpp +++ b/tests/unit/descriptor_indexing.cpp @@ -28,8 +28,8 @@ TEST_F(NegativeDescriptorIndexing, UpdateAfterBind) { RETURN_IF_SKIP(Init()); InitRenderTarget(); - VkDescriptorBindingFlagsEXT flags[3] = {0, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; + VkDescriptorBindingFlags flags[3] = {0, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); flags_create_info.bindingCount = 3; flags_create_info.pBindingFlags = &flags[0]; @@ -207,7 +207,7 @@ TEST_F(NegativeDescriptorIndexing, SetLayout) { RETURN_IF_SKIP(Init()); - std::array flags = { + std::array flags = { {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}}; VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); flags_create_info.bindingCount = size32(flags); diff --git a/tests/unit/descriptor_indexing_positive.cpp b/tests/unit/descriptor_indexing_positive.cpp index 405c118819f..5c4d3f59f2f 100644 --- a/tests/unit/descriptor_indexing_positive.cpp +++ b/tests/unit/descriptor_indexing_positive.cpp @@ -37,7 +37,7 @@ TEST_F(PositiveDescriptorIndexing, BindingPartiallyBound) { RETURN_IF_SKIP(Init()); InitRenderTarget(); - VkDescriptorBindingFlagsEXT ds_binding_flags[2] = {}; + VkDescriptorBindingFlags ds_binding_flags[2] = {}; VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); ds_binding_flags[0] = 0; // No Error @@ -109,16 +109,10 @@ TEST_F(PositiveDescriptorIndexing, UpdateAfterBind) { vkt::Buffer buffer2(*m_device, 4096, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT); vkt::Buffer buffer3(*m_device, 4096, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT); - OneOffDescriptorSet::Bindings binding_defs = { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }; - VkDescriptorBindingFlagsEXT flags[2] = {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 2; - flags_create_info.pBindingFlags = flags; - OneOffDescriptorSet descriptor_set(m_device, binding_defs, VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, - &flags_create_info, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set( + m_device, + {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); descriptor_set.WriteDescriptorBufferInfo(0, buffer1, 0, VK_WHOLE_SIZE, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); @@ -185,16 +179,10 @@ TEST_F(PositiveDescriptorIndexing, PartiallyBoundDescriptors) { vkt::Buffer buffer1(*m_device, 4096, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT); vkt::Buffer buffer3(*m_device, 4096, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT); - OneOffDescriptorSet::Bindings binding_defs = { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }; - VkDescriptorBindingFlagsEXT flags[2] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 2; - flags_create_info.pBindingFlags = flags; - OneOffDescriptorSet descriptor_set(m_device, binding_defs, VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, - &flags_create_info, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set( + m_device, + {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); descriptor_set.WriteDescriptorBufferInfo(0, buffer1, 0, VK_WHOLE_SIZE, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); diff --git a/tests/unit/descriptors.cpp b/tests/unit/descriptors.cpp index e0d7dfa16a2..6f9f1902d4b 100644 --- a/tests/unit/descriptors.cpp +++ b/tests/unit/descriptors.cpp @@ -235,15 +235,16 @@ TEST_F(NegativeDescriptors, WriteDescriptorSetIntegrity) { vkt::Sampler sampler(*m_device, SafeSaneSamplerCreateInfo()); - OneOffDescriptorSet::Bindings bindings = {{0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, NULL}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, - {2, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, &sampler.handle()}, - {3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, - {4, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, - {5, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, - {6, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, NULL}, - {7, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, - {8, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}}; + std::vector bindings = { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, NULL}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, + {2, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, &sampler.handle()}, + {3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, + {4, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, + {5, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, + {6, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, NULL}, + {7, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}, + {8, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL}}; OneOffDescriptorSet descriptor_set(m_device, bindings); ASSERT_TRUE(descriptor_set.Initialized()); @@ -4015,7 +4016,7 @@ TEST_F(NegativeDescriptors, DISABLED_AllocatingVariableDescriptorSets) { AddRequiredFeature(vkt::Feature::descriptorBindingVariableDescriptorCount); RETURN_IF_SKIP(Init()); - VkDescriptorBindingFlagsEXT flags[2] = {0, VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT}; + VkDescriptorBindingFlags flags[2] = {0, VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT}; VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); flags_create_info.bindingCount = 2; flags_create_info.pBindingFlags = flags; @@ -4860,7 +4861,7 @@ TEST_F(NegativeDescriptors, DescriptorIndexingMissingFeatures) { RETURN_IF_SKIP(Init()); - VkDescriptorBindingFlagsEXT flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; + VkDescriptorBindingFlags flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); flags_create_info.bindingCount = 1u; flags_create_info.pBindingFlags = &flag; @@ -4943,7 +4944,7 @@ TEST_F(NegativeDescriptors, IncompatibleDescriptorFlagsWithBindingFlags) { bindings[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; bindings[1].pImmutableSamplers = nullptr; - VkDescriptorBindingFlagsEXT binding_flags[] = {VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, 0}; + VkDescriptorBindingFlags binding_flags[] = {VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, 0}; VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); flags_create_info.bindingCount = 1u; flags_create_info.pBindingFlags = binding_flags; diff --git a/tests/unit/gpu_av_descriptor_class_general_buffer.cpp b/tests/unit/gpu_av_descriptor_class_general_buffer.cpp index f1da669481a..ffa40fe47e8 100644 --- a/tests/unit/gpu_av_descriptor_class_general_buffer.cpp +++ b/tests/unit/gpu_av_descriptor_class_general_buffer.cpp @@ -1327,14 +1327,8 @@ TEST_F(NegativeGpuAVDescriptorClassGeneralBuffer, PartialBoundDescriptorSSBO) { } )glsl"; - VkDescriptorBindingFlags binding_flags = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}}, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); diff --git a/tests/unit/gpu_av_descriptor_class_general_buffer_positive.cpp b/tests/unit/gpu_av_descriptor_class_general_buffer_positive.cpp index 8fc4c93bef8..6a01cca1e59 100644 --- a/tests/unit/gpu_av_descriptor_class_general_buffer_positive.cpp +++ b/tests/unit/gpu_av_descriptor_class_general_buffer_positive.cpp @@ -605,14 +605,8 @@ TEST_F(PositiveGpuAVDescriptorClassGeneralBuffer, PartialBoundDescriptorSSBOUpda } )glsl"; - VkDescriptorBindingFlags binding_flags = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}}, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); diff --git a/tests/unit/gpu_av_descriptor_indexing.cpp b/tests/unit/gpu_av_descriptor_indexing.cpp index 43db14ba5a1..08abd4279b7 100644 --- a/tests/unit/gpu_av_descriptor_indexing.cpp +++ b/tests/unit/gpu_av_descriptor_indexing.cpp @@ -33,19 +33,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, ArrayOOBBuffer) { // Make another buffer to populate the buffer array to be indexed vkt::Buffer buffer1(*m_device, 1024, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags[2] = {0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); - + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); VkDescriptorBufferInfo buffer_info[7] = {}; @@ -150,21 +143,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, ArrayOOBVertex) { // Make a uniform buffer to be passed to the shader that contains the invalid array index. vkt::Buffer buffer0(*m_device, 1024, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags[2] = { - 0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - // Prepare descriptors - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &layout_createinfo_binding_flags, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set( + m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Image image(*m_device, 16, 16, 1, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT); @@ -259,21 +243,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, ArrayOOBFragment) { // Make a uniform buffer to be passed to the shader that contains the invalid array index. vkt::Buffer buffer0(*m_device, 1024, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags[2] = { - 0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - // Prepare descriptors - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &layout_createinfo_binding_flags, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set( + m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Image image(*m_device, 16, 16, 1, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT); @@ -377,7 +352,6 @@ TEST_F(NegativeGpuAVDescriptorIndexing, ArrayOOBRuntime) { layout_createinfo_binding_flags.bindingCount = 2; layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - // Prepare descriptors OneOffDescriptorSet descriptor_set(m_device, { {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, @@ -681,19 +655,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, ArrayOOBTess) { // Make another buffer to populate the buffer array to be indexed vkt::Buffer buffer1(*m_device, 1024, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags[2] = {0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); - + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); VkDescriptorBufferInfo buffer_info[7] = {}; @@ -800,19 +767,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, ArrayOOBGeom) { // Make another buffer to populate the buffer array to be indexed vkt::Buffer buffer1(*m_device, 1024, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags[2] = {0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); - + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); VkDescriptorBufferInfo buffer_info[7] = {}; @@ -919,19 +879,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, ArrayOOBCompute) { // Make another buffer to populate the buffer array to be indexed vkt::Buffer buffer1(*m_device, 1024, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags[2] = {0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); - + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); VkDescriptorBufferInfo buffer_info[7] = {}; @@ -1501,18 +1454,13 @@ TEST_F(NegativeGpuAVDescriptorIndexing, BasicHLSL) { buffer_ptr[0] = 5; // go past textures[4] buffer.Memory().Unmap(); - VkDescriptorBindingFlagsEXT ds_binding_flags[3] = {0, 0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 3; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 4, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 4, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Image image(*m_device, 16, 16, 1, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT); @@ -1879,21 +1827,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleOOBInMultipleCmdBuffers) { // Make a uniform buffer to be passed to the shader that contains the invalid array index. vkt::Buffer buffer0(*m_device, 1024, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags_cb_1[2] = { - 0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags_cb_1 = vku::InitStructHelper(); - layout_createinfo_binding_flags_cb_1.bindingCount = 2; - layout_createinfo_binding_flags_cb_1.pBindingFlags = ds_binding_flags_cb_1; - - // Prepare descriptors - OneOffDescriptorSet descriptor_set_cb_1(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, - &layout_createinfo_binding_flags_cb_1, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set_cb_1( + m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_cb_1(*m_device, {&descriptor_set_cb_1.layout_}); vkt::Image image_cb_1(*m_device, 16, 16, 1, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT); @@ -1989,19 +1928,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleOOBInMultipleCmdBuffers) { // Make another buffer to populate the buffer array to be indexed vkt::Buffer buffer1_cb_2(*m_device, 1024, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags_cb_2[2] = {0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags_cb_2 = vku::InitStructHelper(); - layout_createinfo_binding_flags_cb_2.bindingCount = 2; - layout_createinfo_binding_flags_cb_2.pBindingFlags = ds_binding_flags_cb_2; - - OneOffDescriptorSet descriptor_set_cb_2(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags_cb_2, 0); - + OneOffDescriptorIndexingSet descriptor_set_cb_2( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_cb_2(*m_device, {&descriptor_set_cb_2.layout_}); { VkDescriptorBufferInfo buffer_info_cb_2[7] = {}; @@ -2088,21 +2020,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleOOBTypesInOneCmdBuffer) { // Make a uniform buffer to be passed to the shader that contains the invalid array index. vkt::Buffer buffer0(*m_device, 1024, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags_cb_1[2] = { - 0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags_cb_1 = vku::InitStructHelper(); - layout_createinfo_binding_flags_cb_1.bindingCount = 2; - layout_createinfo_binding_flags_cb_1.pBindingFlags = ds_binding_flags_cb_1; - - // Prepare descriptors - OneOffDescriptorSet descriptor_set_cb_1(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, - &layout_createinfo_binding_flags_cb_1, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set_cb_1( + m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_cb_1(*m_device, {&descriptor_set_cb_1.layout_}); vkt::Image image_cb_1(*m_device, 16, 16, 1, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT); @@ -2192,19 +2115,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleOOBTypesInOneCmdBuffer) { // Make another buffer to populate the buffer array to be indexed vkt::Buffer buffer1_cb_2(*m_device, 1024, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags_cb_2[2] = {0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags_cb_2 = vku::InitStructHelper(); - layout_createinfo_binding_flags_cb_2.bindingCount = 2; - layout_createinfo_binding_flags_cb_2.pBindingFlags = ds_binding_flags_cb_2; - - OneOffDescriptorSet descriptor_set_cb_2(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags_cb_2, 0); - + OneOffDescriptorIndexingSet descriptor_set_cb_2( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 6, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_cb_2(*m_device, {&descriptor_set_cb_2.layout_}); { VkDescriptorBufferInfo buffer_info_cb_2[7] = {}; @@ -2508,12 +2424,6 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleBoundDescriptorsUpdateAfterBindF input_buffer_ptr[0] = 1; // will be valid for both shaders input_buffer.Memory().Unmap(); - VkDescriptorBindingFlags ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 2; - flags_create_info.pBindingFlags = ds_binding_flags; - char const *cs_source_1 = R"glsl( #version 450 #extension GL_EXT_nonuniform_qualifier : enable @@ -2524,13 +2434,13 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleBoundDescriptorsUpdateAfterBindF } )glsl"; - OneOffDescriptorSet descriptor_set_1(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set_1( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_1(*m_device, {&descriptor_set_1.layout_}); CreateComputePipelineHelper pipe_1(*this); @@ -2548,13 +2458,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleBoundDescriptorsUpdateAfterBindF } )glsl"; - OneOffDescriptorSet descriptor_set_2(m_device, - { - {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set_2( + m_device, + { + {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_2(*m_device, {&descriptor_set_2.layout_}); CreateComputePipelineHelper pipe_2(*this); @@ -2609,12 +2518,6 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleBoundDescriptorsUpdateAfterBindL input_buffer_ptr[0] = 1; // will be valid for both shaders input_buffer.Memory().Unmap(); - VkDescriptorBindingFlags ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 2; - flags_create_info.pBindingFlags = ds_binding_flags; - char const *cs_source_1 = R"glsl( #version 450 #extension GL_EXT_nonuniform_qualifier : enable @@ -2625,13 +2528,13 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleBoundDescriptorsUpdateAfterBindL } )glsl"; - OneOffDescriptorSet descriptor_set_1(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set_1( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_1(*m_device, {&descriptor_set_1.layout_}); CreateComputePipelineHelper pipe_1(*this); @@ -2649,13 +2552,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleBoundDescriptorsUpdateAfterBindL } )glsl"; - OneOffDescriptorSet descriptor_set_2(m_device, - { - {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set_2( + m_device, + { + {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_2(*m_device, {&descriptor_set_2.layout_}); CreateComputePipelineHelper pipe_2(*this); @@ -2791,26 +2693,18 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MultipleSetSomeUninitializedUpdateAfterB input_buffer_ptr[0] = 1; // storage_buffers[1] input_buffer.Memory().Unmap(); - VkDescriptorBindingFlags ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 2; - flags_create_info.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet ds_good(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); - OneOffDescriptorSet ds_bad(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet ds_good( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); + OneOffDescriptorIndexingSet ds_bad( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&ds_good.layout_}); char const *cs_source = R"glsl( @@ -2970,14 +2864,8 @@ TEST_F(NegativeGpuAVDescriptorIndexing, SpecConstantUpdateAfterBind) { } )glsl"; - VkDescriptorBindingFlags binding_flags = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}}, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); // Create 2 pipelines with 2 values, make sure the first isn't cached or anything strange preventing the second one from @@ -3038,13 +2926,8 @@ TEST_F(NegativeGpuAVDescriptorIndexing, SpecConstantPartiallyBound) { } )glsl"; - VkDescriptorBindingFlags binding_flags = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}}, 0, - &flags_create_info); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); // Create 2 pipelines with 2 values, make sure the first isn't cached or anything strange preventing the second one from @@ -3152,12 +3035,8 @@ TEST_F(NegativeGpuAVDescriptorIndexing, SpecConstantNullDescriptorBindless) { } )glsl"; - VkDescriptorBindingFlags binding_flags = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &binding_flags; - OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}}, 0, - &flags_create_info); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Buffer in_buffer(*m_device, 16, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); @@ -3207,13 +3086,8 @@ TEST_F(NegativeGpuAVDescriptorIndexing, PartiallyBoundNoArray) { } )glsl"; - VkDescriptorBindingFlags binding_flags = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}}, 0, - &flags_create_info); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); @@ -3496,17 +3370,12 @@ TEST_F(NegativeGpuAVDescriptorIndexing, TexelFetchTexelBuffer) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Buffer buffer(*m_device, 1024, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT); @@ -3548,16 +3417,10 @@ TEST_F(NegativeGpuAVDescriptorIndexing, AtomicImagePartiallyBound) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 1; - layout_createinfo_binding_flags.pBindingFlags = &ds_binding_flag; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); @@ -3605,16 +3468,8 @@ TEST_F(NegativeGpuAVDescriptorIndexing, AtomicImageRuntimeArray) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 1; - layout_createinfo_binding_flags.pBindingFlags = &ds_binding_flag; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}}); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); descriptor_set.WriteDescriptorImageInfo(0, image_view, sampler, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_IMAGE_LAYOUT_GENERAL, 0); @@ -3651,16 +3506,8 @@ TEST_F(NegativeGpuAVDescriptorIndexing, AtomicBufferPartiallyBound) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 1; - layout_createinfo_binding_flags.pBindingFlags = &ds_binding_flag; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}}); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); @@ -3693,16 +3540,8 @@ TEST_F(NegativeGpuAVDescriptorIndexing, AtomicBufferRuntimeArray) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 1; - layout_createinfo_binding_flags.pBindingFlags = &ds_binding_flag; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}}); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Buffer storage_buffer(*m_device, 32, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT); @@ -3742,16 +3581,8 @@ TEST_F(NegativeGpuAVDescriptorIndexing, StorageImagePartiallyBound) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 1; - layout_createinfo_binding_flags.pBindingFlags = &ds_binding_flag; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}}); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); @@ -3787,16 +3618,8 @@ TEST_F(NegativeGpuAVDescriptorIndexing, StorageImageRuntimeArray) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 1; - layout_createinfo_binding_flags.pBindingFlags = &ds_binding_flag; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}}); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); diff --git a/tests/unit/gpu_av_descriptor_indexing_positive.cpp b/tests/unit/gpu_av_descriptor_indexing_positive.cpp index 5445a809396..366e22a00af 100644 --- a/tests/unit/gpu_av_descriptor_indexing_positive.cpp +++ b/tests/unit/gpu_av_descriptor_indexing_positive.cpp @@ -110,18 +110,13 @@ TEST_F(PositiveGpuAVDescriptorIndexing, BasicHLSL) { buffer_ptr[0] = 1; buffer.Memory().Unmap(); - VkDescriptorBindingFlagsEXT ds_binding_flags[3] = {0, 0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 3; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 4, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 4, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Image image(*m_device, 16, 16, 1, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT); @@ -422,26 +417,17 @@ TEST_F(PositiveGpuAVDescriptorIndexing, UnInitImage) { // Make a uniform buffer to be passed to the shader that contains the invalid array index. vkt::Buffer buffer0(*m_device, buffer_size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags[3] = { - 0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, - VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 3; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - vkt::Sampler sampler(*m_device, SafeSaneSamplerCreateInfo()); - const VkSampler samplers[2] = {sampler.handle(), sampler.handle()}; - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 5, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, samplers}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &layout_createinfo_binding_flags, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 5, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, samplers, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Image image(*m_device, 16, 16, 1, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT); @@ -515,27 +501,17 @@ TEST_F(PositiveGpuAVDescriptorIndexing, ImageMultiBinding) { // Make a uniform buffer to be passed to the shader that contains the invalid array index. vkt::Buffer buffer0(*m_device, buffer_size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlags ds_binding_flags[3] = { - 0, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, - VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 3; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - vkt::Sampler sampler(*m_device, SafeSaneSamplerCreateInfo()); - const VkSampler samplers[2] = {sampler.handle(), sampler.handle()}; - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 5, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, samplers}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &layout_createinfo_binding_flags, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); - + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 5, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, samplers, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Image image(*m_device, 16, 16, 1, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT); image.SetLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); @@ -1824,12 +1800,6 @@ TEST_F(PositiveGpuAVDescriptorIndexing, MultipleBoundDescriptorsUpdateAfterBind) input_buffer_ptr[0] = 1; // will be valid for both shaders input_buffer.Memory().Unmap(); - VkDescriptorBindingFlags ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 2; - flags_create_info.pBindingFlags = ds_binding_flags; - char const *cs_source_1 = R"glsl( #version 450 #extension GL_EXT_nonuniform_qualifier : enable @@ -1840,13 +1810,13 @@ TEST_F(PositiveGpuAVDescriptorIndexing, MultipleBoundDescriptorsUpdateAfterBind) } )glsl"; - OneOffDescriptorSet descriptor_set_1(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set_1( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_1(*m_device, {&descriptor_set_1.layout_}); CreateComputePipelineHelper pipe_1(*this); @@ -1864,13 +1834,12 @@ TEST_F(PositiveGpuAVDescriptorIndexing, MultipleBoundDescriptorsUpdateAfterBind) } )glsl"; - OneOffDescriptorSet descriptor_set_2(m_device, - { - {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set_2( + m_device, + { + {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_2(*m_device, {&descriptor_set_2.layout_}); CreateComputePipelineHelper pipe_2(*this); @@ -1925,12 +1894,6 @@ TEST_F(PositiveGpuAVDescriptorIndexing, MultipleUnusedBoundDescriptorsUpdateAfte input_buffer_ptr[0] = 1; // will be valid for both shaders input_buffer.Memory().Unmap(); - VkDescriptorBindingFlags ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 2; - flags_create_info.pBindingFlags = ds_binding_flags; - char const *cs_source = R"glsl( #version 450 #extension GL_EXT_nonuniform_qualifier : enable @@ -1941,13 +1904,12 @@ TEST_F(PositiveGpuAVDescriptorIndexing, MultipleUnusedBoundDescriptorsUpdateAfte } )glsl"; - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, + nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); @@ -1956,13 +1918,13 @@ TEST_F(PositiveGpuAVDescriptorIndexing, MultipleUnusedBoundDescriptorsUpdateAfte pipe.CreateComputePipeline(); // same, but never will be updated - OneOffDescriptorSet descriptor_set_unused(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set_unused( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout_bad_1(*m_device, {&descriptor_set_unused.layout_}); // use vaild set, but put at set == 1 so doesn't match shader const vkt::PipelineLayout pipeline_layout_bad_2(*m_device, {&descriptor_set_unused.layout_, &descriptor_set.layout_}); @@ -2096,26 +2058,18 @@ TEST_F(PositiveGpuAVDescriptorIndexing, MultipleSetSomeUninitializedUpdateAfterB input_buffer_ptr[0] = 1; // storage_buffers[1] input_buffer.Memory().Unmap(); - VkDescriptorBindingFlags ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 2; - flags_create_info.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet ds_good(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); - OneOffDescriptorSet ds_bad(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet ds_good( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); + OneOffDescriptorIndexingSet ds_bad( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&ds_good.layout_}); char const *cs_source = R"glsl( @@ -2424,12 +2378,8 @@ TEST_F(PositiveGpuAVDescriptorIndexing, SpecConstantNullDescriptorBindless) { } )glsl"; - VkDescriptorBindingFlags binding_flags = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &binding_flags; - OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}}, 0, - &flags_create_info); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Buffer in_buffer(*m_device, 16, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); @@ -2478,18 +2428,13 @@ TEST_F(PositiveGpuAVDescriptorIndexing, TexelFetch) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flags[3] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 3; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set( + m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, 0}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Buffer buffer(*m_device, 1024, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT); @@ -2556,16 +2501,10 @@ TEST_F(PositiveGpuAVDescriptorIndexing, AtomicImage) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 1; - layout_createinfo_binding_flags.pBindingFlags = &ds_binding_flag; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); descriptor_set.WriteDescriptorImageInfo(0, image_view, sampler, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_IMAGE_LAYOUT_GENERAL, 1); @@ -2599,16 +2538,10 @@ TEST_F(PositiveGpuAVDescriptorIndexing, AtomicBuffer) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 1; - layout_createinfo_binding_flags.pBindingFlags = &ds_binding_flag; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Buffer storage_buffer(*m_device, 32, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT); @@ -2647,16 +2580,10 @@ TEST_F(PositiveGpuAVDescriptorIndexing, StorageImage) { } )glsl"; - VkDescriptorBindingFlags ds_binding_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 1; - layout_createinfo_binding_flags.pBindingFlags = &ds_binding_flag; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags, 0); + OneOffDescriptorIndexingSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); auto image_ci = vkt::Image::ImageCreateInfo2D(64, 64, 1, 1, VK_FORMAT_R32_UINT, VK_IMAGE_USAGE_STORAGE_BIT); @@ -2739,7 +2666,7 @@ TEST_F(PositiveGpuAVDescriptorIndexing, BindingPartiallyBound) { RETURN_IF_SKIP(InitState()); InitRenderTarget(); - VkDescriptorBindingFlagsEXT ds_binding_flags[2] = {}; + VkDescriptorBindingFlags ds_binding_flags[2] = {}; VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); ds_binding_flags[0] = 0; // No Error diff --git a/tests/unit/gpu_av_descriptor_post_process.cpp b/tests/unit/gpu_av_descriptor_post_process.cpp index 61e1d15007f..e3f909354b6 100644 --- a/tests/unit/gpu_av_descriptor_post_process.cpp +++ b/tests/unit/gpu_av_descriptor_post_process.cpp @@ -44,14 +44,8 @@ TEST_F(NegativeGpuAVDescriptorPostProcess, UpdateAfterBindImageViewTypeMismatch) vkt::ImageView image_view = image.CreateView(); vkt::Sampler sampler(*m_device, SafeSaneSamplerCreateInfo()); - VkDescriptorBindingFlags binding_flags = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}}, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, + nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); descriptor_set.WriteDescriptorImageInfo(0, image_view, sampler); @@ -110,14 +104,8 @@ TEST_F(NegativeGpuAVDescriptorPostProcess, PostProcesingOnly) { vkt::ImageView image_view = image.CreateView(); vkt::Sampler sampler(*m_device, SafeSaneSamplerCreateInfo()); - VkDescriptorBindingFlags binding_flags = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}}, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); + OneOffDescriptorIndexingSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, + nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); descriptor_set.WriteDescriptorImageInfo(0, image_view, sampler); @@ -808,18 +796,11 @@ TEST_F(NegativeGpuAVDescriptorPostProcess, YcbcrDrawFetchNonArrayPartiallyBound) buffer_ptr[0] = 1; buffer.Memory().Unmap(); - // This forces a non-array variable to go through GPU-AV - VkDescriptorBindingFlags flags = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = &flags; - - OneOffDescriptorSet descriptor_set( - m_device, - { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_VERTEX_BIT, &sampler.handle()}, - }, - 0, &flags_create_info); + OneOffDescriptorIndexingSet descriptor_set( + m_device, { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_VERTEX_BIT, &sampler.handle(), + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); if (!descriptor_set.set_) { GTEST_SKIP() << "Can't allocate descriptor with immutable sampler"; } @@ -878,17 +859,12 @@ TEST_F(NegativeGpuAVDescriptorPostProcess, NonMultisampleMismatchWithPipelinePar buffer_ptr[0] = 1; buffer.Memory().Unmap(); - VkDescriptorBindingFlagsEXT ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 2; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); descriptor_set.WriteDescriptorImageInfo(0, good_image_view, sampler.handle(), VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 0); @@ -1022,18 +998,13 @@ TEST_F(NegativeGpuAVDescriptorPostProcess, AliasImageMultisample) { } )glsl"; - VkDescriptorBindingFlagsEXT ds_binding_flags[3] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 3; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Buffer buffer(*m_device, 64, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); @@ -1102,31 +1073,26 @@ TEST_F(NegativeGpuAVDescriptorPostProcess, AliasImageMultisampleDescriptorSetsPa vkt::Image ms_image(*m_device, image_ci, vkt::set_layout); vkt::ImageView ms_image_view = ms_image.CreateView(); - VkDescriptorBindingFlagsEXT ds_binding_flags[3] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 3; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set0(m_device, - { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set0( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); const vkt::PipelineLayout pipeline_layout0(*m_device, {&descriptor_set0.layout_}); descriptor_set0.WriteDescriptorImageInfo(0, image_view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE); descriptor_set0.WriteDescriptorImageInfo(1, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); descriptor_set0.WriteDescriptorBufferInfo(2, buffer, 0, VK_WHOLE_SIZE, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); descriptor_set0.UpdateDescriptorSets(); - OneOffDescriptorSet descriptor_set1(m_device, - { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set1( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); const vkt::PipelineLayout pipeline_layout1(*m_device, {&descriptor_set1.layout_}); descriptor_set1.WriteDescriptorImageInfo(0, ms_image_view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE); descriptor_set0.WriteDescriptorImageInfo(1, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); diff --git a/tests/unit/gpu_av_descriptor_post_process_positive.cpp b/tests/unit/gpu_av_descriptor_post_process_positive.cpp index e55987cbe2d..d16bbf08cfb 100644 --- a/tests/unit/gpu_av_descriptor_post_process_positive.cpp +++ b/tests/unit/gpu_av_descriptor_post_process_positive.cpp @@ -133,15 +133,10 @@ TEST_F(PositiveGpuAVDescriptorPostProcess, AliasImageBindingPartiallyBound) { } )glsl"; - VkDescriptorBindingFlagsEXT ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 2; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - {{0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}}, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set( + m_device, + {{0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); @@ -269,18 +264,13 @@ TEST_F(PositiveGpuAVDescriptorPostProcess, AliasImageMultisample) { } )glsl"; - VkDescriptorBindingFlagsEXT ds_binding_flags[3] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 3; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); vkt::Buffer buffer(*m_device, 64, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); @@ -423,30 +413,26 @@ TEST_F(PositiveGpuAVDescriptorPostProcess, AliasImageMultisampleDescriptorSetsPa image_ci.samples = VK_SAMPLE_COUNT_4_BIT; vkt::Image ms_image(*m_device, image_ci, vkt::set_layout); vkt::ImageView ms_image_view = ms_image.CreateView(); - VkDescriptorBindingFlagsEXT ds_binding_flags[3] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 3; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - OneOffDescriptorSet descriptor_set0(m_device, - { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + + OneOffDescriptorIndexingSet descriptor_set0( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); const vkt::PipelineLayout pipeline_layout0(*m_device, {&descriptor_set0.layout_}); descriptor_set0.WriteDescriptorImageInfo(0, image_view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE); descriptor_set0.WriteDescriptorImageInfo(1, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); descriptor_set0.WriteDescriptorBufferInfo(2, buffer, 0, VK_WHOLE_SIZE, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); descriptor_set0.UpdateDescriptorSets(); - ds_layout_binding_flags.bindingCount = 2; - OneOffDescriptorSet descriptor_set1(m_device, - { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set1( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); const vkt::PipelineLayout pipeline_layout1(*m_device, {&descriptor_set1.layout_}); descriptor_set1.WriteDescriptorImageInfo(0, ms_image_view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE); descriptor_set1.WriteDescriptorBufferInfo(2, buffer, 0, VK_WHOLE_SIZE, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); @@ -523,18 +509,13 @@ TEST_F(PositiveGpuAVDescriptorPostProcess, AliasImageMultisampleDispatches) { vkt::Image ms_image(*m_device, image_ci, vkt::set_layout); vkt::ImageView ms_image_view = ms_image.CreateView(); - VkDescriptorBindingFlagsEXT ds_binding_flags[3] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 3; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set( + m_device, + { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreateComputePipelineHelper pipe(*this); @@ -603,17 +584,12 @@ TEST_F(PositiveGpuAVDescriptorPostProcess, NonMultisampleMismatchWithPipeline) { buffer_ptr[0] = 1; buffer.Memory().Unmap(); - VkDescriptorBindingFlagsEXT ds_binding_flags[2] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, 0}; - VkDescriptorSetLayoutBindingFlagsCreateInfo ds_layout_binding_flags = vku::InitStructHelper(); - ds_layout_binding_flags.bindingCount = 2; - ds_layout_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &ds_layout_binding_flags); + OneOffDescriptorIndexingSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + }); vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); descriptor_set.WriteDescriptorImageInfo(0, bad_image_view, sampler.handle(), VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 0); diff --git a/tests/unit/gpu_av_image_layout.cpp b/tests/unit/gpu_av_image_layout.cpp index da10ff9efa6..917d76def8c 100644 --- a/tests/unit/gpu_av_image_layout.cpp +++ b/tests/unit/gpu_av_image_layout.cpp @@ -241,20 +241,12 @@ TEST_F(NegativeGpuAVImageLayout, DescriptorArrayLayout) { VkShaderObj vs(this, kVertexDrawPassthroughGlsl, VK_SHADER_STAGE_VERTEX_BIT); VkShaderObj fs(this, fs_source, VK_SHADER_STAGE_FRAGMENT_BIT); - VkDescriptorBindingFlags ds_binding_flags[2] = { - 0, - VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, - }; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags); + OneOffDescriptorIndexingSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreatePipelineHelper pipe(*this); diff --git a/tests/unit/gpu_av_image_layout_positive.cpp b/tests/unit/gpu_av_image_layout_positive.cpp index 845d8c87bb1..e631e3dea50 100644 --- a/tests/unit/gpu_av_image_layout_positive.cpp +++ b/tests/unit/gpu_av_image_layout_positive.cpp @@ -40,20 +40,12 @@ TEST_F(PositiveGpuAVImageLayout, DescriptorArrayLayout) { VkShaderObj vs(this, kVertexDrawPassthroughGlsl, VK_SHADER_STAGE_VERTEX_BIT); VkShaderObj fs(this, fs_source, VK_SHADER_STAGE_FRAGMENT_BIT); - VkDescriptorBindingFlags ds_binding_flags[2] = { - 0, - VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, - }; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags); + OneOffDescriptorIndexingSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreatePipelineHelper pipe(*this); diff --git a/tests/unit/gpu_av_positive.cpp b/tests/unit/gpu_av_positive.cpp index 87c7e72eb85..22c10ac761c 100644 --- a/tests/unit/gpu_av_positive.cpp +++ b/tests/unit/gpu_av_positive.cpp @@ -92,7 +92,7 @@ TEST_F(PositiveGpuAV, InlineUniformBlock) { vkt::Buffer buffer(*m_device, 4, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlagsEXT ds_binding_flags[2] = {}; + VkDescriptorBindingFlags ds_binding_flags[2] = {}; ds_binding_flags[1] = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags[1] = {}; layout_createinfo_binding_flags[0] = vku::InitStructHelper(); @@ -182,7 +182,7 @@ TEST_F(PositiveGpuAV, InlineUniformBlockAndRecovery) { vkt::Buffer buffer(*m_device, 4, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, kHostVisibleMemProps); - VkDescriptorBindingFlagsEXT ds_binding_flags[2] = {}; + VkDescriptorBindingFlags ds_binding_flags[2] = {}; ds_binding_flags[1] = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT; VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags[1] = {}; layout_createinfo_binding_flags[0] = vku::InitStructHelper(); diff --git a/tests/unit/gpu_av_ray_tracing.cpp b/tests/unit/gpu_av_ray_tracing.cpp index 3dd3c3eb5c8..83c21b7b8e0 100644 --- a/tests/unit/gpu_av_ray_tracing.cpp +++ b/tests/unit/gpu_av_ray_tracing.cpp @@ -33,17 +33,8 @@ TEST_F(NegativeGpuAVRayTracing, DISABLED_CmdTraceRaysIndirectKHR) { } RETURN_IF_SKIP(InitState()); - // Create ray tracing pipeline - std::vector bindings(1); - bindings[0].binding = 0; - bindings[0].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; - bindings[0].descriptorCount = 1; - bindings[0].stageFlags = VK_SHADER_STAGE_RAYGEN_BIT_KHR; - - const vkt::DescriptorSetLayout desc_set_layout(*m_device, bindings); - OneOffDescriptorSet desc_set(m_device, bindings); - - const vkt::PipelineLayout rt_pipeline_layout(*m_device, {&desc_set_layout}); + OneOffDescriptorSet desc_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_RAYGEN_BIT_KHR, nullptr}}); + const vkt::PipelineLayout rt_pipeline_layout(*m_device, {&desc_set.layout_}); VkShaderObj rgen_shader(this, kRayTracingMinimalGlsl, VK_SHADER_STAGE_RAYGEN_BIT_KHR, SPV_ENV_VULKAN_1_2); VkShaderObj chit_shader(this, kRayTracingMinimalGlsl, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, SPV_ENV_VULKAN_1_2); diff --git a/tests/unit/graphics_library.cpp b/tests/unit/graphics_library.cpp index 76d3e48e905..c9a87131daf 100644 --- a/tests/unit/graphics_library.cpp +++ b/tests/unit/graphics_library.cpp @@ -2354,21 +2354,13 @@ TEST_F(NegativeGraphicsLibrary, DescriptorSetLayoutCreateFlags) { RETURN_IF_SKIP(InitBasicGraphicsLibrary()); InitRenderTarget(); - VkDescriptorBindingFlagsEXT flags[1] = {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = 1; - flags_create_info.pBindingFlags = flags; - OneOffDescriptorSet ds(m_device, { {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_GEOMETRY_BIT, nullptr}, }); - OneOffDescriptorSet ds2(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_GEOMETRY_BIT, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); - + OneOffDescriptorIndexingSet ds2(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_GEOMETRY_BIT, nullptr, + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); vkt::PipelineLayout pipeline_layout_vs(*m_device, {&ds.layout_}); vkt::PipelineLayout pipeline_layout_fs(*m_device, {&ds2.layout_}); diff --git a/tests/unit/image_layout_positive.cpp b/tests/unit/image_layout_positive.cpp index b4e9c615389..ae543011752 100644 --- a/tests/unit/image_layout_positive.cpp +++ b/tests/unit/image_layout_positive.cpp @@ -587,20 +587,12 @@ TEST_F(PositiveImageLayout, DescriptorArray) { VkShaderObj vs(this, kVertexDrawPassthroughGlsl, VK_SHADER_STAGE_VERTEX_BIT); VkShaderObj fs(this, fs_source, VK_SHADER_STAGE_FRAGMENT_BIT); - VkDescriptorBindingFlags ds_binding_flags[2] = { - 0, - VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, - }; - VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); - layout_createinfo_binding_flags.bindingCount = 2; - layout_createinfo_binding_flags.pBindingFlags = ds_binding_flags; - - OneOffDescriptorSet descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }, - 0, &layout_createinfo_binding_flags); + OneOffDescriptorIndexingSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr, 0}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, nullptr, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}, + }); const vkt::PipelineLayout pipeline_layout(*m_device, {&descriptor_set.layout_}); CreatePipelineHelper pipe(*this); diff --git a/tests/unit/pipeline.cpp b/tests/unit/pipeline.cpp index eb656989c4e..785594b8b47 100644 --- a/tests/unit/pipeline.cpp +++ b/tests/unit/pipeline.cpp @@ -1660,7 +1660,7 @@ TEST_F(NegativePipeline, NotCompatibleForSet) { vkt::Buffer storage_buffer(*m_device, 4, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT); vkt::Buffer uniform_buffer(*m_device, 20, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); - OneOffDescriptorSet::Bindings binding_defs = { + std::vector binding_defs = { {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, }; @@ -1918,13 +1918,11 @@ TEST_F(NegativePipeline, SampledInvalidImageViews) { pipeline_unused.shader_stages_[1] = fs_unused.GetStageCreateInfo(); pipeline_function.shader_stages_[1] = fs_function.GetStageCreateInfo(); - OneOffDescriptorSet::Bindings combined_bindings = { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}}; - OneOffDescriptorSet::Bindings seperate_bindings = { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}}; - OneOffDescriptorSet combined_descriptor_set(m_device, combined_bindings); - OneOffDescriptorSet seperate_descriptor_set(m_device, seperate_bindings); + OneOffDescriptorSet combined_descriptor_set( + m_device, {{0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}}); + OneOffDescriptorSet seperate_descriptor_set(m_device, + {{0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}}); const vkt::PipelineLayout combined_pipeline_layout(*m_device, {&combined_descriptor_set.layout_}); const vkt::PipelineLayout seperate_pipeline_layout(*m_device, {&seperate_descriptor_set.layout_}); diff --git a/tests/unit/pipeline_positive.cpp b/tests/unit/pipeline_positive.cpp index d232a9cf735..674aa89d4ef 100644 --- a/tests/unit/pipeline_positive.cpp +++ b/tests/unit/pipeline_positive.cpp @@ -99,12 +99,6 @@ TEST_F(PositivePipeline, CombinedImageSamplerConsumedAsSampler) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - char const *csSource = R"glsl( #version 450 layout(local_size_x=1) in; @@ -116,8 +110,11 @@ TEST_F(PositivePipeline, CombinedImageSamplerConsumedAsSampler) { } )glsl"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT); pipe.CreateComputePipeline(); } @@ -128,12 +125,6 @@ TEST_F(PositivePipeline, CombinedImageSamplerConsumedAsImage) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - char const *csSource = R"glsl( #version 450 layout(local_size_x=1) in; @@ -145,8 +136,11 @@ TEST_F(PositivePipeline, CombinedImageSamplerConsumedAsImage) { } )glsl"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + {2, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT); pipe.CreateComputePipeline(); } @@ -158,11 +152,6 @@ TEST_F(PositivePipeline, CombinedImageSamplerConsumedAsBoth) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - char const *csSource = R"glsl( #version 450 layout(local_size_x=1) in; @@ -174,8 +163,10 @@ TEST_F(PositivePipeline, CombinedImageSamplerConsumedAsBoth) { } )glsl"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT); pipe.CreateComputePipeline(); } diff --git a/tests/unit/ray_tracing_nv.cpp b/tests/unit/ray_tracing_nv.cpp index 592430940a4..f531857694f 100644 --- a/tests/unit/ray_tracing_nv.cpp +++ b/tests/unit/ray_tracing_nv.cpp @@ -222,7 +222,7 @@ void NegativeRayTracingNV::OOBRayTracingShadersTestBodyNV(bool gpu_assisted) { void *allocate_pnext = nullptr; VkDescriptorPoolCreateFlags pool_create_flags = 0; VkDescriptorSetLayoutCreateFlags layout_create_flags = 0; - VkDescriptorBindingFlagsEXT ds_binding_flags[3] = {}; + VkDescriptorBindingFlags ds_binding_flags[3] = {}; VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags[1] = {}; if (descriptor_indexing) { ds_binding_flags[0] = 0; diff --git a/tests/unit/ray_tracing_pipeline.cpp b/tests/unit/ray_tracing_pipeline.cpp index 76133bb27c7..b6d06fadcf0 100644 --- a/tests/unit/ray_tracing_pipeline.cpp +++ b/tests/unit/ray_tracing_pipeline.cpp @@ -850,11 +850,9 @@ TEST_F(NegativeRayTracingPipeline, DeferredOp) { VkShaderObj rgen_shader(this, kRayTracingMinimalGlsl, VK_SHADER_STAGE_RAYGEN_BIT_KHR, SPV_ENV_VULKAN_1_2); VkShaderObj chit_shader(this, chit_src, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, SPV_ENV_VULKAN_1_2); - std::vector layout_bindings = { - {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, nullptr}, - {1, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 1, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, nullptr}}; - - const vkt::DescriptorSetLayout ds_layout(*m_device, layout_bindings); + const vkt::DescriptorSetLayout ds_layout( + *m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, nullptr}, + {1, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 1, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, nullptr}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&ds_layout}); VkPipelineShaderStageCreateInfo stage_create_info = vku::InitStructHelper(); @@ -963,12 +961,10 @@ TEST_F(NegativeRayTracingPipeline, MaxResources) { RETURN_IF_SKIP(InitState(nullptr, &ray_tracing_features)); - std::vector layout_bindings = { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, m_device->Physical().limits_.maxPerStageResources, VK_SHADER_STAGE_RAYGEN_BIT_KHR, - nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_RAYGEN_BIT_KHR, nullptr}}; - - const vkt::DescriptorSetLayout ds_layout(*m_device, layout_bindings); + const vkt::DescriptorSetLayout ds_layout( + *m_device, {{0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, m_device->Physical().limits_.maxPerStageResources, + VK_SHADER_STAGE_RAYGEN_BIT_KHR, nullptr}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_RAYGEN_BIT_KHR, nullptr}}); const vkt::PipelineLayout pipeline_layout(*m_device, {&ds_layout}); VkShaderObj rgen_shader(this, kRayTracingMinimalGlsl, VK_SHADER_STAGE_RAYGEN_BIT_KHR, SPV_ENV_VULKAN_1_2); diff --git a/tests/unit/render_pass_positive.cpp b/tests/unit/render_pass_positive.cpp index 022662b222b..0169159158e 100644 --- a/tests/unit/render_pass_positive.cpp +++ b/tests/unit/render_pass_positive.cpp @@ -497,7 +497,8 @@ TEST_F(PositiveRenderPass, SingleMipTransition) { // Create descriptor set and friends. vkt::Sampler sampler(*m_device, SafeSaneSamplerCreateInfo()); - OneOffDescriptorSet::Bindings binding_defs = {{2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}}; + std::vector binding_defs = { + {2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}}; const vkt::DescriptorSetLayout pipeline_dsl(*m_device, binding_defs); const vkt::PipelineLayout pipeline_layout(*m_device, {&pipeline_dsl}); OneOffDescriptorSet descriptor_set(m_device, binding_defs); diff --git a/tests/unit/shader_image_access_positive.cpp b/tests/unit/shader_image_access_positive.cpp index 2b56168c13e..60da5a1a5f0 100644 --- a/tests/unit/shader_image_access_positive.cpp +++ b/tests/unit/shader_image_access_positive.cpp @@ -20,10 +20,6 @@ TEST_F(PositiveShaderImageAccess, FunctionParameterToVariable) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - char const *csSource = R"glsl( #version 460 #extension GL_EXT_samplerless_texture_functions : enable @@ -40,8 +36,9 @@ TEST_F(PositiveShaderImageAccess, FunctionParameterToVariable) { )glsl"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT); pipe.CreateComputePipeline(); } @@ -51,10 +48,6 @@ TEST_F(PositiveShaderImageAccess, MultipleFunctionParameterToVariable) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - char const *csSource = R"glsl( #version 460 #extension GL_EXT_samplerless_texture_functions : enable @@ -76,8 +69,9 @@ TEST_F(PositiveShaderImageAccess, MultipleFunctionParameterToVariable) { )glsl"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT); pipe.CreateComputePipeline(); } @@ -87,11 +81,6 @@ TEST_F(PositiveShaderImageAccess, DifferentFunctionParameterToVariable) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - char const *csSource = R"glsl( #version 460 #extension GL_EXT_samplerless_texture_functions : enable @@ -109,8 +98,10 @@ TEST_F(PositiveShaderImageAccess, DifferentFunctionParameterToVariable) { )glsl"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT); pipe.CreateComputePipeline(); } @@ -120,10 +111,6 @@ TEST_F(PositiveShaderImageAccess, FunctionParameterToLoad) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - // This is // int foo(texture2D func_texture) { return textureSize(func_texture, 0).x; } // void main() { int x = foo(texture_image); } @@ -169,8 +156,9 @@ TEST_F(PositiveShaderImageAccess, FunctionParameterToLoad) { )"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT, SPV_ENV_VULKAN_1_0, SPV_SOURCE_ASM); pipe.CreateComputePipeline(); } @@ -180,11 +168,6 @@ TEST_F(PositiveShaderImageAccess, FunctionParameterToVariableSampledImage) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - char const *csSource = R"glsl( #version 460 #extension GL_EXT_samplerless_texture_functions : enable @@ -202,8 +185,10 @@ TEST_F(PositiveShaderImageAccess, FunctionParameterToVariableSampledImage) { )glsl"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT); pipe.CreateComputePipeline(); } @@ -213,11 +198,6 @@ TEST_F(PositiveShaderImageAccess, FunctionParameterToLoadSampledImage) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - // This is // int foo(texture2D func_texture) { return texture(sampler2D(func_texture, func_sampler), vec2(0.0)); } // void main() { vec4 x = foo(texture_image, sampler_descriptor); } @@ -269,8 +249,10 @@ TEST_F(PositiveShaderImageAccess, FunctionParameterToLoadSampledImage) { )"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT, SPV_ENV_VULKAN_1_0, SPV_SOURCE_ASM); pipe.CreateComputePipeline(); } @@ -280,10 +262,6 @@ TEST_F(PositiveShaderImageAccess, CopyObjectFromLoad) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - // This is simple // int x = textureSize(texture_image, 0).x; // but with inserted OpCopyObject calls @@ -321,8 +299,9 @@ TEST_F(PositiveShaderImageAccess, CopyObjectFromLoad) { )"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT, SPV_ENV_VULKAN_1_0, SPV_SOURCE_ASM); pipe.CreateComputePipeline(); } @@ -332,11 +311,6 @@ TEST_F(PositiveShaderImageAccess, UndefImage) { RETURN_IF_SKIP(Init()); - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }; - char const *csSource = R"( OpCapability Shader OpMemoryModel Logical GLSL450 @@ -374,8 +348,10 @@ TEST_F(PositiveShaderImageAccess, UndefImage) { )"; CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = { + {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, + }; pipe.cs_ = std::make_unique(this, csSource, VK_SHADER_STAGE_COMPUTE_BIT, SPV_ENV_VULKAN_1_0, SPV_SOURCE_ASM); pipe.CreateComputePipeline(); } diff --git a/tests/unit/shader_spirv_positive.cpp b/tests/unit/shader_spirv_positive.cpp index cb70d130253..dcf5c2226bf 100644 --- a/tests/unit/shader_spirv_positive.cpp +++ b/tests/unit/shader_spirv_positive.cpp @@ -538,12 +538,8 @@ TEST_F(PositiveShaderSpirv, SpecializationWordBoundryOffset) { reinterpret_cast(data), }; - std::vector bindings = { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}}; - CreateComputePipelineHelper pipe(*this); - pipe.dsl_bindings_.resize(bindings.size()); - memcpy(pipe.dsl_bindings_.data(), bindings.data(), bindings.size() * sizeof(VkDescriptorSetLayoutBinding)); + pipe.dsl_bindings_ = {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}}; pipe.cs_ = std::make_unique(this, cs_src.c_str(), VK_SHADER_STAGE_COMPUTE_BIT, SPV_ENV_VULKAN_1_0, SPV_SOURCE_ASM, &specialization_info); pipe.CreateComputePipeline(); diff --git a/tests/unit/sync_val.cpp b/tests/unit/sync_val.cpp index db4efe0500e..608afc94012 100644 --- a/tests/unit/sync_val.cpp +++ b/tests/unit/sync_val.cpp @@ -3942,7 +3942,7 @@ TEST_F(NegativeSyncVal, DestroyedUnusedDescriptors) { VkDescriptorSetLayoutBindingFlagsCreateInfo layout_createinfo_binding_flags = vku::InitStructHelper(); constexpr size_t kNumDescriptors = 6; - std::array ds_binding_flags; + std::array ds_binding_flags; for (auto &elem : ds_binding_flags) { elem = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT; } diff --git a/tests/unit/sync_val_positive.cpp b/tests/unit/sync_val_positive.cpp index ea066f56a51..6a9840ed6b6 100644 --- a/tests/unit/sync_val_positive.cpp +++ b/tests/unit/sync_val_positive.cpp @@ -512,10 +512,9 @@ TEST_F(PositiveSyncVal, ImageArrayDynamicIndexing) { views[i] = images[i].CreateView(); } - const OneOffDescriptorSet::Bindings bindings = { - {0, descriptor_type, 4, VK_SHADER_STAGE_ALL, nullptr}, - }; - OneOffDescriptorSet descriptor_set(m_device, bindings); + OneOffDescriptorSet descriptor_set(m_device, { + {0, descriptor_type, 4, VK_SHADER_STAGE_ALL, nullptr}, + }); descriptor_set.WriteDescriptorImageInfo(0, views[0], VK_NULL_HANDLE, descriptor_type, image_layout, 0); descriptor_set.WriteDescriptorImageInfo(0, views[1], VK_NULL_HANDLE, descriptor_type, image_layout, 1); descriptor_set.WriteDescriptorImageInfo(0, views[2], VK_NULL_HANDLE, descriptor_type, image_layout, 2); @@ -547,7 +546,6 @@ TEST_F(PositiveSyncVal, ImageArrayDynamicIndexing) { } )glsl"; CreateComputePipelineHelper cs_pipe(*this); - cs_pipe.dsl_bindings_ = bindings; cs_pipe.cs_ = std::make_unique(this, cs_source, VK_SHADER_STAGE_COMPUTE_BIT); cs_pipe.pipeline_layout_ = vkt::PipelineLayout(*m_device, {&descriptor_set.layout_}); cs_pipe.CreateComputePipeline(); @@ -583,10 +581,9 @@ TEST_F(PositiveSyncVal, ImageArrayConstantIndexing) { image.SetLayout(VK_IMAGE_LAYOUT_GENERAL); const vkt::ImageView view = image.CreateView(); - const OneOffDescriptorSet::Bindings bindings = { - {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr}, - }; - OneOffDescriptorSet descriptor_set(m_device, bindings); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2, VK_SHADER_STAGE_ALL, nullptr}, + }); descriptor_set.WriteDescriptorImageInfo(0, view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_IMAGE_LAYOUT_GENERAL, 0); descriptor_set.WriteDescriptorImageInfo(0, view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_IMAGE_LAYOUT_GENERAL, 1); descriptor_set.UpdateDescriptorSets(); @@ -614,7 +611,6 @@ TEST_F(PositiveSyncVal, ImageArrayConstantIndexing) { } )glsl"; CreateComputePipelineHelper cs_pipe(*this); - cs_pipe.dsl_bindings_ = bindings; cs_pipe.cs_ = std::make_unique(this, cs_source, VK_SHADER_STAGE_COMPUTE_BIT); cs_pipe.pipeline_layout_ = vkt::PipelineLayout(*m_device, {&descriptor_set.layout_}); cs_pipe.CreateComputePipeline(); @@ -651,10 +647,9 @@ TEST_F(PositiveSyncVal, TexelBufferArrayConstantIndexing) { const vkt::BufferView buffer_view0(*m_device, vkt::BufferView::CreateInfo(buffer0, VK_FORMAT_R8G8B8A8_UINT)); const vkt::BufferView buffer_view1(*m_device, vkt::BufferView::CreateInfo(buffer1, VK_FORMAT_R8G8B8A8_UINT)); - const OneOffDescriptorSet::Bindings bindings = { - {0, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - }; - OneOffDescriptorSet descriptor_set(m_device, bindings); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, + }); descriptor_set.WriteDescriptorBufferView(0, buffer_view0, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 0); descriptor_set.WriteDescriptorBufferView(0, buffer_view1, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1); descriptor_set.UpdateDescriptorSets(); @@ -682,7 +677,6 @@ TEST_F(PositiveSyncVal, TexelBufferArrayConstantIndexing) { } )glsl"; CreateComputePipelineHelper cs_pipe(*this); - cs_pipe.dsl_bindings_ = bindings; cs_pipe.cs_ = std::make_unique(this, cs_source, VK_SHADER_STAGE_COMPUTE_BIT); cs_pipe.pipeline_layout_ = vkt::PipelineLayout(*m_device, {&descriptor_set.layout_}); cs_pipe.CreateComputePipeline(); @@ -748,8 +742,7 @@ TEST_F(PositiveSyncVal, QSTransitionWithSrcNoneStage) { vkt::Semaphore semaphore(*m_device); // Submit 0: shader reads image data (read access) - const OneOffDescriptorSet::Bindings bindings = {{0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}}; - OneOffDescriptorSet descriptor_set(m_device, bindings); + OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}}); descriptor_set.WriteDescriptorImageInfo(0, view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_IMAGE_LAYOUT_GENERAL); descriptor_set.UpdateDescriptorSets(); @@ -761,7 +754,6 @@ TEST_F(PositiveSyncVal, QSTransitionWithSrcNoneStage) { } )glsl"; CreateComputePipelineHelper cs_pipe(*this); - cs_pipe.dsl_bindings_ = bindings; cs_pipe.cs_ = std::make_unique(this, cs_source, VK_SHADER_STAGE_COMPUTE_BIT); cs_pipe.pipeline_layout_ = vkt::PipelineLayout(*m_device, {&descriptor_set.layout_}); cs_pipe.CreateComputePipeline(); @@ -879,8 +871,7 @@ TEST_F(PositiveSyncVal, QSTransitionAndRead) { m_default_queue->Submit2(cb, vkt::Signal(semaphore)); // Submit1: wait for the semaphore and read image in the shader - const OneOffDescriptorSet::Bindings bindings = {{0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}}; - OneOffDescriptorSet descriptor_set(m_device, bindings); + OneOffDescriptorSet descriptor_set(m_device, {{0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}}); descriptor_set.WriteDescriptorImageInfo(0, view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_IMAGE_LAYOUT_GENERAL); descriptor_set.UpdateDescriptorSets(); @@ -892,7 +883,6 @@ TEST_F(PositiveSyncVal, QSTransitionAndRead) { } )glsl"; CreateComputePipelineHelper cs_pipe(*this); - cs_pipe.dsl_bindings_ = bindings; cs_pipe.cs_ = std::make_unique(this, cs_source, VK_SHADER_STAGE_COMPUTE_BIT); cs_pipe.pipeline_layout_ = vkt::PipelineLayout(*m_device, {&descriptor_set.layout_}); cs_pipe.CreateComputePipeline(); diff --git a/tests/unit/threading_positive.cpp b/tests/unit/threading_positive.cpp index e34d4b6c066..458e3037e83 100644 --- a/tests/unit/threading_positive.cpp +++ b/tests/unit/threading_positive.cpp @@ -74,25 +74,17 @@ TEST_F(PositiveThreading, UpdateDescriptorUpdateAfterBindNoCollision) { RETURN_IF_SKIP(Init()); InitRenderTarget(); - std::array flags = { - {VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = (uint32_t)flags.size(); - flags_create_info.pBindingFlags = flags.data(); - - OneOffDescriptorSet normal_descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); - + OneOffDescriptorIndexingSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, + nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, + nullptr, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT}, + }); vkt::Buffer buffer(*m_device, 256, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); ThreadTestData data; data.device = device(); - data.descriptorSet = normal_descriptor_set.set_; + data.descriptorSet = descriptor_set.set_; data.binding = 0; data.buffer = buffer.handle(); std::atomic bailout{false}; @@ -105,7 +97,7 @@ TEST_F(PositiveThreading, UpdateDescriptorUpdateAfterBindNoCollision) { ThreadTestData data2; data2.device = device(); - data2.descriptorSet = normal_descriptor_set.set_; + data2.descriptorSet = descriptor_set.set_; data2.binding = 1; data2.buffer = buffer.handle(); data2.bailout = &bailout; @@ -125,25 +117,17 @@ TEST_F(PositiveThreading, UpdateDescriptorUnusedWhilePendingNoCollision) { RETURN_IF_SKIP(Init()); InitRenderTarget(); - std::array flags = { - {VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT, VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT}}; - VkDescriptorSetLayoutBindingFlagsCreateInfo flags_create_info = vku::InitStructHelper(); - flags_create_info.bindingCount = (uint32_t)flags.size(); - flags_create_info.pBindingFlags = flags.data(); - - OneOffDescriptorSet normal_descriptor_set(m_device, - { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - }, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, &flags_create_info, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT); - + OneOffDescriptorIndexingSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, + nullptr, VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT}, + {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, + nullptr, VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT}, + }); vkt::Buffer buffer(*m_device, 256, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); ThreadTestData data; data.device = device(); - data.descriptorSet = normal_descriptor_set.set_; + data.descriptorSet = descriptor_set.set_; data.binding = 0; data.buffer = buffer.handle(); std::atomic bailout{false}; @@ -156,7 +140,7 @@ TEST_F(PositiveThreading, UpdateDescriptorUnusedWhilePendingNoCollision) { ThreadTestData data2; data2.device = device(); - data2.descriptorSet = normal_descriptor_set.set_; + data2.descriptorSet = descriptor_set.set_; data2.binding = 1; data2.buffer = buffer.handle(); data2.bailout = &bailout;