diff --git a/Gems/Atom/Feature/Common/Code/Source/CommonSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/CommonSystemComponent.cpp index 1500079b00..de03c08c6f 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CommonSystemComponent.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CommonSystemComponent.cpp @@ -294,6 +294,7 @@ namespace AZ void CommonSystemComponent::Deactivate() { + m_loadTemplatesHandler.Disconnect(); AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor(); AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor(); AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor(); diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h deleted file mode 100644 index 8c512662e7..0000000000 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include -#include - -namespace AZ -{ - class ReflectContext; - - - namespace RHI - { - class PlatformLimits; - struct RHISystemDescriptor final - { - AZ_TYPE_INFO(RHISystemDescriptor, "{A506DA28-856C-483A-938D-73471D2C5A5B}"); - static void Reflect(AZ::ReflectContext* context); - - //! The set of globally declared draw list tags, which will be registered with the registry at startup. - AZStd::vector m_drawListTags; - }; - } // namespace RHI -} // namespace AZ diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h index 25026b5b87..599108654a 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h @@ -14,7 +14,6 @@ #include #include #include -#include namespace AZ { @@ -33,7 +32,7 @@ namespace AZ void InitDevice(); //! This function initializes the rest of the RHI/RHI backend. - void Init(const RHISystemDescriptor& descriptor); + void Init(); void Shutdown(); //! An external callback to build the frame graph. diff --git a/Gems/Atom/RHI/Code/Source/RHI.Reflect/RHISystemDescriptor.cpp b/Gems/Atom/RHI/Code/Source/RHI.Reflect/RHISystemDescriptor.cpp deleted file mode 100644 index 45463c79ac..0000000000 --- a/Gems/Atom/RHI/Code/Source/RHI.Reflect/RHISystemDescriptor.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -#include -#include - -namespace AZ -{ - namespace RHI - { - void RHISystemDescriptor::Reflect(AZ::ReflectContext* context) - { - if (auto* serializeContext = azrtti_cast(context)) - { - serializeContext->Class() - ->Version(4) - ->Field("DrawItemTags", &RHISystemDescriptor::m_drawListTags) - ; - - if (AZ::EditContext* ec = serializeContext->GetEditContext()) - { - ec->Class("RHI Settings", "Settings for runtime RHI system") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(AZ::Edit::UIHandlers::Default, &RHISystemDescriptor::m_drawListTags, "Draw List Tags", "The set of globally declared draw list tags, which will be registered with the registry at startup.") - ; - } - } - } - } // namespace RPI -} // namespace AZ diff --git a/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp b/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp index 691a07b24d..c7f7e777aa 100644 --- a/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -161,7 +160,6 @@ namespace AZ TransientAttachmentPoolBudgets::Reflect(context); PlatformLimits::Reflect(context); PlatformLimitsDescriptor::Reflect(context); - RHISystemDescriptor::Reflect(context); Origin::Reflect(context); ReflectVendorIdEnums(context); PhysicalDeviceDriverValidator::Reflect(context); diff --git a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp index ed755c538a..b03cb34140 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp @@ -36,7 +36,7 @@ namespace AZ m_device = InitInternalDevice(); } - void RHISystem::Init(const RHISystemDescriptor& descriptor) + void RHISystem::Init() { m_cpuProfiler.Init(); @@ -86,14 +86,6 @@ namespace AZ frameSchedulerDescriptor.m_platformLimitsDescriptor = platformLimitsDescriptor; m_frameScheduler.Init(*m_device, frameSchedulerDescriptor); - - // Register draw list tags declared from content. - for (const Name& drawListName : descriptor.m_drawListTags) - { - RHI::DrawListTag drawListTag = m_drawListTagRegistry->AcquireTag(drawListName); - - AZ_Warning("RHISystem", drawListTag.IsValid(), "Failed to register draw list tag '%s'. Registry at capacity.", drawListName.GetCStr()); - } } RHI::Ptr RHISystem::InitInternalDevice() diff --git a/Gems/Atom/RHI/Code/atom_rhi_reflect_files.cmake b/Gems/Atom/RHI/Code/atom_rhi_reflect_files.cmake index 9c4ca9a60d..e211462eeb 100644 --- a/Gems/Atom/RHI/Code/atom_rhi_reflect_files.cmake +++ b/Gems/Atom/RHI/Code/atom_rhi_reflect_files.cmake @@ -118,9 +118,7 @@ set(FILES Include/Atom/RHI.Reflect/SwapChainDescriptor.h Source/RHI.Reflect/SwapChainDescriptor.cpp Include/Atom/RHI.Reflect/ReflectSystemComponent.h - Include/Atom/RHI.Reflect/RHISystemDescriptor.h Source/RHI.Reflect/ReflectSystemComponent.cpp - Source/RHI.Reflect/RHISystemDescriptor.cpp Include/Atom/RHI.Reflect/AliasedHeapEnums.h Include/Atom/RHI.Reflect/TransientBufferDescriptor.h Include/Atom/RHI.Reflect/TransientImageDescriptor.h diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Image/ImageSystemDescriptor.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Image/ImageSystemDescriptor.h index 22dec8ce64..e013c1dad1 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Image/ImageSystemDescriptor.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Image/ImageSystemDescriptor.h @@ -21,8 +21,16 @@ namespace AZ AZ_TYPE_INFO(RPI::ImageSystemDescriptor, "{319D14F6-F7F2-487A-AA6B-5800E328C79B}"); static void Reflect(AZ::ReflectContext* context); + //! The maximum size of the image pool used for system streaming images. + //! Check ImageSystemInterface::GetSystemStreamingPool() for detail of this image pool uint64_t m_systemStreamingImagePoolSize = 128 * 1024 * 1024; + + //! The maximum size of the image pool used for system attachments images. + //! Check ImageSystemInterface::GetSystemAttachmentPool() for detail of this image pool uint64_t m_systemAttachmentImagePoolSize = 512 * 1024 * 1024; + + //! The maximum size of the image pool used for streaming images load from assets + //! Check ImageSystemInterface::GetStreamingPool() for detail of this image pool uint64_t m_assetStreamingImagePoolSize = 2u * 1024u * 1024u * 1024u; }; } // namespace RPI diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/RPISystemDescriptor.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/RPISystemDescriptor.h index 2076e72731..1b7b32c1e9 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/RPISystemDescriptor.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/RPISystemDescriptor.h @@ -10,7 +10,6 @@ #include #include -#include namespace AZ { @@ -31,8 +30,6 @@ namespace AZ AZ_TYPE_INFO(RPISystemDescriptor, "{96DAC3DA-40D4-4C03-8D6A-3181E843262A}"); static void Reflect(AZ::ReflectContext* context); - RHI::RHISystemDescriptor m_rhiSystemDescriptor; - //! The asset cache relative path of the only common shader asset for the RPI system that is used //! as means to load the layout for scene srg and view srg. This is used to create any RPI::Scene. AZStd::string m_commonSrgsShaderAssetPath = "shader/sceneandviewsrgs.azshader"; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Private/RPISystemComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Private/RPISystemComponent.cpp index f73673f0e4..2567d221e5 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Private/RPISystemComponent.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Private/RPISystemComponent.cpp @@ -15,9 +15,11 @@ #include +#include #include #include -#include +#include + #ifdef RPI_EDITOR #include #endif @@ -84,8 +86,11 @@ namespace AZ void RPISystemComponent::Activate() { - // [GFX TODO] [ATOM-1436] this can be removed when setup and save system component's configure from projectConfigure.exe is fixed. - m_rpiDescriptor.m_rhiSystemDescriptor.m_drawListTags.push_back(AZ::Name("forward")); + auto settingsRegistry = AZ::SettingsRegistry::Get(); + if (settingsRegistry) + { + settingsRegistry->GetObject(m_rpiDescriptor, "/O3DE/Atom/RPI/Initialization"); + } m_rpiSystem.Initialize(m_rpiDescriptor); AZ::SystemTickBus::Handler::BusConnect(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp index a9028627a0..66c4f6d20a 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp @@ -372,7 +372,7 @@ namespace AZ return; } - m_rhiSystem.Init(m_descriptor.m_rhiSystemDescriptor); + m_rhiSystem.Init(); m_imageSystem.Init(m_descriptor.m_imageSystemDescriptor); m_bufferSystem.Init(); m_dynamicDraw.Init(m_descriptor.m_dynamicDrawSystemDescriptor); @@ -396,7 +396,7 @@ namespace AZ } //Init rhi/image/buffer systems to match InitializeSystemAssets - m_rhiSystem.Init(m_descriptor.m_rhiSystemDescriptor); + m_rhiSystem.Init(); m_imageSystem.Init(m_descriptor.m_imageSystemDescriptor); m_bufferSystem.Init(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Image/ImageSystemDescriptor.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Image/ImageSystemDescriptor.cpp index 611a83be93..937daf3f62 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Image/ImageSystemDescriptor.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Image/ImageSystemDescriptor.cpp @@ -25,21 +25,6 @@ namespace AZ ->Field("SystemStreamingImagePoolSize", &ImageSystemDescriptor::m_systemStreamingImagePoolSize) ->Field("SystemAttachmentImagePoolSize", &ImageSystemDescriptor::m_systemAttachmentImagePoolSize) ; - - if (AZ::EditContext* ec = serializeContext->GetEditContext()) - { - ec->Class("Image System Config", "Settings for RPI Image System") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(AZ::Edit::UIHandlers::Default, &ImageSystemDescriptor::m_assetStreamingImagePoolSize, - "Streaming image pool size for assets", "Streaming image pool size in bytes for streaming images created from assets") - ->DataElement(AZ::Edit::UIHandlers::Default, &ImageSystemDescriptor::m_systemStreamingImagePoolSize, - "System streaming image pool size", "Streaming image pool size in bytes for streaming images created in memory") - ->DataElement(AZ::Edit::UIHandlers::Default, &ImageSystemDescriptor::m_systemAttachmentImagePoolSize, - "System attachment image pool size", "Default attachment image pool size in bytes") - ; - } } } } // namespace RPI diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/RPISystemDescriptor.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/RPISystemDescriptor.cpp index 21c6061d8e..dc379396eb 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/RPISystemDescriptor.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/RPISystemDescriptor.cpp @@ -25,35 +25,12 @@ namespace AZ ; serializeContext->Class() - ->Version(6) // ATOM-15472 - ->Field("RHISystemDescriptor", &RPISystemDescriptor::m_rhiSystemDescriptor) + ->Version(7) // ATOM-16237 ->Field("CommonSrgsShaderAssetPath", &RPISystemDescriptor::m_commonSrgsShaderAssetPath) ->Field("ImageSystemDescriptor", &RPISystemDescriptor::m_imageSystemDescriptor) ->Field("GpuQuerySystemDescriptor", &RPISystemDescriptor::m_gpuQuerySystemDescriptor) ->Field("DynamicDrawSystemDescriptor", &RPISystemDescriptor::m_dynamicDrawSystemDescriptor) ; - - if (AZ::EditContext* ec = serializeContext->GetEditContext()) - { - ec->Class("Dynamic Draw System Settings", "Settings for the Dynamic Draw System") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(AZ::Edit::UIHandlers::Default, &DynamicDrawSystemDescriptor::m_dynamicBufferPoolSize, "Dynamic Buffer Pool Size", "The maxinum size of pool which is used to allocate dynamic buffers") - ; - - ec->Class("RPI Settings", "Settings for runtime RPI system") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_commonSrgsShaderAssetPath, "Common Shader Asset Path For Scene & View SRGs", - "Shader asset path used to get the Scene and View SRGs for all RPI scenes and views respectively") - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_rhiSystemDescriptor, "RHI System Config", "Configuration of Render Hardware Interface") - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_imageSystemDescriptor, "Image System Config", "Configuration of Image System") - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_gpuQuerySystemDescriptor, "Gpu Query System Config", "Configuration of Gpu Query System") - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_dynamicDrawSystemDescriptor, "Dynamic Draw System Config", "Configuration of Dynamic Draw System") - ; - } } } } // namespace RPI diff --git a/Gems/Atom/RPI/Registry/atom_rpi.setreg b/Gems/Atom/RPI/Registry/atom_rpi.setreg new file mode 100644 index 0000000000..bcbade5d38 --- /dev/null +++ b/Gems/Atom/RPI/Registry/atom_rpi.setreg @@ -0,0 +1,24 @@ +{ + "O3DE": { + "Atom": { + "RPI": { + "Initialization": { + "CommonSrgsShaderAssetPath": "shader/sceneandviewsrgs.azshader", + "ImageSystemDescriptor": { + "AssetStreamingImagePoolSize": 2147483648, // 2 * 1024 * 1024 * 1024 + "SystemStreamingImagePoolSize": 134217728, // 128 * 1024 * 1024 + "SystemAttachmentImagePoolSize": 536870912 // 512 * 1024 * 1024 + }, + "GpuQuerySystemDescriptor": { + "OcclusionQueryCount": 128, + "StatisticsQueryCount": 256, + "TimestampQueryCount": 256 + }, + "DynamicDrawSystemDescriptor": { + "DynamicBufferPoolSize": 50331648 // 3 * 16 * 1024 * 1024 (for 3 frames) + } + } + } + } + } +} diff --git a/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp b/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp index d3d2d5655e..f815e2ddbd 100644 --- a/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp +++ b/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp @@ -205,6 +205,10 @@ namespace LyShine //////////////////////////////////////////////////////////////////////////////////////////////////// void LyShineSystemComponent::Deactivate() { +#if !defined(LYSHINE_BUILDER) && !defined(LYSHINE_TESTS) + m_loadTemplatesHandler.Disconnect(); +#endif + UiSystemBus::Handler::BusDisconnect(); UiSystemToolsBus::Handler::BusDisconnect(); UiFrameworkBus::Handler::BusDisconnect();