Skip to content

Commit

Permalink
Add image size extraction from root pass atachment
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Kamieniecki <[email protected]>
  • Loading branch information
arturkamieniecki committed Oct 18, 2024
1 parent 4c3b9aa commit 7209ee8
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions Gem/Code/Source/Renderer/CloudscapeFeatureProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,29 @@ namespace VolumetricClouds

void CloudscapeFeatureProcessor::AddRenderPasses([[maybe_unused]] AZ::RPI::RenderPipeline* renderPipeline)
{
uint32_t width;
uint32_t height;
// Extract the image size from the first attachment of the render pipeline.
auto renderRootPass = renderPipeline->GetRootPass();
if (!renderRootPass)
{
return;
}

// Getting the viewport size for the main pipeline as the target render sizes are note set in the render settings.
if (renderPipeline->GetDescriptor().m_name == "MainPipeline_0")
auto rootBinding = renderRootPass->GetInputOutputBinding(0);
auto rootAttachment = rootBinding.GetAttachment();
if (!rootAttachment)
{
width = m_viewportSize.m_width;
height = m_viewportSize.m_height;
return;
}
else

if (rootAttachment->GetAttachmentType() != AZ::RHI::AttachmentType::Image)
{
width = renderPipeline->GetRenderSettings().m_size.m_width;
height = renderPipeline->GetRenderSettings().m_size.m_height;
return;
}
auto attachmentImageDesc = rootAttachment->GetTransientImageDescriptor();
auto imageSize = attachmentImageDesc.m_imageDescriptor.m_size;

uint32_t width = imageSize.m_width;
uint32_t height = imageSize.m_height;

// Add a view to a view to pass index map. This is later used when updating which pixel of the cloudscape to ray march.
m_viewToIndexMap[renderPipeline->GetDefaultView()] = m_cloudscapeComputePasses.size();
Expand Down

0 comments on commit 7209ee8

Please sign in to comment.