Graphics/FrameGraph: Remove SwapchainFactors attachment size and fully handle multiple viewer sizes
This commit is contained in:
parent
dca8555d34
commit
d7d5c09428
|
|
@ -705,7 +705,7 @@ int main(int argc, char* argv[])
|
|||
godRaysTexture = graph.AddAttachment({
|
||||
.name = "God rays texture",
|
||||
.format = Nz::PixelFormat::RGBA16F,
|
||||
.size = Nz::FramePassAttachmentSize::SwapchainFactor,
|
||||
.size = Nz::FramePassAttachmentSize::ViewerTargetFactor,
|
||||
.width = 50'000,
|
||||
.height = 50'000
|
||||
});
|
||||
|
|
@ -716,7 +716,7 @@ int main(int argc, char* argv[])
|
|||
bloomBrightOutput = graph.AddAttachment({
|
||||
.name = "Bloom bright output",
|
||||
.format = Nz::PixelFormat::RGBA16F,
|
||||
.size = Nz::FramePassAttachmentSize::SwapchainFactor,
|
||||
.size = Nz::FramePassAttachmentSize::ViewerTargetFactor,
|
||||
.width = bloomSize,
|
||||
.height = bloomSize
|
||||
});
|
||||
|
|
@ -726,7 +726,7 @@ int main(int argc, char* argv[])
|
|||
bloomTextures[i * 2 + 0] = graph.AddAttachment({
|
||||
.name = "Bloom texture #" + std::to_string(i),
|
||||
.format = Nz::PixelFormat::RGBA16F,
|
||||
.size = Nz::FramePassAttachmentSize::SwapchainFactor,
|
||||
.size = Nz::FramePassAttachmentSize::ViewerTargetFactor,
|
||||
.width = bloomSize,
|
||||
.height = bloomSize
|
||||
});
|
||||
|
|
@ -735,7 +735,7 @@ int main(int argc, char* argv[])
|
|||
bloomTextures[i * 2 + 1] = graph.AddAttachment({
|
||||
.name = "Bloom texture #" + std::to_string(i),
|
||||
.format = Nz::PixelFormat::RGBA16F,
|
||||
.size = Nz::FramePassAttachmentSize::SwapchainFactor,
|
||||
.size = Nz::FramePassAttachmentSize::ViewerTargetFactor,
|
||||
.width = bloomSize,
|
||||
.height = bloomSize
|
||||
});
|
||||
|
|
@ -746,7 +746,7 @@ int main(int argc, char* argv[])
|
|||
toneMappingOutput = graph.AddAttachment({
|
||||
.name = "Tone mapping",
|
||||
.format = Nz::PixelFormat::RGBA8,
|
||||
.size = Nz::FramePassAttachmentSize::SwapchainFactor,
|
||||
.size = Nz::FramePassAttachmentSize::ViewerTargetFactor,
|
||||
.width = 100'000,
|
||||
.height = 100'000
|
||||
});
|
||||
|
|
@ -1526,7 +1526,7 @@ int main(int argc, char* argv[])
|
|||
clearValues[1].depth = 1.f;
|
||||
clearValues[1].stencil = 0;
|
||||
|
||||
builder.BeginRenderPass(windowRT->GetFramebuffer(frame.GetFramebufferIndex()), windowRT->GetRenderPass(), windowRenderRect, { clearValues[0], clearValues[1] });
|
||||
builder.BeginRenderPass(windowRT->GetFramebuffer(frame.GetImageIndex()), windowRT->GetRenderPass(), windowRenderRect, { clearValues[0], clearValues[1] });
|
||||
{
|
||||
builder.BeginDebugRegion("Main window rendering", Nz::Color::Green());
|
||||
{
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ namespace Nz
|
|||
std::shared_ptr<CommandPool> m_commandPool;
|
||||
std::vector<PassData> m_passes;
|
||||
std::vector<TextureData> m_textures;
|
||||
std::vector<Vector2ui> m_viewerSizes;
|
||||
AttachmentIdToTextureId m_attachmentToTextureMapping;
|
||||
PassIdToPhysicalPassIndex m_passIdToPhysicalPassMapping;
|
||||
unsigned int m_height;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ namespace Nz
|
|||
enum class FramePassAttachmentSize
|
||||
{
|
||||
Fixed,
|
||||
SwapchainFactor,
|
||||
ViewerTargetFactor,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ namespace Nz
|
|||
m_passes(std::move(passes)),
|
||||
m_textures(std::move(textures)),
|
||||
m_attachmentToTextureMapping(std::move(attachmentIdToTextureMapping)),
|
||||
m_passIdToPhysicalPassMapping(std::move(passIdToPhysicalPassMapping)),
|
||||
m_height(0),
|
||||
m_width(0)
|
||||
m_passIdToPhysicalPassMapping(std::move(passIdToPhysicalPassMapping))
|
||||
{
|
||||
const std::shared_ptr<RenderDevice>& renderDevice = Graphics::Instance()->GetRenderDevice();
|
||||
m_commandPool = renderDevice->InstantiateCommandPool(QueueType::Graphics);
|
||||
|
|
@ -131,8 +129,7 @@ namespace Nz
|
|||
|
||||
bool BakedFrameGraph::Resize(RenderFrame& renderFrame, std::span<Vector2ui> viewerTargetSizes)
|
||||
{
|
||||
Vector2ui swapchainSize = renderFrame.GetSize();
|
||||
if (m_width == swapchainSize.x && m_height == swapchainSize.y)
|
||||
if (std::equal(m_viewerSizes.begin(), m_viewerSizes.end(), viewerTargetSizes.begin(), viewerTargetSizes.end()))
|
||||
return false;
|
||||
|
||||
const std::shared_ptr<RenderDevice>& renderDevice = Graphics::Instance()->GetRenderDevice();
|
||||
|
|
@ -147,13 +144,6 @@ namespace Nz
|
|||
texDimensions.y = textureData.height;
|
||||
break;
|
||||
|
||||
case FramePassAttachmentSize::SwapchainFactor:
|
||||
texDimensions = swapchainSize;
|
||||
texDimensions.x *= textureData.width;
|
||||
texDimensions.y *= textureData.height;
|
||||
texDimensions /= 100'000;
|
||||
break;
|
||||
|
||||
case FramePassAttachmentSize::ViewerTargetFactor:
|
||||
texDimensions = viewerTargetSizes[textureData.viewerIndex];
|
||||
texDimensions.x *= textureData.width;
|
||||
|
|
@ -256,9 +246,7 @@ namespace Nz
|
|||
passData.forceCommandBufferRegeneration = true;
|
||||
}
|
||||
|
||||
m_width = swapchainSize.x;
|
||||
m_height = swapchainSize.y;
|
||||
|
||||
m_viewerSizes.assign(viewerTargetSizes.begin(), viewerTargetSizes.end());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue