diff --git a/include/vkcv/DrawcallRecording.hpp b/include/vkcv/DrawcallRecording.hpp index 77e2a2e13bee3248e424d1d9c3d4cad7aaecd34b..4e15403c84757fc68623a567891ce13645bcfc4a 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 46e79897719d5422151ec31837a41f7e58324a71..4aa450da4c11b23d686a2836f815d2c03c3675f7 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 2045db9ea216d6810ec439114e93e06949c45cc0..0f6dfcdeaa3b1efc6f58c1c2d0eb61bbd2090a80 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 0ad6c1250c8a6e01838ae1b52fd52a6dd24fbbe3..aa228b81cb18bfb3bc828a822561a26435cbf959 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 55278b703b6a7c70d7d12e8b86ca5eea2b76cdf8..b825134279163b8aa22163077da9aca0c601bdda 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 532cef11db5b2bb8b5d741f6505507ff23fa4163..cc897e68651de65c7122188b52598535e6637335 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 fea5b1d6f726851ad1d88e71301bffb0f6d71f4a..30116c84b79ae71c683ee865dbf93dd1a37923e9 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 4841743a8e1462bfba572960986a3aba6ea355ab..9b062ab56245c44e5021f164b9e06fed8edd15c3 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 dc7ca7caae5362e74fac82558b530cdce0357bb0..0a9914abf0a28f82eee06c5d2a67067faaff4109 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 a437afac25490e35547d53f432f7994d8e02717d..6ab0a8deff3d5fe906567562cb86d75a1cc2c09b 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 291b97f2fde4719530dcb26eb4baeb197f9b2a74..6637041e5ea9c8f1dd3dadf0303049d2a3b749e9 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 db25f239fd5845d2bd2ac69243ceb48b0b80a6ce..b7c495c070bd354dd58c0fad3f857489ad7408e7 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 bac1fe367031e43cf2fc53d4be23c208f4fb682d..d4c8ec2cac8e26f70da346738da04de16a766a26 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 9ffd2845e1081d56e6026a10f19abd36e82d5828..a188c33d63f8c5d190ee02ce4aaef5adc2a8b967 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 0af3bf8cc132db891e070a0068183a702061ee1d..200c0dea16a0b1483a8b20786902b38a43b5f825 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 96968776a6aea9aaa12abfea1bbc966a43548491..44d38850a134327e1bd4733d45e9e2aed295f8b3 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 a7ac2904c173d84d45ffec1d03f3c37fef20c76a..ddb1326ae83c8bd596ce61dc1c47b81b5ddb17be 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 c2e1631098146c8ee82586995a5a9d21e6d85252..5ae7eb6047200b2cdb7a3ac38ce8512cdcaa3d53 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 c5d48fb350226896546c1e9ae23bc5bff656aca4..faa03d38127d5a23c931fdef0470c1e24131d206 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 7157d2f625d5d86d0f916dc3c1d6e4f4c596b546..2245419f87d196e913ba27e8e78ffff73aab04b6 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 baba070e599409a13f01fba302e4427ce0238ef8..f9ebf9845470387fca3be3c57dd36e9f0310adbf 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 25b461ce9c984a5c125154b14416cf358546d7d2..a5786b1a79cf2e51ddda6ca251b7dd8d7fffd46a 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 638df388178f79f680c3b9f797d9d435e752fe10..0a13785b93a8d3efb0217e94ad056293d70c0be0 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); }