Graphics/FramePass: Add SetReadInput method
This commit is contained in:
parent
dfa2a0040a
commit
90ab0e9438
|
|
@ -672,10 +672,7 @@ int main()
|
||||||
Nz::PixelFormat::RGBA16F
|
Nz::PixelFormat::RGBA16F
|
||||||
});
|
});
|
||||||
|
|
||||||
bloomOutput = graph.AddAttachment({
|
bloomOutput = graph.AddAttachmentProxy("Bloom output", lightOutput);
|
||||||
"Backbuffer",
|
|
||||||
Nz::PixelFormat::RGBA16F
|
|
||||||
});
|
|
||||||
|
|
||||||
unsigned int bloomSize = 50'000;
|
unsigned int bloomSize = 50'000;
|
||||||
bloomBrightOutput = graph.AddAttachment({
|
bloomBrightOutput = graph.AddAttachment({
|
||||||
|
|
@ -889,11 +886,6 @@ int main()
|
||||||
builder.SetViewport(renderArea);
|
builder.SetViewport(renderArea);
|
||||||
builder.BindVertexBuffer(0, *fullscreenVertexBuffer);
|
builder.BindVertexBuffer(0, *fullscreenVertexBuffer);
|
||||||
|
|
||||||
// Blit light output
|
|
||||||
builder.BindPipeline(*Nz::Graphics::Instance()->GetBlitPipeline(false));
|
|
||||||
builder.BindShaderBinding(0, *bloomBlitBinding);
|
|
||||||
builder.Draw(3);
|
|
||||||
|
|
||||||
// Blend bloom
|
// Blend bloom
|
||||||
builder.BindPipeline(*bloomBlendPipeline);
|
builder.BindPipeline(*bloomBlendPipeline);
|
||||||
for (std::size_t i = 0; i < BloomSubdivisionCount; ++i)
|
for (std::size_t i = 0; i < BloomSubdivisionCount; ++i)
|
||||||
|
|
@ -909,6 +901,8 @@ int main()
|
||||||
});
|
});
|
||||||
|
|
||||||
bloomBlendPass.AddInput(lightOutput);
|
bloomBlendPass.AddInput(lightOutput);
|
||||||
|
bloomBlendPass.SetReadInput(0, false);
|
||||||
|
|
||||||
for (std::size_t i = 0; i < BloomSubdivisionCount; ++i)
|
for (std::size_t i = 0; i < BloomSubdivisionCount; ++i)
|
||||||
bloomBlendPass.AddInput(bloomTextures[i * 2 + 1]);
|
bloomBlendPass.AddInput(bloomTextures[i * 2 + 1]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,10 @@ namespace Nz
|
||||||
inline void SetCommandCallback(CommandCallback callback);
|
inline void SetCommandCallback(CommandCallback callback);
|
||||||
inline void SetClearColor(std::size_t outputIndex, const std::optional<Color>& color);
|
inline void SetClearColor(std::size_t outputIndex, const std::optional<Color>& color);
|
||||||
inline void SetDepthStencilClear(float depth, UInt32 stencil);
|
inline void SetDepthStencilClear(float depth, UInt32 stencil);
|
||||||
inline void SetExecutionCallback(ExecutionCallback callback);
|
|
||||||
|
|
||||||
inline void SetDepthStencilInput(std::size_t attachmentId);
|
inline void SetDepthStencilInput(std::size_t attachmentId);
|
||||||
inline void SetDepthStencilOutput(std::size_t attachmentId);
|
inline void SetDepthStencilOutput(std::size_t attachmentId);
|
||||||
|
inline void SetExecutionCallback(ExecutionCallback callback);
|
||||||
|
inline void SetReadInput(std::size_t inputIndex, bool doesRead);
|
||||||
|
|
||||||
FramePass& operator=(const FramePass&) = delete;
|
FramePass& operator=(const FramePass&) = delete;
|
||||||
FramePass& operator=(FramePass&&) noexcept = default;
|
FramePass& operator=(FramePass&&) noexcept = default;
|
||||||
|
|
@ -80,6 +80,7 @@ namespace Nz
|
||||||
struct Input
|
struct Input
|
||||||
{
|
{
|
||||||
std::size_t attachmentId;
|
std::size_t attachmentId;
|
||||||
|
bool doesRead = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Output
|
struct Output
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,12 @@ namespace Nz
|
||||||
m_executionCallback = std::move(callback);
|
m_executionCallback = std::move(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void FramePass::SetReadInput(std::size_t inputIndex, bool doesRead)
|
||||||
|
{
|
||||||
|
assert(inputIndex < m_inputs.size());
|
||||||
|
m_inputs[inputIndex].doesRead = doesRead;
|
||||||
|
}
|
||||||
|
|
||||||
inline void FramePass::SetDepthStencilInput(std::size_t attachmentId)
|
inline void FramePass::SetDepthStencilInput(std::size_t attachmentId)
|
||||||
{
|
{
|
||||||
m_depthStencilInput = attachmentId;
|
m_depthStencilInput = attachmentId;
|
||||||
|
|
|
||||||
|
|
@ -658,7 +658,7 @@ namespace Nz
|
||||||
std::vector<RenderPass::SubpassDescription> subpassesDesc;
|
std::vector<RenderPass::SubpassDescription> subpassesDesc;
|
||||||
std::vector<RenderPass::SubpassDependency> subpassesDeps;
|
std::vector<RenderPass::SubpassDependency> subpassesDeps;
|
||||||
|
|
||||||
auto RegisterColorInput = [&](const FramePass::Input& input, PhysicalPassData::Subpass& subpass)
|
auto RegisterColorInputRead = [&](const FramePass::Input& input, PhysicalPassData::Subpass& subpass)
|
||||||
{
|
{
|
||||||
std::size_t textureId = Retrieve(m_pending.attachmentToTextures, input.attachmentId);
|
std::size_t textureId = Retrieve(m_pending.attachmentToTextures, input.attachmentId);
|
||||||
|
|
||||||
|
|
@ -769,7 +769,10 @@ namespace Nz
|
||||||
colorAttachments.reserve(subpassOutputs.size());
|
colorAttachments.reserve(subpassOutputs.size());
|
||||||
|
|
||||||
for (const auto& input : subpassInputs)
|
for (const auto& input : subpassInputs)
|
||||||
RegisterColorInput(input, subpass);
|
{
|
||||||
|
if (input.doesRead)
|
||||||
|
RegisterColorInputRead(input, subpass);
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& output : subpassOutputs)
|
for (const auto& output : subpassOutputs)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue