From 09cc9ce905d65a41b7aa6b3307740a64c16d22b9 Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Mon, 7 Feb 2022 10:28:29 +0100
Subject: [PATCH] Simplified usage of descriptors on application level

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 include/vkcv/DrawcallRecording.hpp            | 17 +++++++++-------
 modules/scene/src/vkcv/scene/MeshPart.cpp     |  3 +--
 .../src/vkcv/upscaling/FSRUpscaling.cpp       | 12 +++--------
 projects/bindless_textures/src/main.cpp       |  2 +-
 projects/first_mesh/src/main.cpp              |  2 +-
 projects/indirect_dispatch/src/App.cpp        |  4 ++--
 projects/indirect_dispatch/src/MotionBlur.cpp | 18 ++++++++---------
 projects/indirect_draw/src/main.cpp           |  2 +-
 projects/mesh_shader/src/main.cpp             |  4 ++--
 .../src/BloomAndFlares.cpp                    | 10 +++++-----
 projects/particle_simulation/src/main.cpp     |  6 +++---
 projects/path_tracer/src/main.cpp             |  8 ++++----
 projects/rtx_ambient_occlusion/src/main.cpp   |  2 +-
 projects/saf_r/src/main.cpp                   |  4 ++--
 projects/sph/src/BloomAndFlares.cpp           | 10 +++++-----
 projects/sph/src/main.cpp                     | 12 +++++------
 projects/voxelization/src/BloomAndFlares.cpp  | 12 +++++------
 projects/voxelization/src/ShadowMapping.cpp   |  6 +++---
 projects/voxelization/src/Voxelization.cpp    | 14 ++++++-------
 projects/voxelization/src/main.cpp            | 18 +++++++----------
 projects/wobble_bobble/src/main.cpp           | 20 +++++++++----------
 src/vkcv/Core.cpp                             |  9 +++++----
 src/vkcv/DrawcallRecording.cpp                | 12 +++++++----
 23 files changed, 102 insertions(+), 105 deletions(-)

diff --git a/include/vkcv/DrawcallRecording.hpp b/include/vkcv/DrawcallRecording.hpp
index 77e2a2e1..4e15403c 100644
--- a/include/vkcv/DrawcallRecording.hpp
+++ b/include/vkcv/DrawcallRecording.hpp
@@ -1,11 +1,12 @@
 #pragma once
 #include <vulkan/vulkan.hpp>
-#include <vkcv/Handles.hpp>
-#include <vkcv/DescriptorConfig.hpp>
-#include <vkcv/PushConstants.hpp>
+#include "vkcv/Handles.hpp"
+#include "vkcv/DescriptorConfig.hpp"
+#include "vkcv/PushConstants.hpp"
 #include "Buffer.hpp"
 
 namespace vkcv {
+	
     struct VertexBufferBinding {
         inline VertexBufferBinding(vk::DeviceSize offset, vk::Buffer buffer) noexcept
             : offset(offset), buffer(buffer) {}
@@ -20,12 +21,12 @@ namespace vkcv {
     };
 
     struct DescriptorSetUsage {
-        inline DescriptorSetUsage(uint32_t setLocation, vk::DescriptorSet vulkanHandle,
+        inline DescriptorSetUsage(uint32_t setLocation, DescriptorSetHandle descriptorSet,
 								  const std::vector<uint32_t>& dynamicOffsets = {}) noexcept
-            : setLocation(setLocation), vulkanHandle(vulkanHandle), dynamicOffsets(dynamicOffsets) {}
+            : setLocation(setLocation), descriptorSet(descriptorSet), dynamicOffsets(dynamicOffsets) {}
 
         const uint32_t          	setLocation;
-        const vk::DescriptorSet 	vulkanHandle;
+        const DescriptorSetHandle 	descriptorSet;
         const std::vector<uint32_t> dynamicOffsets;
     };
 
@@ -63,6 +64,7 @@ namespace vkcv {
     };
 
     void recordDrawcall(
+		const Core				&core,
         const DrawcallInfo      &drawcall,
         vk::CommandBuffer       cmdBuffer,
         vk::PipelineLayout      pipelineLayout,
@@ -89,9 +91,10 @@ namespace vkcv {
     };
 
     void recordMeshShaderDrawcall(
+		const Core&								core,
         vk::CommandBuffer                       cmdBuffer,
         vk::PipelineLayout                      pipelineLayout,
-        const PushConstants&                 pushConstantData,
+        const PushConstants&                 	pushConstantData,
         const uint32_t                          pushConstantOffset,
         const MeshShaderDrawcall&               drawcall,
         const uint32_t                          firstTask);
diff --git a/modules/scene/src/vkcv/scene/MeshPart.cpp b/modules/scene/src/vkcv/scene/MeshPart.cpp
index 46e79897..4aa450da 100644
--- a/modules/scene/src/vkcv/scene/MeshPart.cpp
+++ b/modules/scene/src/vkcv/scene/MeshPart.cpp
@@ -70,11 +70,10 @@ namespace vkcv::scene {
 		
 		if (*this) {
 			const auto& material = getMaterial();
-			const auto& descriptorSet = core.getDescriptorSet(material.getDescriptorSet());
 			
 			drawcalls.push_back(DrawcallInfo(
 					vkcv::Mesh(m_vertexBindings, indexBuffer.getVulkanHandle(), m_indexCount),
-					{ DescriptorSetUsage(0, descriptorSet.vulkanHandle) }
+					{ DescriptorSetUsage(0, material.getDescriptorSet()) }
 			));
 		}
 	}
diff --git a/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp b/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp
index 2045db9e..0f6dfcde 100644
--- a/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp
+++ b/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp
@@ -344,9 +344,7 @@ namespace vkcv::upscaling {
 					cmdStream,
 					m_easuPipeline,
 					dispatch,
-					{DescriptorSetUsage(0, m_core.getDescriptorSet(
-							m_easuDescriptorSet
-					).vulkanHandle, { 0 })},
+					{DescriptorSetUsage(0, m_easuDescriptorSet, { 0 })},
 					PushConstants(0)
 			);
 			
@@ -366,9 +364,7 @@ namespace vkcv::upscaling {
 					cmdStream,
 					m_rcasPipeline,
 					dispatch,
-					{DescriptorSetUsage(0, m_core.getDescriptorSet(
-							m_rcasDescriptorSet
-					).vulkanHandle, { 0 })},
+					{DescriptorSetUsage(0,m_rcasDescriptorSet, { 0 })},
 					PushConstants(0)
 			);
 			
@@ -386,9 +382,7 @@ namespace vkcv::upscaling {
 					cmdStream,
 					m_easuPipeline,
 					dispatch,
-					{DescriptorSetUsage(0, m_core.getDescriptorSet(
-							m_easuDescriptorSet
-					).vulkanHandle, { 0 })},
+					{DescriptorSetUsage(0, m_easuDescriptorSet, { 0 })},
 					PushConstants(0)
 			);
 		}
diff --git a/projects/bindless_textures/src/main.cpp b/projects/bindless_textures/src/main.cpp
index 0ad6c125..aa228b81 100644
--- a/projects/bindless_textures/src/main.cpp
+++ b/projects/bindless_textures/src/main.cpp
@@ -218,7 +218,7 @@ int main(int argc, const char** argv) {
 
 	const vkcv::Mesh renderMesh(vertexBufferBindings, indexBuffer.getVulkanHandle(), mesh.vertexGroups[0].numIndices);
 
-	vkcv::DescriptorSetUsage    descriptorUsage(0, core.getDescriptorSet(descriptorSet).vulkanHandle);
+	vkcv::DescriptorSetUsage    descriptorUsage(0, descriptorSet);
 	vkcv::DrawcallInfo          drawcall(renderMesh, { descriptorUsage },1);
 
     vkcv::camera::CameraManager cameraManager(core.getWindow(windowHandle));
diff --git a/projects/first_mesh/src/main.cpp b/projects/first_mesh/src/main.cpp
index 55278b70..b8251342 100644
--- a/projects/first_mesh/src/main.cpp
+++ b/projects/first_mesh/src/main.cpp
@@ -167,7 +167,7 @@ int main(int argc, const char** argv) {
 
 	const vkcv::Mesh renderMesh(vertexBufferBindings, indexBuffer.getVulkanHandle(), mesh.vertexGroups[0].numIndices);
 
-	vkcv::DescriptorSetUsage    descriptorUsage(0, core.getDescriptorSet(descriptorSet).vulkanHandle);
+	vkcv::DescriptorSetUsage    descriptorUsage(0, descriptorSet);
 	vkcv::DrawcallInfo          drawcall(renderMesh, { descriptorUsage },1);
 
     vkcv::camera::CameraManager cameraManager(core.getWindow(windowHandle));
diff --git a/projects/indirect_dispatch/src/App.cpp b/projects/indirect_dispatch/src/App.cpp
index 532cef11..cc897e68 100644
--- a/projects/indirect_dispatch/src/App.cpp
+++ b/projects/indirect_dispatch/src/App.cpp
@@ -261,7 +261,7 @@ void App::run() {
 		for (const Object& obj : sceneObjects) {
 			forwardSceneDrawcalls.push_back(vkcv::DrawcallInfo(
 				obj.meshResources.mesh, 
-				{ vkcv::DescriptorSetUsage(0, m_core.getDescriptorSet(m_meshPass.descriptorSet).vulkanHandle) }));
+				{ vkcv::DescriptorSetUsage(0, m_meshPass.descriptorSet) }));
 		}
 
 		m_core.recordDrawcallsToCmdStream(
@@ -338,7 +338,7 @@ void App::run() {
 			cmdStream,
 			m_gammaCorrectionPass.pipeline,
 			fullScreenImageDispatch,
-			{ vkcv::DescriptorSetUsage(0, m_core.getDescriptorSet(m_gammaCorrectionPass.descriptorSet).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, m_gammaCorrectionPass.descriptorSet) },
 			vkcv::PushConstants(0));
 
 		m_core.prepareSwapchainImageForPresent(cmdStream);
diff --git a/projects/indirect_dispatch/src/MotionBlur.cpp b/projects/indirect_dispatch/src/MotionBlur.cpp
index fea5b1d6..30116c84 100644
--- a/projects/indirect_dispatch/src/MotionBlur.cpp
+++ b/projects/indirect_dispatch/src/MotionBlur.cpp
@@ -120,7 +120,7 @@ vkcv::ImageHandle MotionBlur::render(
 		cmdStream,
 		m_tileResetPass.pipeline,
 		dispatchSizeOne,
-		{ vkcv::DescriptorSetUsage(0, m_core->getDescriptorSet(m_tileResetPass.descriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_tileResetPass.descriptorSet) },
 		vkcv::PushConstants(0));
 
 	m_core->recordBufferMemoryBarrier(cmdStream, m_fullPathWorkTileBuffer);
@@ -166,7 +166,7 @@ vkcv::ImageHandle MotionBlur::render(
 		cmdStream,
 		m_tileClassificationPass.pipeline,
 		tileClassificationDispatch.data(),
-		{ vkcv::DescriptorSetUsage(0, m_core->getDescriptorSet(m_tileClassificationPass.descriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_tileClassificationPass.descriptorSet) },
 		classificationPushConstants);
 
 	m_core->recordBufferMemoryBarrier(cmdStream, m_fullPathWorkTileBuffer);
@@ -254,7 +254,7 @@ vkcv::ImageHandle MotionBlur::render(
 			m_motionBlurPass.pipeline,
 			m_fullPathWorkTileBuffer,
 			0,
-			{ vkcv::DescriptorSetUsage(0, m_core->getDescriptorSet(m_motionBlurPass.descriptorSet).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, m_motionBlurPass.descriptorSet) },
 			motionBlurPushConstants);
 
 		m_core->recordComputeIndirectDispatchToCmdStream(
@@ -262,7 +262,7 @@ vkcv::ImageHandle MotionBlur::render(
 			m_colorCopyPass.pipeline,
 			m_copyPathWorkTileBuffer,
 			0,
-			{ vkcv::DescriptorSetUsage(0, m_core->getDescriptorSet(m_colorCopyPass.descriptorSet).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, m_colorCopyPass.descriptorSet) },
 			vkcv::PushConstants(0));
 
 		m_core->recordComputeIndirectDispatchToCmdStream(
@@ -270,7 +270,7 @@ vkcv::ImageHandle MotionBlur::render(
 			m_motionBlurFastPathPass.pipeline,
 			m_fastPathWorkTileBuffer,
 			0,
-			{ vkcv::DescriptorSetUsage(0, m_core->getDescriptorSet(m_motionBlurFastPathPass.descriptorSet).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, m_motionBlurFastPathPass.descriptorSet) },
 			fastPathPushConstants);
 	}
 	else if(mode == eMotionBlurMode::Disabled) {
@@ -305,7 +305,7 @@ vkcv::ImageHandle MotionBlur::render(
 			cmdStream,
 			m_tileVisualisationPass.pipeline,
 			dispatchCounts,
-			{ vkcv::DescriptorSetUsage(0, m_core->getDescriptorSet(m_tileVisualisationPass.descriptorSet).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, m_tileVisualisationPass.descriptorSet) },
 			vkcv::PushConstants(0));
 	}
 	else {
@@ -371,7 +371,7 @@ vkcv::ImageHandle MotionBlur::renderMotionVectorVisualisation(
 		cmdStream,
 		m_motionVectorVisualisationPass.pipeline,
 		dispatchSizes.data(),
-		{ vkcv::DescriptorSetUsage(0, m_core->getDescriptorSet(m_motionVectorVisualisationPass.descriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_motionVectorVisualisationPass.descriptorSet) },
 		motionVectorVisualisationPushConstants);
 
 	return m_renderTargets.outputColor;
@@ -406,7 +406,7 @@ void MotionBlur::computeMotionTiles(
 		cmdStream,
 		m_motionVectorMinMaxPass.pipeline,
 		motionTileDispatchCounts.data(),
-		{ vkcv::DescriptorSetUsage(0, m_core->getDescriptorSet(m_motionVectorMinMaxPass.descriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_motionVectorMinMaxPass.descriptorSet) },
 		vkcv::PushConstants(0));
 
 	// motion vector min max neighbourhood
@@ -432,6 +432,6 @@ void MotionBlur::computeMotionTiles(
 		cmdStream,
 		m_motionVectorMinMaxNeighbourhoodPass.pipeline,
 		motionTileDispatchCounts.data(),
-		{ vkcv::DescriptorSetUsage(0, m_core->getDescriptorSet(m_motionVectorMinMaxNeighbourhoodPass.descriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_motionVectorMinMaxNeighbourhoodPass.descriptorSet) },
 		vkcv::PushConstants(0));
 }
\ No newline at end of file
diff --git a/projects/indirect_draw/src/main.cpp b/projects/indirect_draw/src/main.cpp
index 4841743a..9b062ab5 100644
--- a/projects/indirect_draw/src/main.cpp
+++ b/projects/indirect_draw/src/main.cpp
@@ -536,7 +536,7 @@ int main(int argc, const char** argv) {
     const uint32_t dispatchCount[3] = {static_cast<uint32_t>(ceiledDispatchCount), 1, 1};
 
 
-    vkcv::DescriptorSetUsage cullingUsage(0, core.getDescriptorSet(cullingDescSet).vulkanHandle, {});
+    vkcv::DescriptorSetUsage cullingUsage(0, cullingDescSet, {});
     vkcv::PushConstants emptyPushConstant(0);
 
     bool updateFrustumPlanes    = true;
diff --git a/projects/mesh_shader/src/main.cpp b/projects/mesh_shader/src/main.cpp
index dc7ca7ca..0a9914ab 100644
--- a/projects/mesh_shader/src/main.cpp
+++ b/projects/mesh_shader/src/main.cpp
@@ -354,7 +354,7 @@ int main(int argc, const char** argv) {
 
 		if (useMeshShader) {
 
-			vkcv::DescriptorSetUsage descriptorUsage(0, core.getDescriptorSet(meshShaderDescriptorSet).vulkanHandle);
+			vkcv::DescriptorSetUsage descriptorUsage(0, meshShaderDescriptorSet);
 			const uint32_t taskCount = (meshShaderModelData.meshlets.size() + 31) / 32;
 
 			core.recordMeshShaderDrawcalls(
@@ -368,7 +368,7 @@ int main(int argc, const char** argv) {
 		}
 		else {
 
-			vkcv::DescriptorSetUsage descriptorUsage(0, core.getDescriptorSet(vertexShaderDescriptorSet).vulkanHandle);
+			vkcv::DescriptorSetUsage descriptorUsage(0, vertexShaderDescriptorSet);
 
 			core.recordDrawcallsToCmdStream(
 				cmdStream,
diff --git a/projects/particle_simulation/src/BloomAndFlares.cpp b/projects/particle_simulation/src/BloomAndFlares.cpp
index a437afac..6ab0a8de 100644
--- a/projects/particle_simulation/src/BloomAndFlares.cpp
+++ b/projects/particle_simulation/src/BloomAndFlares.cpp
@@ -118,7 +118,7 @@ void BloomAndFlares::execDownsamplePipe(const vkcv::CommandStreamHandle &cmdStre
             cmdStream,
             m_DownsamplePipe,
             initialDispatchCount,
-            {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_DownsampleDescSets[0]).vulkanHandle)},
+            {vkcv::DescriptorSetUsage(0, m_DownsampleDescSets[0])},
             vkcv::PushConstants(0));
 
     // downsample dispatches of blur buffer's mip maps
@@ -153,7 +153,7 @@ void BloomAndFlares::execDownsamplePipe(const vkcv::CommandStreamHandle &cmdStre
                 cmdStream,
                 m_DownsamplePipe,
                 mipDispatchCount,
-                {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_DownsampleDescSets[mipLevel]).vulkanHandle)},
+                {vkcv::DescriptorSetUsage(0, m_DownsampleDescSets[mipLevel])},
                 vkcv::PushConstants(0));
 
         // image barrier between mips
@@ -198,7 +198,7 @@ void BloomAndFlares::execUpsamplePipe(const vkcv::CommandStreamHandle &cmdStream
                 cmdStream,
                 m_UpsamplePipe,
                 upsampleDispatchCount,
-                {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_UpsampleDescSets[mipLevel]).vulkanHandle)},
+                {vkcv::DescriptorSetUsage(0, m_UpsampleDescSets[mipLevel])},
                 vkcv::PushConstants(0)
         );
         // image barrier between mips
@@ -230,7 +230,7 @@ void BloomAndFlares::execLensFeaturePipe(const vkcv::CommandStreamHandle &cmdStr
             cmdStream,
             m_LensFlarePipe,
             lensFeatureDispatchCount,
-            {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_LensFlareDescSet).vulkanHandle)},
+            {vkcv::DescriptorSetUsage(0, m_LensFlareDescSet)},
             vkcv::PushConstants(0));
 }
 
@@ -263,7 +263,7 @@ void BloomAndFlares::execCompositePipe(const vkcv::CommandStreamHandle &cmdStrea
             cmdStream,
             m_CompositePipe,
             compositeDispatchCount,
-            {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_CompositeDescSet).vulkanHandle)},
+            {vkcv::DescriptorSetUsage(0, m_CompositeDescSet)},
             vkcv::PushConstants(0));
 }
 
diff --git a/projects/particle_simulation/src/main.cpp b/projects/particle_simulation/src/main.cpp
index 291b97f2..6637041e 100644
--- a/projects/particle_simulation/src/main.cpp
+++ b/projects/particle_simulation/src/main.cpp
@@ -180,7 +180,7 @@ int main(int argc, const char **argv) {
 
     const vkcv::Mesh renderMesh({vertexBufferBindings}, particleIndexBuffer.getVulkanHandle(),
                                 particleIndexBuffer.getCount());
-    vkcv::DescriptorSetUsage descriptorUsage(0, core.getDescriptorSet(descriptorSet).vulkanHandle);
+    vkcv::DescriptorSetUsage descriptorUsage(0, descriptorSet);
 
     auto pos = glm::vec2(0.f);
     auto spawnPosition = glm::vec3(0.f);
@@ -283,7 +283,7 @@ int main(int argc, const char **argv) {
         core.recordComputeDispatchToCmdStream(cmdStream,
                                               computePipeline,
                                               computeDispatchCount,
-                                              {vkcv::DescriptorSetUsage(0,core.getDescriptorSet(computeDescriptorSet).vulkanHandle)},
+                                              {vkcv::DescriptorSetUsage(0, computeDescriptorSet)},
 											  pushConstantsCompute);
 
         core.recordBufferMemoryBarrier(cmdStream, particleBuffer.getHandle());
@@ -321,7 +321,7 @@ int main(int argc, const char **argv) {
             cmdStream, 
             tonemappingPipe, 
             tonemappingDispatchCount, 
-            {vkcv::DescriptorSetUsage(0, core.getDescriptorSet(tonemappingDescriptor).vulkanHandle) },
+            {vkcv::DescriptorSetUsage(0, tonemappingDescriptor) },
             vkcv::PushConstants(0));
 
         core.prepareSwapchainImageForPresent(cmdStream);
diff --git a/projects/path_tracer/src/main.cpp b/projects/path_tracer/src/main.cpp
index db25f239..b7c495c0 100644
--- a/projects/path_tracer/src/main.cpp
+++ b/projects/path_tracer/src/main.cpp
@@ -342,7 +342,7 @@ int main(int argc, const char** argv) {
 			core.recordComputeDispatchToCmdStream(cmdStream,
 				imageClearPipeline,
 				fullscreenDispatchCount,
-				{ vkcv::DescriptorSetUsage(0, core.getDescriptorSet(imageClearDescriptorSet).vulkanHandle) },
+				{ vkcv::DescriptorSetUsage(0, imageClearDescriptorSet) },
 				vkcv::PushConstants(0));
 
 			clearMeanImage = false;
@@ -377,7 +377,7 @@ int main(int argc, const char** argv) {
 		core.recordComputeDispatchToCmdStream(cmdStream,
 			tracePipeline,
 			traceDispatchCount,
-			{ vkcv::DescriptorSetUsage(0,core.getDescriptorSet(traceDescriptorSet).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, traceDescriptorSet) },
 			pushConstantsCompute);
 
 		core.prepareImageForStorage(cmdStream, meanImage);
@@ -387,7 +387,7 @@ int main(int argc, const char** argv) {
 		core.recordComputeDispatchToCmdStream(cmdStream,
 			imageCombinePipeline,
 			fullscreenDispatchCount,
-			{ vkcv::DescriptorSetUsage(0,core.getDescriptorSet(imageCombineDescriptorSet).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, imageCombineDescriptorSet) },
 			vkcv::PushConstants(0));
 
 		core.recordImageMemoryBarrier(cmdStream, meanImage);
@@ -406,7 +406,7 @@ int main(int argc, const char** argv) {
 		core.recordComputeDispatchToCmdStream(cmdStream,
 			presentPipeline,
 			fullscreenDispatchCount,
-			{ vkcv::DescriptorSetUsage(0,core.getDescriptorSet(presentDescriptorSet).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, presentDescriptorSet) },
 			vkcv::PushConstants(0));
 
 		core.prepareSwapchainImageForPresent(cmdStream);
diff --git a/projects/rtx_ambient_occlusion/src/main.cpp b/projects/rtx_ambient_occlusion/src/main.cpp
index bac1fe36..d4c8ec2c 100644
--- a/projects/rtx_ambient_occlusion/src/main.cpp
+++ b/projects/rtx_ambient_occlusion/src/main.cpp
@@ -148,7 +148,7 @@ int main(int argc, const char** argv) {
 			rtxRegions.rmissRegion,
 			rtxRegions.rchitRegion,
 			rtxRegions.rcallRegion,
-			{	vkcv::DescriptorSetUsage(0, core.getDescriptorSet(rtxShaderDescriptorSet).vulkanHandle)},
+			{	vkcv::DescriptorSetUsage(0, rtxShaderDescriptorSet)},
 			pushConstantsRTX,
 			windowHandle);
 
diff --git a/projects/saf_r/src/main.cpp b/projects/saf_r/src/main.cpp
index 9ffd2845..a188c33d 100644
--- a/projects/saf_r/src/main.cpp
+++ b/projects/saf_r/src/main.cpp
@@ -198,7 +198,7 @@ int main(int argc, const char** argv) {
 	auto start = std::chrono::system_clock::now();
 
 	const vkcv::Mesh renderMesh({}, safrIndexBuffer.getVulkanHandle(), 3);
-	vkcv::DescriptorSetUsage descriptorUsage(0, core.getDescriptorSet(descriptorSet).vulkanHandle);
+	vkcv::DescriptorSetUsage descriptorUsage(0, descriptorSet);
 	vkcv::DrawcallInfo drawcall(renderMesh, { descriptorUsage }, 1);
 
 	//create the camera
@@ -280,7 +280,7 @@ int main(int argc, const char** argv) {
 		core.recordComputeDispatchToCmdStream(cmdStream,
 			computePipeline,
 			computeDispatchCount,
-			{ vkcv::DescriptorSetUsage(0,core.getDescriptorSet(computeDescriptorSet).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, computeDescriptorSet) },
 			pushConstantsCompute);
 
 		core.recordBufferMemoryBarrier(cmdStream, lightsBuffer.getHandle());
diff --git a/projects/sph/src/BloomAndFlares.cpp b/projects/sph/src/BloomAndFlares.cpp
index 0af3bf8c..200c0dea 100644
--- a/projects/sph/src/BloomAndFlares.cpp
+++ b/projects/sph/src/BloomAndFlares.cpp
@@ -114,7 +114,7 @@ void BloomAndFlares::execDownsamplePipe(const vkcv::CommandStreamHandle &cmdStre
             cmdStream,
             m_DownsamplePipe,
             initialDispatchCount,
-            {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_DownsampleDescSets[0]).vulkanHandle)},
+            {vkcv::DescriptorSetUsage(0, m_DownsampleDescSets[0])},
             vkcv::PushConstants(0));
 
     // downsample dispatches of blur buffer's mip maps
@@ -149,7 +149,7 @@ void BloomAndFlares::execDownsamplePipe(const vkcv::CommandStreamHandle &cmdStre
                 cmdStream,
                 m_DownsamplePipe,
                 mipDispatchCount,
-                {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_DownsampleDescSets[mipLevel]).vulkanHandle)},
+                {vkcv::DescriptorSetUsage(0, m_DownsampleDescSets[mipLevel])},
                 vkcv::PushConstants(0));
 
         // image barrier between mips
@@ -194,7 +194,7 @@ void BloomAndFlares::execUpsamplePipe(const vkcv::CommandStreamHandle &cmdStream
                 cmdStream,
                 m_UpsamplePipe,
                 upsampleDispatchCount,
-                {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_UpsampleDescSets[mipLevel]).vulkanHandle)},
+                {vkcv::DescriptorSetUsage(0, m_UpsampleDescSets[mipLevel])},
                 vkcv::PushConstants(0)
         );
         // image barrier between mips
@@ -226,7 +226,7 @@ void BloomAndFlares::execLensFeaturePipe(const vkcv::CommandStreamHandle &cmdStr
             cmdStream,
             m_LensFlarePipe,
             lensFeatureDispatchCount,
-            {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_LensFlareDescSet).vulkanHandle)},
+            {vkcv::DescriptorSetUsage(0, m_LensFlareDescSet)},
             vkcv::PushConstants(0));
 }
 
@@ -259,7 +259,7 @@ void BloomAndFlares::execCompositePipe(const vkcv::CommandStreamHandle &cmdStrea
             cmdStream,
             m_CompositePipe,
             compositeDispatchCount,
-            {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_CompositeDescSet).vulkanHandle)},
+            {vkcv::DescriptorSetUsage(0, m_CompositeDescSet)},
             vkcv::PushConstants(0));
 }
 
diff --git a/projects/sph/src/main.cpp b/projects/sph/src/main.cpp
index 96968776..44d38850 100644
--- a/projects/sph/src/main.cpp
+++ b/projects/sph/src/main.cpp
@@ -204,7 +204,7 @@ int main(int argc, const char **argv) {
 
     const vkcv::Mesh renderMesh({vertexBufferBindings}, particleIndexBuffer.getVulkanHandle(),
                                 particleIndexBuffer.getCount());
-    vkcv::DescriptorSetUsage descriptorUsage(0, core.getDescriptorSet(descriptorSet).vulkanHandle);
+    vkcv::DescriptorSetUsage descriptorUsage(0, descriptorSet);
 
     auto pos = glm::vec2(0.f);
 
@@ -329,7 +329,7 @@ int main(int argc, const char **argv) {
         core.recordComputeDispatchToCmdStream(cmdStream,
                                               computePipeline1,
                                               computeDispatchCount,
-                                              {vkcv::DescriptorSetUsage(0,core.getDescriptorSet(computeDescriptorSet1).vulkanHandle)},
+                                              {vkcv::DescriptorSetUsage(0, computeDescriptorSet1)},
 											  pushConstantsCompute);
 
         core.recordBufferMemoryBarrier(cmdStream, particleBuffer1.getHandle());
@@ -338,7 +338,7 @@ int main(int argc, const char **argv) {
 		core.recordComputeDispatchToCmdStream(cmdStream,
 											  computePipeline2,
 											  computeDispatchCount,
-											  {vkcv::DescriptorSetUsage(0,core.getDescriptorSet(computeDescriptorSet2).vulkanHandle)},
+											  {vkcv::DescriptorSetUsage(0, computeDescriptorSet2)},
 											  pushConstantsCompute);
 
 		core.recordBufferMemoryBarrier(cmdStream, particleBuffer1.getHandle());
@@ -347,7 +347,7 @@ int main(int argc, const char **argv) {
         core.recordComputeDispatchToCmdStream(cmdStream,
                                               computePipeline3,
                                               computeDispatchCount,
-                                              { vkcv::DescriptorSetUsage(0,core.getDescriptorSet(computeDescriptorSet3).vulkanHandle) },
+                                              { vkcv::DescriptorSetUsage(0, computeDescriptorSet3) },
                                               pushConstantsCompute);
 
         core.recordBufferMemoryBarrier(cmdStream, particleBuffer1.getHandle());
@@ -356,7 +356,7 @@ int main(int argc, const char **argv) {
         core.recordComputeDispatchToCmdStream(cmdStream,
                                               computePipeline4,
                                               computeDispatchCount,
-                                              { vkcv::DescriptorSetUsage(0,core.getDescriptorSet(computeDescriptorSet4).vulkanHandle) },
+                                              { vkcv::DescriptorSetUsage(0, computeDescriptorSet4) },
                                               pushConstantsCompute);
 
         core.recordBufferMemoryBarrier(cmdStream, particleBuffer1.getHandle());
@@ -397,7 +397,7 @@ int main(int argc, const char **argv) {
             cmdStream, 
             tonemappingPipe, 
             tonemappingDispatchCount, 
-            {vkcv::DescriptorSetUsage(0, core.getDescriptorSet(tonemappingDescriptor).vulkanHandle) },
+            {vkcv::DescriptorSetUsage(0, tonemappingDescriptor) },
             vkcv::PushConstants(0));
 
         core.prepareSwapchainImageForPresent(cmdStream);
diff --git a/projects/voxelization/src/BloomAndFlares.cpp b/projects/voxelization/src/BloomAndFlares.cpp
index a7ac2904..ddb1326a 100644
--- a/projects/voxelization/src/BloomAndFlares.cpp
+++ b/projects/voxelization/src/BloomAndFlares.cpp
@@ -145,7 +145,7 @@ void BloomAndFlares::execDownsamplePipe(const vkcv::CommandStreamHandle &cmdStre
             cmdStream,
             m_DownsamplePipe,
             initialDispatchCount,
-            {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_DownsampleDescSets[0]).vulkanHandle)},
+            {vkcv::DescriptorSetUsage(0, m_DownsampleDescSets[0])},
             vkcv::PushConstants(0));
 
     // downsample dispatches of blur buffer's mip maps
@@ -180,7 +180,7 @@ void BloomAndFlares::execDownsamplePipe(const vkcv::CommandStreamHandle &cmdStre
                 cmdStream,
                 m_DownsamplePipe,
                 mipDispatchCount,
-                {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_DownsampleDescSets[mipLevel]).vulkanHandle)},
+                {vkcv::DescriptorSetUsage(0, m_DownsampleDescSets[mipLevel])},
                 vkcv::PushConstants(0));
 
         // image barrier between mips
@@ -229,7 +229,7 @@ void BloomAndFlares::execUpsamplePipe(const vkcv::CommandStreamHandle &cmdStream
                 cmdStream,
                 m_UpsamplePipe,
                 upsampleDispatchCount,
-                {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_UpsampleDescSets[mipLevel]).vulkanHandle)},
+                {vkcv::DescriptorSetUsage(0, m_UpsampleDescSets[mipLevel])},
                 vkcv::PushConstants(0)
         );
         // image barrier between mips
@@ -268,7 +268,7 @@ void BloomAndFlares::execLensFeaturePipe(const vkcv::CommandStreamHandle &cmdStr
             cmdStream,
             m_LensFlarePipe,
             lensFeatureDispatchCount,
-            {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_LensFlareDescSet).vulkanHandle)},
+            {vkcv::DescriptorSetUsage(0, m_LensFlareDescSet)},
             vkcv::PushConstants(0));
 
     // upsample dispatch
@@ -301,7 +301,7 @@ void BloomAndFlares::execLensFeaturePipe(const vkcv::CommandStreamHandle &cmdStr
             cmdStream,
             m_UpsamplePipe,
             upsampleDispatchCount,
-            { vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_UpsampleLensFlareDescSets[i]).vulkanHandle) },
+            { vkcv::DescriptorSetUsage(0, m_UpsampleLensFlareDescSets[i]) },
             vkcv::PushConstants(0)
         );
         // image barrier between mips
@@ -348,7 +348,7 @@ void BloomAndFlares::execCompositePipe(const vkcv::CommandStreamHandle &cmdStrea
         cmdStream,
         m_CompositePipe,
         compositeDispatchCount,
-        {vkcv::DescriptorSetUsage(0, p_Core->getDescriptorSet(m_CompositeDescSet).vulkanHandle)},
+        {vkcv::DescriptorSetUsage(0, m_CompositeDescSet)},
         pushConstants);
 
     p_Core->recordEndDebugLabel(cmdStream);
diff --git a/projects/voxelization/src/ShadowMapping.cpp b/projects/voxelization/src/ShadowMapping.cpp
index c2e16310..5ae7eb60 100644
--- a/projects/voxelization/src/ShadowMapping.cpp
+++ b/projects/voxelization/src/ShadowMapping.cpp
@@ -296,7 +296,7 @@ void ShadowMapping::recordShadowMapRendering(
 		cmdStream,
 		m_depthToMomentsPipe,
 		dispatchCount,
-		{ vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_depthToMomentsDescriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_depthToMomentsDescriptorSet) },
 		msaaPushConstants);
 	m_corePtr->prepareImageForSampling(cmdStream, m_shadowMap.getHandle());
 	m_corePtr->recordEndDebugLabel(cmdStream);
@@ -309,7 +309,7 @@ void ShadowMapping::recordShadowMapRendering(
 		cmdStream,
 		m_shadowBlurXPipe,
 		dispatchCount,
-		{ vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_shadowBlurXDescriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_shadowBlurXDescriptorSet) },
 		vkcv::PushConstants(0));
 	m_corePtr->prepareImageForSampling(cmdStream, m_shadowMapIntermediate.getHandle());
 
@@ -319,7 +319,7 @@ void ShadowMapping::recordShadowMapRendering(
 		cmdStream,
 		m_shadowBlurYPipe,
 		dispatchCount,
-		{ vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_shadowBlurYDescriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_shadowBlurYDescriptorSet) },
 		vkcv::PushConstants(0));
 	m_shadowMap.recordMipChainGeneration(cmdStream);
 	m_corePtr->prepareImageForSampling(cmdStream, m_shadowMap.getHandle());
diff --git a/projects/voxelization/src/Voxelization.cpp b/projects/voxelization/src/Voxelization.cpp
index c5d48fb3..faa03d38 100644
--- a/projects/voxelization/src/Voxelization.cpp
+++ b/projects/voxelization/src/Voxelization.cpp
@@ -168,7 +168,7 @@ Voxelization::Voxelization(
 		voxelIndexData.push_back(static_cast<uint16_t>(i));
 	}
 
-	const vkcv::DescriptorSetUsage voxelizationDescriptorUsage(0, m_corePtr->getDescriptorSet(m_visualisationDescriptorSet).vulkanHandle);
+	const vkcv::DescriptorSetUsage voxelizationDescriptorUsage(0, m_visualisationDescriptorSet);
 
 	vkcv::ShaderProgram resetVoxelShader = loadVoxelResetShader();
 
@@ -259,7 +259,7 @@ void Voxelization::voxelizeMeshes(
 		cmdStream,
 		m_voxelResetPipe,
 		resetVoxelDispatchCount,
-		{ vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_voxelResetDescriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_voxelResetDescriptorSet) },
 		voxelCountPushConstants);
 	m_corePtr->recordBufferMemoryBarrier(cmdStream, m_voxelBuffer.getHandle());
 	m_corePtr->recordEndDebugLabel(cmdStream);
@@ -270,8 +270,8 @@ void Voxelization::voxelizeMeshes(
 		drawcalls.push_back(vkcv::DrawcallInfo(
 			meshes[i],
 			{ 
-				vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_voxelizationDescriptorSet).vulkanHandle),
-				vkcv::DescriptorSetUsage(1, m_corePtr->getDescriptorSet(perMeshDescriptorSets[i]).vulkanHandle) 
+				vkcv::DescriptorSetUsage(0, m_voxelizationDescriptorSet),
+				vkcv::DescriptorSetUsage(1, perMeshDescriptorSets[i])
 			},1));
 	}
 
@@ -299,7 +299,7 @@ void Voxelization::voxelizeMeshes(
 		cmdStream,
 		m_bufferToImagePipe,
 		bufferToImageDispatchCount,
-		{ vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_bufferToImageDescriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_bufferToImageDescriptorSet) },
 		vkcv::PushConstants(0));
 
 	m_corePtr->recordImageMemoryBarrier(cmdStream, m_voxelImageIntermediate.getHandle());
@@ -318,7 +318,7 @@ void Voxelization::voxelizeMeshes(
 		cmdStream,
 		m_secondaryBouncePipe,
 		bufferToImageDispatchCount,
-		{ vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_secondaryBounceDescriptorSet).vulkanHandle) },
+		{ vkcv::DescriptorSetUsage(0, m_secondaryBounceDescriptorSet) },
 		vkcv::PushConstants(0));
 	m_voxelImage.recordMipChainGeneration(cmdStream);
 	m_corePtr->recordImageMemoryBarrier(cmdStream, m_voxelImage.getHandle());
@@ -355,7 +355,7 @@ void Voxelization::renderVoxelVisualisation(
 
 	const auto drawcall = vkcv::DrawcallInfo(
 		vkcv::Mesh({}, nullptr, drawVoxelCount),
-		{ vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_visualisationDescriptorSet).vulkanHandle) },1);
+		{ vkcv::DescriptorSetUsage(0, m_visualisationDescriptorSet) },1);
 
 	m_corePtr->recordBeginDebugLabel(cmdStream, "Voxel visualisation", { 1, 1, 1, 1 });
 	m_corePtr->prepareImageForStorage(cmdStream, m_voxelImage.getHandle());
diff --git a/projects/voxelization/src/main.cpp b/projects/voxelization/src/main.cpp
index 7157d2f6..2245419f 100644
--- a/projects/voxelization/src/main.cpp
+++ b/projects/voxelization/src/main.cpp
@@ -527,11 +527,11 @@ int main(int argc, const char** argv) {
 	for (size_t i = 0; i < meshes.size(); i++) {
 
 		drawcalls.push_back(vkcv::DrawcallInfo(meshes[i], { 
-			vkcv::DescriptorSetUsage(0, core.getDescriptorSet(forwardShadingDescriptorSet).vulkanHandle),
-			vkcv::DescriptorSetUsage(1, core.getDescriptorSet(perMeshDescriptorSets[i]).vulkanHandle) }));
+			vkcv::DescriptorSetUsage(0, forwardShadingDescriptorSet),
+			vkcv::DescriptorSetUsage(1, perMeshDescriptorSets[i]) }));
 		prepassDrawcalls.push_back(vkcv::DrawcallInfo(meshes[i], {
-			vkcv::DescriptorSetUsage(0, core.getDescriptorSet(prepassDescriptorSet).vulkanHandle),
-			vkcv::DescriptorSetUsage(1, core.getDescriptorSet(perMeshDescriptorSets[i]).vulkanHandle) }));
+			vkcv::DescriptorSetUsage(0, prepassDescriptorSet),
+			vkcv::DescriptorSetUsage(1, perMeshDescriptorSets[i]) }));
 	}
 
 	vkcv::SamplerHandle voxelSampler = core.createSampler(
@@ -859,7 +859,7 @@ int main(int argc, const char** argv) {
 					cmdStream,
 					resolvePipeline,
 					fulsscreenDispatchCount,
-					{ vkcv::DescriptorSetUsage(0, core.getDescriptorSet(resolveDescriptorSet).vulkanHandle) },
+					{ vkcv::DescriptorSetUsage(0, resolveDescriptorSet) },
 					vkcv::PushConstants(0));
 
 				core.recordImageMemoryBarrier(cmdStream, resolvedColorBuffer);
@@ -882,9 +882,7 @@ int main(int argc, const char** argv) {
 			cmdStream, 
 			tonemappingPipeline, 
 			fulsscreenDispatchCount,
-			{ vkcv::DescriptorSetUsage(0, core.getDescriptorSet(
-					tonemappingDescriptorSet
-			).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, tonemappingDescriptorSet) },
 			vkcv::PushConstants(0)
 		);
 		
@@ -920,9 +918,7 @@ int main(int argc, const char** argv) {
 				cmdStream,
 				postEffectsPipeline,
 				fulsscreenDispatchCount,
-				{ vkcv::DescriptorSetUsage(0, core.getDescriptorSet(
-						postEffectsDescriptorSet
-				).vulkanHandle) },
+				{ vkcv::DescriptorSetUsage(0, postEffectsDescriptorSet) },
 				timePushConstants
 		);
 		core.recordEndDebugLabel(cmdStream);
diff --git a/projects/wobble_bobble/src/main.cpp b/projects/wobble_bobble/src/main.cpp
index baba070e..f9ebf984 100644
--- a/projects/wobble_bobble/src/main.cpp
+++ b/projects/wobble_bobble/src/main.cpp
@@ -656,7 +656,7 @@ int main(int argc, const char **argv) {
 	
 	drawcallsGrid.push_back(vkcv::DrawcallInfo(
 			triangleMesh,
-			{ vkcv::DescriptorSetUsage(0, core.getDescriptorSet(gfxSetGrid).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, gfxSetGrid) },
 			grid.getWidth() * grid.getHeight() * grid.getDepth()
 	));
 	
@@ -664,7 +664,7 @@ int main(int argc, const char **argv) {
 	
 	drawcallsParticles.push_back(vkcv::DrawcallInfo(
 			triangleMesh,
-			{ vkcv::DescriptorSetUsage(0, core.getDescriptorSet(gfxSetParticles).vulkanHandle) },
+			{ vkcv::DescriptorSetUsage(0, gfxSetParticles) },
 			sim->count
 	));
 	
@@ -742,10 +742,10 @@ int main(int argc, const char **argv) {
 					dispatchSizeParticles,
 					{
 						vkcv::DescriptorSetUsage(
-								0, core.getDescriptorSet(initParticleWeightsSets[0]).vulkanHandle
+								0, initParticleWeightsSets[0]
 						),
 						vkcv::DescriptorSetUsage(
-								1, core.getDescriptorSet(initParticleWeightsSets[1]).vulkanHandle
+								1, initParticleWeightsSets[1]
 						)
 					},
 					vkcv::PushConstants(0)
@@ -764,13 +764,13 @@ int main(int argc, const char **argv) {
 					dispatchSizeGrid,
 					{
 						vkcv::DescriptorSetUsage(
-								0, core.getDescriptorSet(transformParticlesToGridSets[0]).vulkanHandle
+								0, transformParticlesToGridSets[0]
 						),
 						vkcv::DescriptorSetUsage(
-								1, core.getDescriptorSet(transformParticlesToGridSets[1]).vulkanHandle
+								1, transformParticlesToGridSets[1]
 						),
 						vkcv::DescriptorSetUsage(
-								2, core.getDescriptorSet(transformParticlesToGridSets[2]).vulkanHandle
+								2, transformParticlesToGridSets[2]
 						)
 					},
 					physicsPushConstants
@@ -790,13 +790,13 @@ int main(int argc, const char **argv) {
 					dispatchSizeParticles,
 					{
 						vkcv::DescriptorSetUsage(
-								0, core.getDescriptorSet(updateParticleVelocitiesSets[0]).vulkanHandle
+								0, updateParticleVelocitiesSets[0]
 						),
 						vkcv::DescriptorSetUsage(
-								1, core.getDescriptorSet(updateParticleVelocitiesSets[1]).vulkanHandle
+								1, updateParticleVelocitiesSets[1]
 						),
 						vkcv::DescriptorSetUsage(
-								2, core.getDescriptorSet(updateParticleVelocitiesSets[2]).vulkanHandle
+								2, updateParticleVelocitiesSets[2]
 						)
 					},
 					physicsPushConstants
diff --git a/src/vkcv/Core.cpp b/src/vkcv/Core.cpp
index 25b461ce..a5786b1a 100644
--- a/src/vkcv/Core.cpp
+++ b/src/vkcv/Core.cpp
@@ -323,7 +323,7 @@ namespace vkcv
 			}
 
 			for (size_t i = 0; i < drawcalls.size(); i++) {
-				recordDrawcall(drawcalls[i], cmdBuffer, pipelineLayout, pushConstantData, i);
+				recordDrawcall(*this, drawcalls[i], cmdBuffer, pipelineLayout, pushConstantData, i);
 			}
 
 			cmdBuffer.endRenderPass();
@@ -490,6 +490,7 @@ namespace vkcv
 			for (size_t i = 0; i < drawcalls.size(); i++) {
                 const uint32_t pushConstantOffset = i * pushConstantData.getSizePerDrawcall();
                 recordMeshShaderDrawcall(
+					*this,
                     cmdBuffer,
                     pipelineLayout,
                     pushConstantData,
@@ -529,7 +530,7 @@ namespace vkcv
 					vk::PipelineBindPoint::eRayTracingKHR,
 					rtxPipelineLayout,
 					usage.setLocation,
-					{ usage.vulkanHandle },
+					{ getDescriptorSet(usage.descriptorSet).vulkanHandle },
 					usage.dynamicOffsets
 				);
 			}
@@ -570,7 +571,7 @@ namespace vkcv
 					vk::PipelineBindPoint::eCompute,
 					pipelineLayout,
 					usage.setLocation,
-					{ usage.vulkanHandle },
+					{ getDescriptorSet(usage.descriptorSet).vulkanHandle },
 					usage.dynamicOffsets
 				);
 			}
@@ -649,7 +650,7 @@ namespace vkcv
 					vk::PipelineBindPoint::eCompute,
 					pipelineLayout,
 					usage.setLocation,
-					{ usage.vulkanHandle },
+					{ getDescriptorSet(usage.descriptorSet).vulkanHandle },
 					usage.dynamicOffsets
 				);
 			}
diff --git a/src/vkcv/DrawcallRecording.cpp b/src/vkcv/DrawcallRecording.cpp
index 638df388..0a13785b 100644
--- a/src/vkcv/DrawcallRecording.cpp
+++ b/src/vkcv/DrawcallRecording.cpp
@@ -1,5 +1,7 @@
-#include <vkcv/DrawcallRecording.hpp>
-#include <vkcv/Logger.hpp>
+
+#include "vkcv/DrawcallRecording.hpp"
+#include "vkcv/Logger.hpp"
+#include "vkcv/Core.hpp"
 
 namespace vkcv {
 
@@ -14,6 +16,7 @@ namespace vkcv {
     }
 
     void recordDrawcall(
+		const Core				&core,
         const DrawcallInfo      &drawcall,
         vk::CommandBuffer       cmdBuffer,
         vk::PipelineLayout      pipelineLayout,
@@ -30,7 +33,7 @@ namespace vkcv {
                 vk::PipelineBindPoint::eGraphics,
                 pipelineLayout,
                 descriptorUsage.setLocation,
-                descriptorUsage.vulkanHandle,
+                core.getDescriptorSet(descriptorUsage.descriptorSet).vulkanHandle,
                 nullptr);
         }
 
@@ -78,6 +81,7 @@ namespace vkcv {
     }
 
     void recordMeshShaderDrawcall(
+		const Core&								core,
         vk::CommandBuffer                       cmdBuffer,
         vk::PipelineLayout                      pipelineLayout,
         const PushConstants&                    pushConstantData,
@@ -90,7 +94,7 @@ namespace vkcv {
                 vk::PipelineBindPoint::eGraphics,
                 pipelineLayout,
                 descriptorUsage.setLocation,
-                descriptorUsage.vulkanHandle,
+				core.getDescriptorSet(descriptorUsage.descriptorSet).vulkanHandle,
                 nullptr);
         }
 
-- 
GitLab