ATOM-16237 Using setting registry to RPI system settings (#3663)
* ATOM-16237 Using setting registry to RPI system settings Changes include: - Remove RHISystemDesriptor since the pre-registered draw list tag is not needed. - Remove EitorContext which was for system component settings. - Add atom_rpi.setreg file - Add getting RPISystemDescriptor from setting registry. Signed-off-by: qingtao <qingtao@amazon.com>
This commit is contained in:
@@ -294,6 +294,7 @@ namespace AZ
|
||||
|
||||
void CommonSystemComponent::Deactivate()
|
||||
{
|
||||
m_loadTemplatesHandler.Disconnect();
|
||||
AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor<RayTracingFeatureProcessor>();
|
||||
AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor<DiffuseGlobalIlluminationFeatureProcessor>();
|
||||
AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor<DiffuseProbeGridFeatureProcessor>();
|
||||
|
||||
@@ -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 <AzCore/Name/Name.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
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<AZ::Name> m_drawListTags;
|
||||
};
|
||||
} // namespace RHI
|
||||
} // namespace AZ
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <Atom/RHI/FrameScheduler.h>
|
||||
#include <Atom/RHI/PipelineStateCache.h>
|
||||
#include <Atom/RHI/RHISystemInterface.h>
|
||||
#include <Atom/RHI.Reflect/RHISystemDescriptor.h>
|
||||
|
||||
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.
|
||||
|
||||
@@ -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 <Atom/RHI.Reflect/RHISystemDescriptor.h>
|
||||
#include <Atom/RHI.Reflect/PlatformLimitsDescriptor.h>
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace RHI
|
||||
{
|
||||
void RHISystemDescriptor::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<RHISystemDescriptor>()
|
||||
->Version(4)
|
||||
->Field("DrawItemTags", &RHISystemDescriptor::m_drawListTags)
|
||||
;
|
||||
|
||||
if (AZ::EditContext* ec = serializeContext->GetEditContext())
|
||||
{
|
||||
ec->Class<RHISystemDescriptor>("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
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <Atom/RHI.Reflect/ReflectSystemComponent.h>
|
||||
#include <Atom/RHI.Reflect/RenderAttachmentLayout.h>
|
||||
#include <Atom/RHI.Reflect/ResolveScopeAttachmentDescriptor.h>
|
||||
#include <Atom/RHI.Reflect/RHISystemDescriptor.h>
|
||||
#include <Atom/RHI.Reflect/Scissor.h>
|
||||
#include <Atom/RHI.Reflect/ScopeAttachmentDescriptor.h>
|
||||
#include <Atom/RHI.Reflect/ShaderDataMappings.h>
|
||||
@@ -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);
|
||||
|
||||
@@ -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<RHI::Device> RHISystem::InitInternalDevice()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <Atom/RPI.Reflect/GpuQuerySystemDescriptor.h>
|
||||
#include <Atom/RPI.Reflect/Image/ImageSystemDescriptor.h>
|
||||
#include <Atom/RHI.Reflect/RHISystemDescriptor.h>
|
||||
|
||||
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";
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
|
||||
#include <Atom/RHI/Factory.h>
|
||||
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/IO/IOUtils.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/Settings/SettingsRegistry.h>
|
||||
|
||||
#ifdef RPI_EDITOR
|
||||
#include <Atom/RPI.Edit/Material/MaterialFunctorSourceDataRegistration.h>
|
||||
#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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -25,21 +25,6 @@ namespace AZ
|
||||
->Field("SystemStreamingImagePoolSize", &ImageSystemDescriptor::m_systemStreamingImagePoolSize)
|
||||
->Field("SystemAttachmentImagePoolSize", &ImageSystemDescriptor::m_systemAttachmentImagePoolSize)
|
||||
;
|
||||
|
||||
if (AZ::EditContext* ec = serializeContext->GetEditContext())
|
||||
{
|
||||
ec->Class<ImageSystemDescriptor>("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
|
||||
|
||||
@@ -25,35 +25,12 @@ namespace AZ
|
||||
;
|
||||
|
||||
serializeContext->Class<RPISystemDescriptor>()
|
||||
->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<DynamicDrawSystemDescriptor>("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<RPISystemDescriptor>("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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user