diff --git a/include/vkcv/Core.hpp b/include/vkcv/Core.hpp index 5677dbf6569a182eddba494852d39320f8154711..24fa92cee527f676aa6d1fd7200c2276374db109 100644 --- a/include/vkcv/Core.hpp +++ b/include/vkcv/Core.hpp @@ -270,6 +270,12 @@ namespace vkcv const uint32_t dispatchCount[3], const std::vector<DescriptorSetUsage> &descriptorSetUsages, const PushConstants& pushConstants); + + void recordBeginDebugLabel(const CommandStreamHandle &cmdStream, + const std::string& label, + const std::array<float, 4>& color); + + void recordEndDebugLabel(const CommandStreamHandle &cmdStream); /** * @brief end recording and present image diff --git a/modules/scene/src/vkcv/scene/Scene.cpp b/modules/scene/src/vkcv/scene/Scene.cpp index d6fa2a40a494ef57386e52a306e962a460c66dd6..c0065af5928d9ad2e2c9afd1a1ea44c35d94d799 100644 --- a/modules/scene/src/vkcv/scene/Scene.cpp +++ b/modules/scene/src/vkcv/scene/Scene.cpp @@ -116,6 +116,10 @@ namespace vkcv::scene { size_t pushConstantsSizePerDrawcall, const RecordMeshDrawcallFunction &record, const std::vector<ImageHandle> &renderTargets) { + m_core->recordBeginDebugLabel(cmdStream, "vkcv::scene::Scene", { + 0.0f, 1.0f, 0.0f, 1.0f + }); + PushConstants pushConstants (pushConstantsSizePerDrawcall); std::vector<DrawcallInfo> drawcalls; size_t count = 0; @@ -137,6 +141,8 @@ namespace vkcv::scene { drawcalls, renderTargets ); + + m_core->recordEndDebugLabel(cmdStream); } Scene Scene::create(Core& core) { diff --git a/modules/upscaling/src/vkcv/upscaling/BilinearUpscaling.cpp b/modules/upscaling/src/vkcv/upscaling/BilinearUpscaling.cpp index 9c36acf5d050e3f4f19223020357b6c32534a2de..54df1829006964b30cc1831dc7115e9d5d222a51 100644 --- a/modules/upscaling/src/vkcv/upscaling/BilinearUpscaling.cpp +++ b/modules/upscaling/src/vkcv/upscaling/BilinearUpscaling.cpp @@ -7,7 +7,13 @@ namespace vkcv::upscaling { void BilinearUpscaling::recordUpscaling(const CommandStreamHandle &cmdStream, const ImageHandle &input, const ImageHandle &output) { + m_core.recordBeginDebugLabel(cmdStream, "vkcv::upscaling::BilinearUpscaling", { + 0.0f, 0.0f, 1.0f, 1.0f + }); + m_core.recordBlitImage(cmdStream, input, output, SamplerFilterType::LINEAR); + + m_core.recordEndDebugLabel(cmdStream); } } diff --git a/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp b/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp index 460a6d0b459fe7d1d2a917a62138fea2e5a40908..ff8f7dab97c2d1b8d1ba1b99a7842e9069f66ea2 100644 --- a/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp +++ b/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp @@ -245,6 +245,10 @@ namespace vkcv::upscaling { void FSRUpscaling::recordUpscaling(const CommandStreamHandle& cmdStream, const ImageHandle& input, const ImageHandle& output) { + m_core.recordBeginDebugLabel(cmdStream, "vkcv::upscaling::FSRUpscaling", { + 1.0f, 0.0f, 0.0f, 1.0f + }); + const uint32_t inputWidth = m_core.getImageWidth(input); const uint32_t inputHeight = m_core.getImageHeight(input); @@ -361,6 +365,8 @@ namespace vkcv::upscaling { PushConstants(0) ); } + + m_core.recordEndDebugLabel(cmdStream); } bool FSRUpscaling::isHdrEnabled() const { diff --git a/projects/mesh_shader/.gitignore b/projects/mesh_shader/.gitignore index 7e24fd7b853bfb0a29d8b30879ef1cb95ad141c0..fd009a6281f4b2b6716e193d23829907f4bb5f33 100644 --- a/projects/mesh_shader/.gitignore +++ b/projects/mesh_shader/.gitignore @@ -1 +1 @@ -first_triangle \ No newline at end of file +mesh_shader \ No newline at end of file diff --git a/src/vkcv/Core.cpp b/src/vkcv/Core.cpp index e8e172dd236ac5cb49d0e2caf03599c198a07092..819b99bd57f33408250af71ca2794b04414e31fa 100644 --- a/src/vkcv/Core.cpp +++ b/src/vkcv/Core.cpp @@ -506,7 +506,50 @@ namespace vkcv recordCommandsToStream(cmdStreamHandle, submitFunction, nullptr); } + + void Core::recordBeginDebugLabel(const CommandStreamHandle &cmdStream, + const std::string& label, + const std::array<float, 4>& color) { +#ifndef NDEBUG + static PFN_vkCmdBeginDebugUtilsLabelEXT beginDebugLabel = reinterpret_cast<PFN_vkCmdBeginDebugUtilsLabelEXT>( + m_Context.getDevice().getProcAddr("vkCmdBeginDebugUtilsLabelEXT") + ); + + if (!beginDebugLabel) { + return; + } + + auto submitFunction = [&](const vk::CommandBuffer& cmdBuffer) { + const vk::DebugUtilsLabelEXT debug ( + label.c_str(), + color + ); + + beginDebugLabel(cmdBuffer, &(static_cast<const VkDebugUtilsLabelEXT&>(debug))); + }; + + recordCommandsToStream(cmdStream, submitFunction, nullptr); +#endif + } + + void Core::recordEndDebugLabel(const CommandStreamHandle &cmdStream) { +#ifndef NDEBUG + static PFN_vkCmdEndDebugUtilsLabelEXT endDebugLabel = reinterpret_cast<PFN_vkCmdEndDebugUtilsLabelEXT>( + m_Context.getDevice().getProcAddr("vkCmdEndDebugUtilsLabelEXT") + ); + + if (!endDebugLabel) { + return; + } + + auto submitFunction = [&](const vk::CommandBuffer& cmdBuffer) { + endDebugLabel(cmdBuffer); + }; + recordCommandsToStream(cmdStream, submitFunction, nullptr); +#endif + } + void Core::endFrame() { if (m_currentSwapchainImageIndex == std::numeric_limits<uint32_t>::max()) { return; diff --git a/src/vkcv/DrawcallRecording.cpp b/src/vkcv/DrawcallRecording.cpp index d89ace3859717f753534402507a713a78bfb6876..ca8b248a06d06c7aed6f8d0e9760645b727a5993 100644 --- a/src/vkcv/DrawcallRecording.cpp +++ b/src/vkcv/DrawcallRecording.cpp @@ -52,8 +52,6 @@ namespace vkcv { } } - - struct MeshShaderFunctions { PFN_vkCmdDrawMeshTasksNV cmdDrawMeshTasks = nullptr;