diff --git a/include/Nazara/Graphics/BakedFrameGraph.hpp b/include/Nazara/Graphics/BakedFrameGraph.hpp index 9a462aca4..d3c609f56 100644 --- a/include/Nazara/Graphics/BakedFrameGraph.hpp +++ b/include/Nazara/Graphics/BakedFrameGraph.hpp @@ -69,6 +69,7 @@ namespace Nz CommandBufferPtr commandBuffer; std::shared_ptr framebuffer; std::shared_ptr renderPass; + std::string name; std::vector outputTextureIndices; std::vector subpasses; std::vector transitions; diff --git a/include/Nazara/Graphics/FrameGraph.hpp b/include/Nazara/Graphics/FrameGraph.hpp index 2e7807fb4..c90c8c81b 100644 --- a/include/Nazara/Graphics/FrameGraph.hpp +++ b/include/Nazara/Graphics/FrameGraph.hpp @@ -71,6 +71,7 @@ namespace Nz std::size_t passIndex; }; + std::string name; std::vector textureTransitions; std::vector passes; }; diff --git a/include/Nazara/Graphics/FramePass.hpp b/include/Nazara/Graphics/FramePass.hpp index 83930e9bb..7e12ca511 100644 --- a/include/Nazara/Graphics/FramePass.hpp +++ b/include/Nazara/Graphics/FramePass.hpp @@ -50,6 +50,7 @@ namespace Nz inline std::size_t GetDepthStencilOutput() const; inline const ExecutionCallback& GetExecutionCallback() const; inline const std::vector& GetInputs() const; + inline const std::string& GetName() const; inline const std::vector& GetOutputs() const; inline std::size_t GetPassId() const; diff --git a/include/Nazara/Graphics/FramePass.inl b/include/Nazara/Graphics/FramePass.inl index 22383a725..34d88c36a 100644 --- a/include/Nazara/Graphics/FramePass.inl +++ b/include/Nazara/Graphics/FramePass.inl @@ -69,6 +69,11 @@ namespace Nz return m_inputs; } + inline const std::string& FramePass::GetName() const + { + return m_name; + } + inline auto FramePass::GetOutputs() const -> const std::vector& { return m_outputs; diff --git a/src/Nazara/Graphics/BakedFrameGraph.cpp b/src/Nazara/Graphics/BakedFrameGraph.cpp index 35f4426c5..47833f400 100644 --- a/src/Nazara/Graphics/BakedFrameGraph.cpp +++ b/src/Nazara/Graphics/BakedFrameGraph.cpp @@ -54,6 +54,9 @@ namespace Nz builder.TextureBarrier(textureTransition.srcStageMask, textureTransition.dstStageMask, textureTransition.srcAccessMask, textureTransition.dstAccessMask, textureTransition.oldLayout, textureTransition.newLayout, *texture); } + if (!passData.name.empty()) + builder.BeginDebugRegion(passData.name, Nz::Color::Green); + builder.BeginRenderPass(*passData.framebuffer, *passData.renderPass, passData.renderRect); bool first = true; @@ -68,6 +71,9 @@ namespace Nz } builder.EndRenderPass(); + + if (!passData.name.empty()) + builder.EndDebugRegion(); }); } diff --git a/src/Nazara/Graphics/FrameGraph.cpp b/src/Nazara/Graphics/FrameGraph.cpp index 0dc7c4cf2..215a133ba 100644 --- a/src/Nazara/Graphics/FrameGraph.cpp +++ b/src/Nazara/Graphics/FrameGraph.cpp @@ -75,6 +75,7 @@ namespace Nz for (auto& physicalPass : m_pending.physicalPasses) { auto& bakedPass = bakedPasses.emplace_back(); + bakedPass.name = std::move(physicalPass.name); bakedPass.renderPass = std::move(m_pending.renderPasses[renderPassIndex++]); bakedPass.transitions = std::move(physicalPass.textureTransitions); @@ -140,13 +141,19 @@ namespace Nz std::size_t physPassIndex = m_pending.physicalPasses.size(); PhysicalPassData& currentPass = m_pending.physicalPasses.emplace_back(); - auto begin = m_pending.passList.begin() + passIndex; + auto it = m_pending.passList.begin() + passIndex; auto end = m_pending.passList.begin() + mergeEnd; - for (; begin < end; ++begin) + for (; it < end; ++it) { + const FramePass& pass = m_framePasses[*it]; + if (currentPass.name.empty()) + currentPass.name = pass.GetName(); + else + currentPass.name += " + " + pass.GetName(); + auto& subpass = currentPass.passes.emplace_back(); - subpass.passIndex = *begin; + subpass.passIndex = *it; m_pending.passIdToPhysicalPassIndex.emplace(subpass.passIndex, physPassIndex); }