From af8141b470a21b88c4a2d4777eb39ab1b688b7b4 Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Thu, 13 Jul 2023 11:58:33 +0200
Subject: [PATCH] Fix validation issues

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 projects/voxelization/src/main.cpp |  2 ++
 src/vkcv/DescriptorSetManager.cpp  | 20 +++++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/projects/voxelization/src/main.cpp b/projects/voxelization/src/main.cpp
index d9d9aedc..9a6492b8 100644
--- a/projects/voxelization/src/main.cpp
+++ b/projects/voxelization/src/main.cpp
@@ -29,6 +29,8 @@ int main(int argc, const char** argv) {
 		features.setGeometryShader(true);
 		features.setDepthClamp(true);
 		features.setShaderInt16(true);
+		features.setFragmentStoresAndAtomics(true);
+		features.setVertexPipelineStoresAndAtomics(true);
 	});
 	
 	features.requireExtensionFeature<vk::PhysicalDeviceDescriptorIndexingFeatures>(
diff --git a/src/vkcv/DescriptorSetManager.cpp b/src/vkcv/DescriptorSetManager.cpp
index 2b71e527..4a3d4f5b 100644
--- a/src/vkcv/DescriptorSetManager.cpp
+++ b/src/vkcv/DescriptorSetManager.cpp
@@ -20,15 +20,17 @@ namespace vkcv {
 		 * Allocate the set size for the descriptor pools, namely 1000 units of each descriptor type
 		 * below. Finally, create an initial pool.
 		 */
-		m_PoolSizes = {
-			vk::DescriptorPoolSize(vk::DescriptorType::eSampler, 1000),
-			vk::DescriptorPoolSize(vk::DescriptorType::eSampledImage, 1000),
-			vk::DescriptorPoolSize(vk::DescriptorType::eUniformBuffer, 1000),
-			vk::DescriptorPoolSize(vk::DescriptorType::eStorageBuffer, 1000),
-			vk::DescriptorPoolSize(vk::DescriptorType::eUniformBufferDynamic, 1000),
-			vk::DescriptorPoolSize(vk::DescriptorType::eStorageBufferDynamic, 1000),
-			vk::DescriptorPoolSize(vk::DescriptorType::eAccelerationStructureKHR, 1000)
-		};
+		m_PoolSizes.clear();
+		m_PoolSizes.emplace_back(vk::DescriptorType::eSampler, 1000);
+		m_PoolSizes.emplace_back(vk::DescriptorType::eSampledImage, 1000);
+		m_PoolSizes.emplace_back(vk::DescriptorType::eUniformBuffer, 1000);
+		m_PoolSizes.emplace_back(vk::DescriptorType::eStorageBuffer, 1000);
+		m_PoolSizes.emplace_back(vk::DescriptorType::eUniformBufferDynamic, 1000);
+		m_PoolSizes.emplace_back(vk::DescriptorType::eStorageBufferDynamic, 1000);
+
+		if (core.getContext().getFeatureManager().isExtensionActive(VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME)) {
+			m_PoolSizes.emplace_back(vk::DescriptorType::eAccelerationStructureKHR, 1000);
+		}
 
 		m_PoolInfo = vk::DescriptorPoolCreateInfo(
 			vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet, 1000,
-- 
GitLab