ATOM-4661 Improvement with pass templates registration from data (#735)

* ATOM-4661 Improvement with pass templates registration from data
- Update PassLibrary so it can load pass templates from more than one files and report duplicate pass templates.
- Added load templates events to pass system so the handlers from any gems can load their own pass templates.
- Added PassSystemInterface::OnReadyLoadTemplatesEvent::Handler in FeatureCommon gem's CommonSystemeComponet to load the PassTemplates.azasset in featureCommon gem.
- Misc: moved BindlessPrototypeSrg.asli from RPI to ASV project; fixed an assert issue when exit ASV
main
Vicky 5 years ago committed by GitHub
parent 883786796d
commit 1c575763c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -274,6 +274,10 @@ namespace AZ
passSystem->AddPassCreator(Name("ReflectionScreenSpaceBlurPass"), &Render::ReflectionScreenSpaceBlurPass::Create); passSystem->AddPassCreator(Name("ReflectionScreenSpaceBlurPass"), &Render::ReflectionScreenSpaceBlurPass::Create);
passSystem->AddPassCreator(Name("ReflectionScreenSpaceBlurChildPass"), &Render::ReflectionScreenSpaceBlurChildPass::Create); passSystem->AddPassCreator(Name("ReflectionScreenSpaceBlurChildPass"), &Render::ReflectionScreenSpaceBlurChildPass::Create);
passSystem->AddPassCreator(Name("ReflectionCopyFrameBufferPass"), &Render::ReflectionCopyFrameBufferPass::Create); passSystem->AddPassCreator(Name("ReflectionCopyFrameBufferPass"), &Render::ReflectionCopyFrameBufferPass::Create);
// setup handler for load pass template mappings
m_loadTemplatesHandler = RPI::PassSystemInterface::OnReadyLoadTemplatesEvent::Handler([this]() { this->LoadPassTemplateMappings(); });
RPI::PassSystemInterface::Get()->ConnectEvent(m_loadTemplatesHandler);
} }
void CommonSystemComponent::Deactivate() void CommonSystemComponent::Deactivate()
@ -292,5 +296,12 @@ namespace AZ
AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor<TransformServiceFeatureProcessor>(); AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor<TransformServiceFeatureProcessor>();
AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor<AuxGeomFeatureProcessor>(); AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor<AuxGeomFeatureProcessor>();
} }
void CommonSystemComponent::LoadPassTemplateMappings()
{
const char* passTemplatesFile = "Passes/PassTemplates.azasset";
RPI::PassSystemInterface::Get()->LoadPassTemplateMappings(passTemplatesFile);
}
} // namespace Render } // namespace Render
} // namespace AZ } // namespace AZ

@ -14,6 +14,8 @@
#include <AzCore/Component/Component.h> #include <AzCore/Component/Component.h>
#include <Atom_Feature_Traits_Platform.h> #include <Atom_Feature_Traits_Platform.h>
#include <Atom/RPI.Public/Pass/PassSystemInterface.h>
#if AZ_TRAIT_LUXCORE_SUPPORTED #if AZ_TRAIT_LUXCORE_SUPPORTED
#include "LuxCore/LuxCoreRenderer.h" #include "LuxCore/LuxCoreRenderer.h"
#endif #endif
@ -41,6 +43,11 @@ namespace AZ
void Activate() override; void Activate() override;
void Deactivate() override; void Deactivate() override;
// Load pass template mappings for this gem
void LoadPassTemplateMappings();
RPI::PassSystemInterface::OnReadyLoadTemplatesEvent::Handler m_loadTemplatesHandler;
#if AZ_TRAIT_LUXCORE_SUPPORTED #if AZ_TRAIT_LUXCORE_SUPPORTED
// LuxCore // LuxCore
LuxCoreRenderer m_luxCore; LuxCoreRenderer m_luxCore;

@ -1,136 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
// NOTE: Nest this array, so Azslc will output a size of the bindingslot to 1
struct FloatBuffer
{
float buffer;
};
// Listed on update frequency
ShaderResourceGroupSemantic FrequencyPerScene
{
FrequencyId = 6;
};
ShaderResourceGroupSemantic FloatBufferSemanticId
{
FrequencyId = 7;
};
ShaderResourceGroup ImageSrg : FrequencyPerScene
{
Sampler m_sampler
{
MaxAnisotropy = 16;
AddressU = Wrap;
AddressV = Wrap;
AddressW = Wrap;
};
// Array of textures
Texture2D m_textureArray[];
}
ShaderResourceGroup FloatBufferSrg : FloatBufferSemanticId
{
StructuredBuffer<FloatBuffer> m_floatBuffer;
};
// Helper functions to read data from the FloatBuffer. The FloatBuffer is accessed with a descriptor and a index.
// The descriptor holds the initial offset within the FloatBuffer, and the index is a sub-index, which increments with each property that is being read.
// The data needs to be read in the same order as it is allocated on the host.
// All float setters
void SetFloat(out float outFloat, in uint desc, inout uint index)
{
outFloat = FloatBufferSrg::m_floatBuffer[desc + index + 0].buffer;
index += 1;
}
void SetFloat2(out float2 outFloat, in uint desc, inout uint index)
{
outFloat.x = FloatBufferSrg::m_floatBuffer[desc + index + 0].buffer;
outFloat.y = FloatBufferSrg::m_floatBuffer[desc + index + 1].buffer;
index += 2;
}
void SetFloat3(out float3 outFloat, in uint desc, inout uint index)
{
outFloat.x = FloatBufferSrg::m_floatBuffer[desc + index + 0].buffer;
outFloat.y = FloatBufferSrg::m_floatBuffer[desc + index + 1].buffer;
outFloat.z = FloatBufferSrg::m_floatBuffer[desc + index + 2].buffer;
index += 3;
}
void SetFloat4(out float4 outFloat, in uint desc, inout uint index)
{
outFloat.x = FloatBufferSrg::m_floatBuffer[desc + index + 0].buffer;
outFloat.y = FloatBufferSrg::m_floatBuffer[desc + index + 1].buffer;
outFloat.z = FloatBufferSrg::m_floatBuffer[desc + index + 2].buffer;
outFloat.w = FloatBufferSrg::m_floatBuffer[desc + index + 3].buffer;
index += 4;
}
// All matrix setters
void SetFloat4x4(out float4x4 outFloat, in uint desc, inout uint index)
{
[unroll(4)]
for(uint i = 0; i < 4; i++)
{
SetFloat4(outFloat[i], desc, index);
}
}
// All uint setters
void SetUint(out uint outUInt, in uint desc, inout uint index)
{
outUInt = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 0].buffer);
index += 1;
}
void SetUint2(out uint2 outUInt, in uint desc, inout uint index)
{
outUInt.x = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 0].buffer);
outUInt.y = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 1].buffer);
index += 2;
}
void SetUint3(out uint3 outUInt, in uint desc, inout uint index)
{
outUInt.x = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 0].buffer);
outUInt.y = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 1].buffer);
outUInt.z = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 2].buffer);
index += 3;
}
void SetUint4(out uint4 outUInt, in uint desc, inout uint index)
{
outUInt.x = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 0].buffer);
outUInt.y = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 1].buffer);
outUInt.z = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 2].buffer);
outUInt.w = asuint(FloatBufferSrg::m_floatBuffer[desc + index + 3].buffer);
index += 4;
}
// All double setters
void SetDouble(out double outDouble, in uint desc, inout uint index)
{
uint lowBits;
uint highBits;
SetUint(highBits, desc, index);
SetUint(lowBits, desc, index);
outDouble = asdouble(lowBits, highBits);
}

@ -21,7 +21,6 @@ set(FILES
Shader/ImagePreview.shader Shader/ImagePreview.shader
ShaderLib/Atom/RPI/Math.azsli ShaderLib/Atom/RPI/Math.azsli
ShaderLib/Atom/RPI/TangentSpace.azsli ShaderLib/Atom/RPI/TangentSpace.azsli
ShaderLib/Atom/RPI/ShaderResourceGroups/BindlessPrototypeSrg.azsli
ShaderLib/Atom/RPI/ShaderResourceGroups/DefaultDrawSrg.azsli ShaderLib/Atom/RPI/ShaderResourceGroups/DefaultDrawSrg.azsli
ShaderLib/Atom/RPI/ShaderResourceGroups/DefaultObjectSrg.azsli ShaderLib/Atom/RPI/ShaderResourceGroups/DefaultObjectSrg.azsli
) )

@ -89,7 +89,7 @@ namespace AZ
// --- Members --- // --- Members ---
// Cached pointer to the pass library to simplify code // Cached pointer to the pass library to simplify code
PassLibrary* m_passLibary = nullptr; PassLibrary* m_passLibrary = nullptr;
// ClassNames are used to look up PassCreators. This list is 1-to-1 with the PassCreator list // ClassNames are used to look up PassCreators. This list is 1-to-1 with the PassCreator list
AZStd::vector<Name> m_passClassNames; AZStd::vector<Name> m_passClassNames;

@ -56,6 +56,9 @@ namespace AZ
// The list of passes created from this template // The list of passes created from this template
AZStd::vector<Pass*> m_passes; AZStd::vector<Pass*> m_passes;
// The pass templates mapping asset id which this template is coming from.
Data::AssetId m_mappingAssetId;
}; };
typedef AZStd::unordered_map<Name, TemplateEntry> TemplateEntriesByName; typedef AZStd::unordered_map<Name, TemplateEntry> TemplateEntriesByName;
@ -105,7 +108,7 @@ namespace AZ
bool LoadPassAsset(const Name& name, const Data::Asset<PassAsset>& passAsset, bool hotReloading = false); bool LoadPassAsset(const Name& name, const Data::Asset<PassAsset>& passAsset, bool hotReloading = false);
// Find asset with specified pass template asset id and load pass template from the asset. // Find asset with specified pass template asset id and load pass template from the asset.
void LoadPassAsset(const Name& name, const Data::AssetId& passAssetId); bool LoadPassAsset(const Name& name, const Data::AssetId& passAssetId);
// Data::AssetBus::Handler overrides... // Data::AssetBus::Handler overrides...
void OnAssetReloaded(Data::Asset<Data::AssetData> asset) override; void OnAssetReloaded(Data::Asset<Data::AssetData> asset) override;

@ -55,6 +55,10 @@ namespace AZ
//! Initializes the PassSystem and the Root Pass and creates the Pass InstanceDatabase //! Initializes the PassSystem and the Root Pass and creates the Pass InstanceDatabase
void Init(); void Init();
//! Initialize and load pass templates
//! This function need to be called after Init()
void InitPassTemplates();
//! Deletes the Root Pass and shuts down the PassSystem //! Deletes the Root Pass and shuts down the PassSystem
void Shutdown(); void Shutdown();
@ -74,6 +78,7 @@ namespace AZ
void SetHotReloading(bool hotReloading) override; void SetHotReloading(bool hotReloading) override;
void SetTargetedPassDebuggingName(const AZ::Name& targetPassName) override; void SetTargetedPassDebuggingName(const AZ::Name& targetPassName) override;
const AZ::Name& GetTargetedPassDebuggingName() const override; const AZ::Name& GetTargetedPassDebuggingName() const override;
void ConnectEvent(OnReadyLoadTemplatesEvent::Handler& handler) override;
// PassSystemInterface factory related functions... // PassSystemInterface factory related functions...
void AddPassCreator(Name className, PassCreator createFunction) override; void AddPassCreator(Name className, PassCreator createFunction) override;
@ -139,6 +144,9 @@ namespace AZ
// Counts the number of passes // Counts the number of passes
int32_t m_passCounter = 0; int32_t m_passCounter = 0;
// Events
OnReadyLoadTemplatesEvent m_loadTemplatesEvent;
}; };
} // namespace RPI } // namespace RPI
} // namespace AZ } // namespace AZ

@ -64,7 +64,10 @@ namespace AZ
//! initializing a scene; //! initializing a scene;
virtual void ProcessQueuedChanges() = 0; virtual void ProcessQueuedChanges() = 0;
//! Load pass templates listed in a name-assetid mapping asset //! Load pass templates listed in a name-assetid mapping asset
//! This function should be called before the render pipelines which use templates from this mappings are created.
//! To load pass template mapping before any render pipelines are created, use OnReadyLoadTemplatesEvent::Handler to
//! load desired pass template mappings
virtual bool LoadPassTemplateMappings(const AZStd::string& templateMappingPath) = 0; virtual bool LoadPassTemplateMappings(const AZStd::string& templateMappingPath) = 0;
//! Writes a pass template to a .pass file which can then be used as a pass asset. Useful for //! Writes a pass template to a .pass file which can then be used as a pass asset. Useful for
@ -148,6 +151,12 @@ namespace AZ
//! Find the SwapChainPass associated with window Handle //! Find the SwapChainPass associated with window Handle
virtual SwapChainPass* FindSwapChainPass(AzFramework::NativeWindowHandle windowHandle) const = 0; virtual SwapChainPass* FindSwapChainPass(AzFramework::NativeWindowHandle windowHandle) const = 0;
using OnReadyLoadTemplatesEvent = AZ::Event<>;
//! Connect a handler to listen to the event that the pass system is ready to load pass templates
//! The event is triggered when pass system is initialized and asset system is ready.
//! The handler can add new pass templates or load pass template mappings from assets
virtual void ConnectEvent(OnReadyLoadTemplatesEvent::Handler& handler) = 0;
private: private:
// These functions are only meant to be used by the Pass class // These functions are only meant to be used by the Pass class
@ -164,17 +173,10 @@ namespace AZ
virtual void UnregisterPass(Pass* pass) = 0; virtual void UnregisterPass(Pass* pass) = 0;
}; };
//! Notifications of the pass system such attachments were rebuilt, pass tree changes namespace PassSystemEvents
class PassSystemNotificiations
: public AZ::EBusTraits
{ {
public: }
//! Notify when any pass's attachment was rebuilt
virtual void OnPassAttachmentsBuilt() = 0;
};
using PassSystemNotificiationBus = AZ::EBus<PassSystemNotificiations>;
} // namespace RPI } // namespace RPI
} // namespace AZ } // namespace AZ

@ -137,13 +137,19 @@ namespace AZ
template<typename AssetDataT> template<typename AssetDataT>
Data::Asset<AssetDataT> LoadCriticalAsset(const AZStd::string& assetFilePath, TraceLevel reporting) Data::Asset<AssetDataT> LoadCriticalAsset(const AZStd::string& assetFilePath, TraceLevel reporting)
{ {
AzFramework::AssetSystem::AssetStatus status = AzFramework::AssetSystem::AssetStatus_Unknown; bool apConnected = false;
AzFramework::AssetSystemRequestBus::BroadcastResult(status, &AzFramework::AssetSystemRequestBus::Events::CompileAssetSync, assetFilePath); AzFramework::AssetSystemRequestBus::BroadcastResult(
apConnected, &AzFramework::AssetSystemRequestBus::Events::ConnectedWithAssetProcessor);
if (status != AzFramework::AssetSystem::AssetStatus_Compiled) if (apConnected)
{ {
AssetUtilsInternal::ReportIssue(reporting, AZStd::string::format("Could not compile asset '%s'", assetFilePath.c_str()).c_str()); AzFramework::AssetSystem::AssetStatus status = AzFramework::AssetSystem::AssetStatus_Unknown;
return {}; AzFramework::AssetSystemRequestBus::BroadcastResult(
status, &AzFramework::AssetSystemRequestBus::Events::CompileAssetSync, assetFilePath);
if (status != AzFramework::AssetSystem::AssetStatus_Compiled)
{
AssetUtilsInternal::ReportIssue(reporting, AZStd::string::format("Could not compile asset '%s'", assetFilePath.c_str()).c_str());
return {};
}
} }
return LoadAssetByProductPath<AssetDataT>(assetFilePath.c_str(), reporting); return LoadAssetByProductPath<AssetDataT>(assetFilePath.c_str(), reporting);

@ -44,9 +44,6 @@ namespace AZ
//! The path of the only one view srg asset for the RPI system. This is used to create any RPI::View. //! The path of the only one view srg asset for the RPI system. This is used to create any RPI::View.
AZStd::string m_viewSrgAssetPath = "shaderlib/viewsrg_viewsrg.azsrg"; AZStd::string m_viewSrgAssetPath = "shaderlib/viewsrg_viewsrg.azsrg";
//! Path of pass templates' name-assetid mapping file.
AZStd::string m_passTemplatesMappingPath = "Passes/PassTemplates.azasset";
ImageSystemDescriptor m_imageSystemDescriptor; ImageSystemDescriptor m_imageSystemDescriptor;
GpuQuerySystemDescriptor m_gpuQuerySystemDescriptor; GpuQuerySystemDescriptor m_gpuQuerySystemDescriptor;
DynamicDrawSystemDescriptor m_dynamicDrawSystemDescriptor; DynamicDrawSystemDescriptor m_dynamicDrawSystemDescriptor;

@ -36,7 +36,7 @@ namespace AZ
{ {
void PassFactory::Init(PassLibrary* passLibrary) void PassFactory::Init(PassLibrary* passLibrary)
{ {
m_passLibary = passLibrary; m_passLibrary = passLibrary;
AddCorePasses(); AddCorePasses();
} }
@ -125,7 +125,7 @@ namespace AZ
Ptr<Pass> PassFactory::CreatePassFromTemplate(Name templateName, Name passName) Ptr<Pass> PassFactory::CreatePassFromTemplate(Name templateName, Name passName)
{ {
const AZStd::shared_ptr<PassTemplate>& passTemplate = m_passLibary->GetPassTemplate(templateName); const AZStd::shared_ptr<PassTemplate>& passTemplate = m_passLibrary->GetPassTemplate(templateName);
if (passTemplate == nullptr) if (passTemplate == nullptr)
{ {
AZ_Error("PassFactory", false, "FAILED TO CREATE PASS [%s]. Could not find pass template [%s]", passName.GetCStr(), templateName.GetCStr()); AZ_Error("PassFactory", false, "FAILED TO CREATE PASS [%s]. Could not find pass template [%s]", passName.GetCStr(), templateName.GetCStr());
@ -143,7 +143,7 @@ namespace AZ
return nullptr; return nullptr;
} }
const AZStd::shared_ptr<PassTemplate>& passTemplate = m_passLibary->GetPassTemplate(passRequest->m_templateName); const AZStd::shared_ptr<PassTemplate>& passTemplate = m_passLibrary->GetPassTemplate(passRequest->m_templateName);
if (passTemplate == nullptr) if (passTemplate == nullptr)
{ {
AZ_Error("PassFactory", false, "FAILED TO CREATE PASS [%s]. Could not find pass template [%s]", passRequest->m_passName.GetCStr(), passRequest->m_templateName.GetCStr()); AZ_Error("PassFactory", false, "FAILED TO CREATE PASS [%s]. Could not find pass template [%s]", passRequest->m_passName.GetCStr(), passRequest->m_templateName.GetCStr());

@ -262,6 +262,7 @@ namespace AZ
} }
// Handle template mapping reload // Handle template mapping reload
// Note: it's a known issue that when mapping asset got reloaded, we only handle the new entries
Data::Asset<AnyAsset> templateMappings = { asset.GetAs<AnyAsset>(), AZ::Data::AssetLoadBehavior::PreLoad }; Data::Asset<AnyAsset> templateMappings = { asset.GetAs<AnyAsset>(), AZ::Data::AssetLoadBehavior::PreLoad };
if (templateMappings) if (templateMappings)
{ {
@ -310,7 +311,7 @@ namespace AZ
return success; return success;
} }
void PassLibrary::LoadPassAsset(const Name& name, const Data::AssetId& passAssetId) bool PassLibrary::LoadPassAsset(const Name& name, const Data::AssetId& passAssetId)
{ {
Data::Asset<PassAsset> passAsset; Data::Asset<PassAsset> passAsset;
if (passAssetId.IsValid()) if (passAssetId.IsValid())
@ -325,11 +326,20 @@ namespace AZ
{ {
Data::AssetBus::MultiHandler::BusConnect(passAssetId); Data::AssetBus::MultiHandler::BusConnect(passAssetId);
} }
return loadSuccess;
} }
bool PassLibrary::LoadPassTemplateMappings(const AZStd::string& templateMappingPath) bool PassLibrary::LoadPassTemplateMappings(const AZStd::string& templateMappingPath)
{ {
Data::Asset<AnyAsset> mappingAsset = AssetUtils::LoadCriticalAsset<AnyAsset>(templateMappingPath.c_str(), AssetUtils::TraceLevel::Error); Data::Asset<AnyAsset> mappingAsset = AssetUtils::LoadCriticalAsset<AnyAsset>(templateMappingPath.c_str(), AssetUtils::TraceLevel::Error);
if (m_templateMappingAssets.find(mappingAsset.GetId()) != m_templateMappingAssets.end())
{
AZ_Warning("PassLibrary", false, "Pass template mapping [%s] was already loaded", mappingAsset.GetHint().c_str());
return true;
}
bool success = LoadPassTemplateMappings(mappingAsset); bool success = LoadPassTemplateMappings(mappingAsset);
if (success) if (success)
{ {
@ -350,13 +360,29 @@ namespace AZ
} }
const AZStd::unordered_map<AZStd::string, Data::AssetId>& assetMapping = mappings->GetAssetMapping(); const AZStd::unordered_map<AZStd::string, Data::AssetId>& assetMapping = mappings->GetAssetMapping();
Data::AssetId mappingAssetId = mappingAsset.GetId();
m_templateEntries.reserve(m_templateEntries.size() + assetMapping.size()); m_templateEntries.reserve(m_templateEntries.size() + assetMapping.size());
for (const auto& assetInfo : assetMapping) for (const auto& assetInfo : assetMapping)
{ {
Name templateName = AZ::Name(assetInfo.first); Name templateName = AZ::Name(assetInfo.first);
if (!HasTemplate(templateName)) if (!HasTemplate(templateName))
{ {
LoadPassAsset(templateName, assetInfo.second); bool loaded = LoadPassAsset(templateName, assetInfo.second);
if (loaded)
{
auto& entry = m_templateEntries[templateName];
entry.m_mappingAssetId = mappingAssetId;
}
}
else
{
// Report a warning if the template was setup in another mappping asset.
// We won't report a warning if the template was loaded from same asset. This only happens when the asset got reloaded.
if (m_templateEntries[templateName].m_mappingAssetId != mappingAssetId)
{
AZ_Warning("PassLibrary", false, "Template [%s] was aleady added to the library. Duplicated template from [%s]",
templateName.GetCStr(), mappingAsset.ToString<AZStd::string>().c_str());
}
} }
} }

@ -100,6 +100,12 @@ namespace AZ
m_rootPass->m_flags.m_partOfHierarchy = true; m_rootPass->m_flags.m_partOfHierarchy = true;
} }
void PassSystem::InitPassTemplates()
{
AZ_Assert(m_rootPass, "PassSystem::Init() need to be called");
m_loadTemplatesEvent.Signal();
}
bool PassSystem::LoadPassTemplateMappings(const AZStd::string& templateMappingPath) bool PassSystem::LoadPassTemplateMappings(const AZStd::string& templateMappingPath)
{ {
return m_passLibrary.LoadPassTemplateMappings(templateMappingPath); return m_passLibrary.LoadPassTemplateMappings(templateMappingPath);
@ -213,7 +219,6 @@ namespace AZ
DebugPrintPassHierarchy(); DebugPrintPassHierarchy();
} }
#endif #endif
PassSystemNotificiationBus::Broadcast(&PassSystemNotificiationBus::Events::OnPassAttachmentsBuilt);
} }
m_isBuilding = false; m_isBuilding = false;
@ -323,6 +328,11 @@ namespace AZ
return m_targetedPassDebugName; return m_targetedPassDebugName;
} }
void PassSystem::ConnectEvent(OnReadyLoadTemplatesEvent::Handler& handler)
{
handler.Connect(m_loadTemplatesEvent);
}
// --- Pass Factory Functions --- // --- Pass Factory Functions ---
void PassSystem::AddPassCreator(Name className, PassCreator createFunction) void PassSystem::AddPassCreator(Name className, PassCreator createFunction)

@ -369,12 +369,7 @@ namespace AZ
m_bufferSystem.Init(); m_bufferSystem.Init();
m_dynamicDraw.Init(m_descriptor.m_dynamicDrawSystemDescriptor); m_dynamicDraw.Init(m_descriptor.m_dynamicDrawSystemDescriptor);
// Have pass system load default pass template mapping m_passSystem.InitPassTemplates();
bool passSystemReady = m_passSystem.LoadPassTemplateMappings(m_descriptor.m_passTemplatesMappingPath);
if (!passSystemReady)
{
return;
}
m_systemAssetsInitialized = true; m_systemAssetsInitialized = true;
} }

@ -99,7 +99,6 @@ namespace AZ
{ {
WaitAndCleanCompletionJob(m_simulationCompletion); WaitAndCleanCompletionJob(m_simulationCompletion);
SceneRequestBus::Handler::BusDisconnect(); SceneRequestBus::Handler::BusDisconnect();
DisableAllFeatureProcessors();
// Remove all the render pipelines. Need to process queued changes with pass system before and after remove render pipelines // Remove all the render pipelines. Need to process queued changes with pass system before and after remove render pipelines
AZ::RPI::PassSystemInterface::Get()->ProcessQueuedChanges(); AZ::RPI::PassSystemInterface::Get()->ProcessQueuedChanges();
@ -111,6 +110,8 @@ namespace AZ
m_pipelines.clear(); m_pipelines.clear();
AZ::RPI::PassSystemInterface::Get()->ProcessQueuedChanges(); AZ::RPI::PassSystemInterface::Get()->ProcessQueuedChanges();
Deactivate();
delete m_cullingScene; delete m_cullingScene;
} }
@ -138,8 +139,11 @@ namespace AZ
void Scene::Deactivate() void Scene::Deactivate()
{ {
AZ_Assert(m_activated, "Not activated"); if (!m_activated)
{
return;
}
for (auto& fp : m_featureProcessors) for (auto& fp : m_featureProcessors)
{ {
fp->Deactivate(); fp->Deactivate();
@ -240,7 +244,6 @@ namespace AZ
fp->Deactivate(); fp->Deactivate();
} }
m_featureProcessors.clear(); m_featureProcessors.clear();
m_pipelineStatesLookup.clear();
} }
FeatureProcessor* Scene::GetFeatureProcessor(const FeatureProcessorId& featureProcessorId) const FeatureProcessor* Scene::GetFeatureProcessor(const FeatureProcessorId& featureProcessorId) const

Loading…
Cancel
Save