ATOM-16489 Add find passes functions for Scene or RenderPipeline in PassSystemInterface (#4739) (#4963)
* ATOM-16489 Add find passes functions for Scene or RenderPipeline in PassSystemInterface
Introduced new PassSystemInterface::ForEachPass() funtion to replace PassSystemInterface::FindPasses(), PassSystemInterface::GetPassesByTemplateName and ParentPass::FindPassByNameRecursive() functions.
Update all the places which were using those three functions.
The new pass finding filter support any combination of pass name, pass template name, pass class type, pass hirechary, owner scene, owner render pipeline.
Update unit tests.
Signed-off-by: Qing Tao <qingtao@amazon.com>
(cherry picked from commit fe8dac7989)
This commit is contained in:
@@ -10,9 +10,10 @@
|
||||
#include <ACES/Aces.h>
|
||||
#include <Atom/Feature/ACES/AcesDisplayMapperFeatureProcessor.h>
|
||||
#include <Atom/RPI.Public/Pass/FullscreenTrianglePass.h>
|
||||
#include <Atom/RPI.Public/Pass/PassUtils.h>
|
||||
#include <Atom/RPI.Public/Pass/PassFilter.h>
|
||||
#include <Atom/RPI.Public/Pass/PassFactory.h>
|
||||
#include <Atom/RPI.Public/Pass/PassSystemInterface.h>
|
||||
#include <Atom/RPI.Public/Pass/PassUtils.h>
|
||||
#include <Atom/RPI.Public/Pass/Specific/SwapChainPass.h>
|
||||
#include <Atom/RPI.Public/RenderPipeline.h>
|
||||
#include <Atom/RPI.Public/RPIUtils.h>
|
||||
@@ -66,22 +67,14 @@ namespace AZ
|
||||
{
|
||||
// Need to invalidate the CopyToSwapChain pass so that it updates the pipeline state in the event that
|
||||
// the swapchain format changed (for example, moving from LDR to HDR display)
|
||||
auto* passSystem = RPI::PassSystemInterface::Get();
|
||||
const Name fullscreenCopyTemplateName("FullscreenCopyTemplate");
|
||||
|
||||
if (passSystem->HasPassesForTemplateName(fullscreenCopyTemplateName))
|
||||
{
|
||||
const AZStd::vector<RPI::Pass*>& passes = passSystem->GetPassesForTemplateName(fullscreenCopyTemplateName);
|
||||
for (RPI::Pass* pass : passes)
|
||||
const Name copyToSwapChainPassName("CopyToSwapChain");
|
||||
RPI::PassFilter passFilter = RPI::PassFilter::CreateWithPassName(copyToSwapChainPassName, GetRenderPipeline());
|
||||
RPI::PassSystemInterface::Get()->ForEachPass(passFilter, [](RPI::Pass* pass) -> RPI::PassFilterExecutionFlow
|
||||
{
|
||||
RPI::FullscreenTrianglePass* fullscreenTrianglePass = azrtti_cast<RPI::FullscreenTrianglePass*>(pass);
|
||||
const Name& passName = fullscreenTrianglePass->GetName();
|
||||
if (passName.GetStringView() == "CopyToSwapChain")
|
||||
{
|
||||
fullscreenTrianglePass->QueueForInitialization();
|
||||
}
|
||||
}
|
||||
}
|
||||
pass->QueueForInitialization();
|
||||
return RPI::PassFilterExecutionFlow::StopVisitingPasses;
|
||||
});
|
||||
|
||||
ConfigureDisplayParameters();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user