Graphics/FrameGraph: Add support for pass name (as debug sections)
This commit is contained in:
parent
ee690072f8
commit
9376cfefd2
|
|
@ -69,6 +69,7 @@ namespace Nz
|
||||||
CommandBufferPtr commandBuffer;
|
CommandBufferPtr commandBuffer;
|
||||||
std::shared_ptr<Framebuffer> framebuffer;
|
std::shared_ptr<Framebuffer> framebuffer;
|
||||||
std::shared_ptr<RenderPass> renderPass;
|
std::shared_ptr<RenderPass> renderPass;
|
||||||
|
std::string name;
|
||||||
std::vector<std::size_t> outputTextureIndices;
|
std::vector<std::size_t> outputTextureIndices;
|
||||||
std::vector<SubpassData> subpasses;
|
std::vector<SubpassData> subpasses;
|
||||||
std::vector<TextureTransition> transitions;
|
std::vector<TextureTransition> transitions;
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ namespace Nz
|
||||||
std::size_t passIndex;
|
std::size_t passIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string name;
|
||||||
std::vector<TextureTransition> textureTransitions;
|
std::vector<TextureTransition> textureTransitions;
|
||||||
std::vector<Subpass> passes;
|
std::vector<Subpass> passes;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ namespace Nz
|
||||||
inline std::size_t GetDepthStencilOutput() const;
|
inline std::size_t GetDepthStencilOutput() const;
|
||||||
inline const ExecutionCallback& GetExecutionCallback() const;
|
inline const ExecutionCallback& GetExecutionCallback() const;
|
||||||
inline const std::vector<Input>& GetInputs() const;
|
inline const std::vector<Input>& GetInputs() const;
|
||||||
|
inline const std::string& GetName() const;
|
||||||
inline const std::vector<Output>& GetOutputs() const;
|
inline const std::vector<Output>& GetOutputs() const;
|
||||||
inline std::size_t GetPassId() const;
|
inline std::size_t GetPassId() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,11 @@ namespace Nz
|
||||||
return m_inputs;
|
return m_inputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const std::string& FramePass::GetName() const
|
||||||
|
{
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
inline auto FramePass::GetOutputs() const -> const std::vector<Output>&
|
inline auto FramePass::GetOutputs() const -> const std::vector<Output>&
|
||||||
{
|
{
|
||||||
return m_outputs;
|
return m_outputs;
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,9 @@ namespace Nz
|
||||||
builder.TextureBarrier(textureTransition.srcStageMask, textureTransition.dstStageMask, textureTransition.srcAccessMask, textureTransition.dstAccessMask, textureTransition.oldLayout, textureTransition.newLayout, *texture);
|
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);
|
builder.BeginRenderPass(*passData.framebuffer, *passData.renderPass, passData.renderRect);
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
@ -68,6 +71,9 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.EndRenderPass();
|
builder.EndRenderPass();
|
||||||
|
|
||||||
|
if (!passData.name.empty())
|
||||||
|
builder.EndDebugRegion();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ namespace Nz
|
||||||
for (auto& physicalPass : m_pending.physicalPasses)
|
for (auto& physicalPass : m_pending.physicalPasses)
|
||||||
{
|
{
|
||||||
auto& bakedPass = bakedPasses.emplace_back();
|
auto& bakedPass = bakedPasses.emplace_back();
|
||||||
|
bakedPass.name = std::move(physicalPass.name);
|
||||||
bakedPass.renderPass = std::move(m_pending.renderPasses[renderPassIndex++]);
|
bakedPass.renderPass = std::move(m_pending.renderPasses[renderPassIndex++]);
|
||||||
bakedPass.transitions = std::move(physicalPass.textureTransitions);
|
bakedPass.transitions = std::move(physicalPass.textureTransitions);
|
||||||
|
|
||||||
|
|
@ -140,13 +141,19 @@ namespace Nz
|
||||||
std::size_t physPassIndex = m_pending.physicalPasses.size();
|
std::size_t physPassIndex = m_pending.physicalPasses.size();
|
||||||
PhysicalPassData& currentPass = m_pending.physicalPasses.emplace_back();
|
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;
|
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();
|
auto& subpass = currentPass.passes.emplace_back();
|
||||||
subpass.passIndex = *begin;
|
subpass.passIndex = *it;
|
||||||
m_pending.passIdToPhysicalPassIndex.emplace(subpass.passIndex, physPassIndex);
|
m_pending.passIdToPhysicalPassIndex.emplace(subpass.passIndex, physPassIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue