Graphics/FramePass: Replace render rect parameter of CommandCallback by FramePassEnvironment

This commit is contained in:
Jérôme Leclercq
2022-02-27 18:37:05 +01:00
parent 28531f5118
commit 8a097afb1b
7 changed files with 56 additions and 40 deletions

View File

@@ -67,6 +67,12 @@ namespace Nz
if (!passData.name.empty())
builder.BeginDebugRegion(passData.name, Color::Green);
FramePassEnvironment env{
*this,
passData.renderRect,
renderFrame
};
bool first = true;
for (auto& subpass : passData.subpasses)
{
@@ -75,7 +81,7 @@ namespace Nz
first = false;
subpass.commandCallback(builder, passData.renderRect);
subpass.commandCallback(builder, env);
}
if (!passData.name.empty())

View File

@@ -137,7 +137,7 @@ namespace Nz
return (m_rebuildCommandBuffer) ? FramePassExecution::UpdateAndExecute : FramePassExecution::Execute;
});
depthPrepass.SetCommandCallback([this](CommandBufferBuilder& builder, const Recti& /*renderRect*/)
depthPrepass.SetCommandCallback([this](CommandBufferBuilder& builder, const FramePassEnvironment& /*env*/)
{
Recti viewport = m_viewer->GetViewport();

View File

@@ -532,10 +532,10 @@ namespace Nz
mergePass.AddOutput(renderTargetData.finalAttachment);
mergePass.SetClearColor(0, Color::Black);
mergePass.SetCommandCallback([&targetViewers](CommandBufferBuilder& builder, const Recti& renderRect)
mergePass.SetCommandCallback([&targetViewers](CommandBufferBuilder& builder, const Nz::FramePassEnvironment& env)
{
builder.SetScissor(renderRect);
builder.SetViewport(renderRect);
builder.SetScissor(env.renderRect);
builder.SetViewport(env.renderRect);
Graphics* graphics = Graphics::Instance();
builder.BindPipeline(*graphics->GetBlitPipeline(false));

View File

@@ -282,7 +282,7 @@ namespace Nz
return (m_rebuildCommandBuffer) ? FramePassExecution::UpdateAndExecute : FramePassExecution::Execute;
});
forwardPass.SetCommandCallback([this](CommandBufferBuilder& builder, const Recti& /*renderRect*/)
forwardPass.SetCommandCallback([this](CommandBufferBuilder& builder, const FramePassEnvironment& /*env*/)
{
Recti viewport = m_viewer->GetViewport();