Graphics/FrameGraph: Fix texture pool issue
This commit is contained in:
parent
9bd411e53c
commit
5963f4c848
|
|
@ -46,7 +46,7 @@ namespace Nz
|
||||||
inline std::size_t AddInput(std::size_t attachmentId);
|
inline std::size_t AddInput(std::size_t attachmentId);
|
||||||
inline std::size_t AddOutput(std::size_t attachmentId);
|
inline std::size_t AddOutput(std::size_t attachmentId);
|
||||||
|
|
||||||
template<typename F> void ForEachAttachment(F&& func) const;
|
template<typename F> void ForEachAttachment(F&& func, bool singleDSInputOutputCall = true) const;
|
||||||
|
|
||||||
inline const CommandCallback& GetCommandCallback() const;
|
inline const CommandCallback& GetCommandCallback() const;
|
||||||
inline const std::optional<DepthStencilClear>& GetDepthStencilClear() const;
|
inline const std::optional<DepthStencilClear>& GetDepthStencilClear() const;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace Nz
|
||||||
return outputIndex;
|
return outputIndex;
|
||||||
}
|
}
|
||||||
template<typename F>
|
template<typename F>
|
||||||
void FramePass::ForEachAttachment(F&& func) const
|
void FramePass::ForEachAttachment(F&& func, bool singleDSInputOutputCall) const
|
||||||
{
|
{
|
||||||
for (const auto& input : m_inputs)
|
for (const auto& input : m_inputs)
|
||||||
func(input.attachmentId);
|
func(input.attachmentId);
|
||||||
|
|
@ -52,7 +52,10 @@ namespace Nz
|
||||||
func(m_depthStencilInput);
|
func(m_depthStencilInput);
|
||||||
|
|
||||||
if (m_depthStencilOutput != FramePass::InvalidAttachmentId && m_depthStencilOutput != m_depthStencilInput)
|
if (m_depthStencilOutput != FramePass::InvalidAttachmentId && m_depthStencilOutput != m_depthStencilInput)
|
||||||
func(m_depthStencilOutput);
|
{
|
||||||
|
if (!singleDSInputOutputCall || m_depthStencilOutput != m_depthStencilInput)
|
||||||
|
func(m_depthStencilOutput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_depthStencilOutput != FramePass::InvalidAttachmentId)
|
else if (m_depthStencilOutput != FramePass::InvalidAttachmentId)
|
||||||
func(m_depthStencilOutput);
|
func(m_depthStencilOutput);
|
||||||
|
|
|
||||||
|
|
@ -245,9 +245,7 @@ namespace Nz
|
||||||
if (passIndex == lastUsingPassId)
|
if (passIndex == lastUsingPassId)
|
||||||
{
|
{
|
||||||
std::size_t textureId = Retrieve(m_pending.attachmentToTextures, attachmentId);
|
std::size_t textureId = Retrieve(m_pending.attachmentToTextures, attachmentId);
|
||||||
|
if (m_pending.texturePool.empty())
|
||||||
// For input/output depth-stencil buffer, the same texture can be used
|
|
||||||
if (m_pending.texturePool.empty() || m_pending.texturePool.back() != textureId)
|
|
||||||
{
|
{
|
||||||
assert(std::find(m_pending.texturePool.begin(), m_pending.texturePool.end(), textureId) == m_pending.texturePool.end());
|
assert(std::find(m_pending.texturePool.begin(), m_pending.texturePool.end(), textureId) == m_pending.texturePool.end());
|
||||||
m_pending.texturePool.push_back(textureId);
|
m_pending.texturePool.push_back(textureId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue