Graphics/FrameGraph: Rename AddBackbufferOutput to AddOutput
This commit is contained in:
parent
6a19ab7ba2
commit
f3aacc0cd2
|
|
@ -1037,7 +1037,7 @@ int main(int argc, char* argv[])
|
|||
builder.Draw(3);
|
||||
});
|
||||
|
||||
graph.AddBackbufferOutput(toneMappingOutput);
|
||||
graph.AddOutput(toneMappingOutput);
|
||||
|
||||
return graph.Bake();
|
||||
}();
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Nz
|
|||
inline std::size_t AddAttachmentCubeFace(std::size_t attachmentId, CubemapFace face);
|
||||
inline std::size_t AddAttachmentProxy(std::string name, std::size_t attachmentId);
|
||||
inline FramePass& AddPass(std::string name);
|
||||
inline void AddBackbufferOutput(std::size_t attachmentIndex);
|
||||
inline void AddOutput(std::size_t attachmentIndex);
|
||||
|
||||
BakedFrameGraph Bake();
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ namespace Nz
|
|||
|
||||
using AttachmentType = std::variant<FramePassAttachment, AttachmentProxy, AttachmentArray, AttachmentCube, AttachmentLayer>;
|
||||
|
||||
std::vector<std::size_t> m_backbufferOutputs;
|
||||
std::vector<std::size_t> m_graphOutputs;
|
||||
std::vector<FramePass> m_framePasses;
|
||||
std::vector<AttachmentType> m_attachments;
|
||||
std::unordered_map<std::size_t, std::shared_ptr<Texture>> m_externalTextures;
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@ namespace Nz
|
|||
return m_framePasses.emplace_back(*this, id, std::move(name));
|
||||
}
|
||||
|
||||
inline void FrameGraph::AddBackbufferOutput(std::size_t attachmentIndex)
|
||||
inline void FrameGraph::AddOutput(std::size_t attachmentIndex)
|
||||
{
|
||||
m_backbufferOutputs.push_back(attachmentIndex);
|
||||
m_graphOutputs.push_back(attachmentIndex);
|
||||
}
|
||||
|
||||
inline void FrameGraph::BindExternalTexture(std::size_t attachmentIndex, std::shared_ptr<Texture> texture)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Nz
|
|||
|
||||
BakedFrameGraph FrameGraph::Bake()
|
||||
{
|
||||
if (m_backbufferOutputs.empty())
|
||||
if (m_graphOutputs.empty())
|
||||
throw std::runtime_error("no backbuffer output has been set");
|
||||
|
||||
m_pending.attachmentReadList.clear();
|
||||
|
|
@ -45,7 +45,7 @@ namespace Nz
|
|||
|
||||
BuildReadWriteList();
|
||||
|
||||
for (std::size_t output : m_backbufferOutputs)
|
||||
for (std::size_t output : m_graphOutputs)
|
||||
{
|
||||
auto it = m_pending.attachmentWriteList.find(output);
|
||||
if (it == m_pending.attachmentWriteList.end())
|
||||
|
|
@ -291,7 +291,7 @@ namespace Nz
|
|||
}
|
||||
|
||||
// Add TextureUsage::ShaderSampling and TextureUsage::TransferSource to final outputs
|
||||
for (std::size_t output : m_backbufferOutputs)
|
||||
for (std::size_t output : m_graphOutputs)
|
||||
{
|
||||
auto it = m_pending.attachmentToTextures.find(output);
|
||||
assert(it != m_pending.attachmentToTextures.end());
|
||||
|
|
@ -1089,7 +1089,7 @@ namespace Nz
|
|||
CheckExternalTexture(attachmentIndex, data);
|
||||
|
||||
// Final outputs cannot be reused
|
||||
if (std::find(m_backbufferOutputs.begin(), m_backbufferOutputs.end(), attachmentIndex) != m_backbufferOutputs.end())
|
||||
if (std::find(m_graphOutputs.begin(), m_graphOutputs.end(), attachmentIndex) != m_graphOutputs.end())
|
||||
data.canReuse = false;
|
||||
|
||||
return textureId;
|
||||
|
|
@ -1132,7 +1132,7 @@ namespace Nz
|
|||
CheckExternalTexture(attachmentIndex, data);
|
||||
|
||||
// Final outputs cannot be reused
|
||||
if (std::find(m_backbufferOutputs.begin(), m_backbufferOutputs.end(), attachmentIndex) != m_backbufferOutputs.end())
|
||||
if (std::find(m_graphOutputs.begin(), m_graphOutputs.end(), attachmentIndex) != m_graphOutputs.end())
|
||||
data.canReuse = false;
|
||||
|
||||
return textureId;
|
||||
|
|
@ -1174,7 +1174,7 @@ namespace Nz
|
|||
CheckExternalTexture(attachmentIndex, data);
|
||||
|
||||
// Final outputs cannot be reused
|
||||
if (std::find(m_backbufferOutputs.begin(), m_backbufferOutputs.end(), attachmentIndex) != m_backbufferOutputs.end())
|
||||
if (std::find(m_graphOutputs.begin(), m_graphOutputs.end(), attachmentIndex) != m_graphOutputs.end())
|
||||
data.canReuse = false;
|
||||
|
||||
return textureId;
|
||||
|
|
@ -1218,7 +1218,7 @@ namespace Nz
|
|||
if (m_externalTextures.contains(proxy.attachmentId))
|
||||
throw std::runtime_error("proxy attachments cannot be bound to external textures");
|
||||
|
||||
if (std::find(m_backbufferOutputs.begin(), m_backbufferOutputs.end(), attachmentIndex) != m_backbufferOutputs.end())
|
||||
if (std::find(m_graphOutputs.begin(), m_graphOutputs.end(), attachmentIndex) != m_graphOutputs.end())
|
||||
m_pending.textures[textureId].canReuse = false;
|
||||
|
||||
return textureId;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@ namespace Nz
|
|||
SetSwapchain(m_windowSwapchain->GetSwapchain());
|
||||
}
|
||||
|
||||
void RenderWindow::OnBuildGraph(FrameGraph& graph, std::size_t attachmentIndex) const
|
||||
{
|
||||
graph.AddOutput(attachmentIndex);
|
||||
}
|
||||
|
||||
void RenderWindow::OnRenderEnd(RenderFrame& renderFrame, const BakedFrameGraph& frameGraph, std::size_t finalAttachment) const
|
||||
{
|
||||
const std::shared_ptr<Texture>& texture = frameGraph.GetAttachmentTexture(finalAttachment);
|
||||
|
|
@ -49,11 +54,6 @@ namespace Nz
|
|||
}, QueueType::Graphics);
|
||||
}
|
||||
|
||||
void RenderWindow::OnBuildGraph(FrameGraph& graph, std::size_t attachmentIndex) const
|
||||
{
|
||||
graph.AddBackbufferOutput(attachmentIndex);
|
||||
}
|
||||
|
||||
const Vector2ui& RenderWindow::GetSize() const
|
||||
{
|
||||
if (m_swapchain)
|
||||
|
|
|
|||
Loading…
Reference in New Issue