diff --git a/projects/bindless_textures/src/main.cpp b/projects/bindless_textures/src/main.cpp index 99f36347187df12cfa32d24e5d5e273e53242b56..b340cba82a1a53c9973cfc8c96d01189f4ffe819 100644 --- a/projects/bindless_textures/src/main.cpp +++ b/projects/bindless_textures/src/main.cpp @@ -21,7 +21,6 @@ int main(int argc, const char** argv) { vkcv::Features features; features.requireExtension(VK_KHR_SWAPCHAIN_EXTENSION_NAME); - features.requireExtension(VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME); features.requireExtensionFeature<vk::PhysicalDeviceDescriptorIndexingFeatures>( VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME, [](vk::PhysicalDeviceDescriptorIndexingFeatures &features) { features.setShaderInputAttachmentArrayDynamicIndexing(true); @@ -46,7 +45,8 @@ int main(int argc, const char** argv) { features.setDescriptorBindingPartiallyBound(true); features.setDescriptorBindingVariableDescriptorCount(true); features.setRuntimeDescriptorArray(true); - }); + } + ); vkcv::Core core = vkcv::Core::create( window, diff --git a/projects/draw_indirect/src/main.cpp b/projects/draw_indirect/src/main.cpp index bc906f5524c516a54e28023f4baa3e43e490d048..c175865fe42795cc43efc78ffe2e41875446c9e1 100644 --- a/projects/draw_indirect/src/main.cpp +++ b/projects/draw_indirect/src/main.cpp @@ -32,14 +32,25 @@ int main(int argc, const char** argv) { windowHeight, false ); + + vkcv::Features features; + features.requireExtension(VK_KHR_SWAPCHAIN_EXTENSION_NAME); + + features.requireExtensionFeature<vk::PhysicalDeviceDescriptorIndexingFeatures>( + VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME, + [](vk::PhysicalDeviceDescriptorIndexingFeatures& features) { + features.setDescriptorBindingPartiallyBound(true); + features.setDescriptorBindingVariableDescriptorCount(true); + features.setRuntimeDescriptorArray(true); + } + ); vkcv::Core core = vkcv::Core::create( window, applicationName, VK_MAKE_VERSION(0, 0, 1), { vk::QueueFlagBits::eGraphics ,vk::QueueFlagBits::eCompute , vk::QueueFlagBits::eTransfer }, - {}, - { "VK_KHR_swapchain", VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME } + features ); vkcv::asset::Scene mesh; @@ -54,7 +65,7 @@ int main(int argc, const char** argv) { for(uint32_t i = 0; i < 5; i++) { std::filesystem::path grassPath(grassPaths[i]); - vkcv::asset::TextureData grassTexture = vkcv::asset::loadTexture(grassPath); + vkcv::asset::Texture grassTexture = vkcv::asset::loadTexture(grassPath); vkcv::Image texture = core.createImage(vk::Format::eR8G8B8A8Srgb, grassTexture.width, grassTexture.height); texture.fill(grassTexture.data.data()); @@ -151,8 +162,9 @@ int main(int argc, const char** argv) { const vkcv::VertexLayout firstMeshLayout (bindings); - std::vector<vkcv::DescriptorBinding> descriptorBindings = { firstMeshProgram.getReflectedDescriptors()[0] }; - vkcv::DescriptorSetHandle descriptorSet = core.createDescriptorSet(descriptorBindings); + vkcv::DescriptorBindings descriptorBindings = firstMeshProgram.getReflectedDescriptors().at(0); + vkcv::DescriptorSetLayoutHandle descriptorSetLayout = core.createDescriptorSetLayout(descriptorBindings); + vkcv::DescriptorSetHandle descriptorSet = core.createDescriptorSet(descriptorSetLayout); const vkcv::PipelineConfig firstMeshPipelineConfig { firstMeshProgram, @@ -160,7 +172,7 @@ int main(int argc, const char** argv) { UINT32_MAX, firstMeshPass, {firstMeshLayout}, - { core.getDescriptorSet(descriptorSet).layout }, + { core.getDescriptorSetLayout(descriptorSetLayout).vulkanHandle }, true }; vkcv::PipelineHandle firstMeshPipeline = core.createGraphicsPipeline(firstMeshPipelineConfig); diff --git a/src/vkcv/DescriptorManager.cpp b/src/vkcv/DescriptorManager.cpp index 67f470d4ed4a9ebaec245b4131649ed0960d3f8b..2ea408a9a721b141c92740c41ed4155f909646a6 100644 --- a/src/vkcv/DescriptorManager.cpp +++ b/src/vkcv/DescriptorManager.cpp @@ -83,7 +83,7 @@ namespace vkcv vk::DescriptorBindingFlagBits::ePartiallyBound ); } else { - bindingsFlags.push_back(vk::DescriptorBindingFlags()); + bindingsFlags.emplace_back(); } } @@ -93,8 +93,9 @@ namespace vkcv //create the descriptor set's layout from the binding data gathered above vk::DescriptorSetLayout vulkanHandle = VK_NULL_HANDLE; - vk::DescriptorSetLayoutCreateInfo layoutInfo({}, bindingsVector); + vk::DescriptorSetLayoutCreateInfo layoutInfo(vk::DescriptorSetLayoutCreateFlags(), bindingsVector); layoutInfo.setPNext(&bindingFlagsInfo); + auto result = m_Device.createDescriptorSetLayout(&layoutInfo, nullptr, &vulkanHandle); if (result != vk::Result::eSuccess) { vkcv_log(LogLevel::ERROR, "Failed to create descriptor set layout");