* ATOM-16747 RPISystemInterface::GetDefaultScene returns the scene created by PreviewRenderer but not the Main Scene
Deprecate GetDefaultScene() function.
Update all the places which use GetDefaultScene to use Scene::GetFeatureProcessorFromEntityId or GetMainScene.
Tested with Editor, UI Editor, Material Editor, game launcher.
Signed-off-by: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com>
(cherry picked from commit 8da6bea073)
* Intial attempt to convert the Atom/RHI/FrameScheduler to use the new TaskGraph api
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Avoid enqueuing work on the active task thread if the submitted task
graph is waitable
When submitting a task graph, supplying a wait event implies that
dependent jobs must occur on threads that do not wait on the event (in
the absence of work stealing). This change prevents this by adding a
notion of a task thread enable/disable state, and prohibiting dependent
jobs from being enqueued on waiting threads.
Signed-off-by: Jeremy Ong <jcong@amazon.com>
* Convert RPI/Scene to use TaskGraph pass 1, Culling jobs remain on the old system
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* RemoveTask Graph changes from the FrameScheduler::ExecuteGroups, use old job system instead
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Per review, removing commented out code
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Cleanup debug code, & build fix
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Add a cvar & interface to query whether to use jobs or task graph
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Make TaskGraph assert if you try to wait inside a job
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Fix TaskTest SpawnSubgraph to account for the new TaskGraphEvent assert on wait in a running task
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* 3 minor cleanups. 1) Events always store a ptr to their executor 2) Fix clang compile error 3) remove an early out.
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Fix double group end that was causing assert/crash plus misc minor diff's with development
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Fix deallocation failure on deactivation of the TaskGraphSystemComponent. Also make the system component account for multiple creation in Unit Tests.
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Update with PR feedback
1) Rename UseTaskGraph to IsTaskGraphActive & update related code
2) prefer TaskExecutor::SetInstance
3) add comments and remove commented out code
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Fix incorrect RTTI name for TaskGraphActiveInterface
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Move TaskGraphSystemComponent CRC calculation to a shared variable
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
Co-authored-by: Jeremy Ong <jcong@amazon.com>
- Removed all unnecessary includes to Atom CpuProfiler.h
- Added includes to AzCore Profiler.h where necessary
Signed-off-by: AMZN-ScottR 24445312+AMZN-ScottR@users.noreply.github.com
- Added new interface type AZ::Debug::Profiler to externally register profiler systems
- Modified the Atom CPU profiler to register as an AzCore profiler
-- This allows full engine markers to be visualized in the associated ImGui tool
- Converted all AZ_ATOM_PROFILE_* macros to use AZ_PROFILE_* macros instead
Signed-off-by: AMZN-ScottR 24445312+AMZN-ScottR@users.noreply.github.com
* Implement sync interval and refresh rate API for RenderViewportWidget
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Measure actual frame timings in the viewport info overlay.
Takes the median of the sum of (frame end - frame begin) to provide more a more representative view of when frames begin and end.
Note: Until VSync is internally supported by the event loop, this will produce nearly identical frame timings as the frame will spend as much time as needed synchronously waiting on a vblank.
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Make frame timing per-pipeline, wire up refresh rate info to ViewportContext
Signed-off-by: nvsickle <nvsickle@amazon.com>
* POC: Frame limit pipeline rendering
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Switch Editor tick to every 0ms to allow better tick accumulation behavior
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Move RPISystemComponent to the tick bus, remove tick accumulation logic
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Add `AddToRenderTickAtInterval` to RenderPipeline API
This allows a pipeline to update at a set cadence, instead of rendering every frame or being directly told when to tick.
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Make ViewportContext enforce a target framerate
-Adds GetFpsLimit/SetFpsLimit for actively limiting FPS
-Calculates a render tick interval based on vsync and the vps limit and updates the current pipeline
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Add r_fps_limit and ed_inactive_viewport_fps_limit cvars
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Quick null check from a crash I bumped into
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Fix off-by-one on FPS calculation (shouldn't include the not-yet-rendered frame)
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Clarify frame time begin initialization
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Fix TrackView export.
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Address some reviewer feedback, revert RPISystem API change, fix CPU profiler.
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Add g_simulation_tick_rate
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Address review feedback, make frame limit updates event driven
Signed-off-by: nvsickle <nvsickle@amazon.com>
* Remove timestamp update from ComponentApplication::Tick
Signed-off-by: nvsickle <nvsickle@amazon.com>
ATOM-16273 Compiling SceneSRG before updating it can cause a gpu crash
Changes include:
1. Removed Scene::SetShaderResourceGroupCallback() function and clean up code which use this function.
2. Moved SceneTimeSrg.azsli to RPI's DefaultSceneSrg folder and setup the constants in RPI::Scene
3. Add AZ::Event for Scene's update srg event which features and update scene srg at proper place
4. UpdateTransformServcie FP to use PrepareSceneSrg event handler.
5. Clean up shaders and srgs used in project templates.
Signed-off-by: Qing Tao <qingtao@amazon.com>
NOTE: The memory driller is still intact for now to avoid needing to
modify allocators, but the frame/cpu portions of driller and the
standalone executable are now gone.
Signed-off-by: Jeremy Ong <jcong@amazon.com>
Adds new instrumentation macros throughout the codebase, using the
visualizer to find where current instrumentation is lacking using the
shadowed sponza sample + editor. Some notes from exploring:
- We spend ~5ms in CullingScene: BeginCulling
- PipelineStateCache: Compact usually 1ms
- CompileImageBarriers takes most of the time in CompileResourceBarriers
Signed-off-by: Jacob Hilliard <jhlliar@amazon.com>
* Final update copyright headers to reference license files at the repo root
Signed-off-by: spham <spham@amazon.com>
* Fix copyright validator unit tests to support the stale O3DE header scenario
Signed-off-by: spham <spham@amazon.com>
Added a ShaderSystem supervariant to provide a system-wide supervariant name.
Changed ShaderAsset to append the system-wide supervariant name when searching for supervariants.
Added the NoMSAA supervariant to several shaders.
- Added a pause button in imgui cpu profiler.
- Added a capture button to save cpu profiling data to a data file.
- Added some profile marks in both RPI and RHI.
* [ATOM-15472] Shader Build Pipeline: Remove Deprecated Files And Functions That
Predate The Shader Supervariants
These are the essential impactful changes as a result of deprecating the
ShaderResourceGroupAsset.
* Addressed feedback by @moudgils. Better comments in header files.
* More updates related with deprecation of ShaderResourceGroupAsset
* Deleted the temporary version 2 classes.
* Updated version of the shader asset builders.
* Updated version of all the shader related classes impacted
by the Supervariant concept and deprecation of ShaderResourceGroupAsset
* Changes to *.pass and DGI, Reflections and RayTracing.
* changes to material related assets
* changes to core lights
* Changes to auxgeom/dynamic draw.
* changes to decals, lyshine, imguipass
* changes to RPI Pass classes
* Shader for SceneSrg, ViewSrg and ForwardPass Srgs.
* changes to mesh, skinned mesh, Morphtarget.
* Fixes to RayTracingPass.cpp & now allow empty srg in shaders.
* Updated Atom_RPI.Tests
* Simplified InstanceDatabase by removing AddHandler
------------------------------------------------------------------------------------
* Updated DiffuseGI precompiled shaders.
Added RayTracingSceneSrg and RayTracingMaterialSrg shader asset.
Updated ShaderAssetCreator::Clone to handle the supervariant when processing root variants.
Co-authored-by: Doug McDiarmid <dmcdiar@amazon.com>
------------------------------------------------------------------------------------
* Changed semantics for some PassSrg to SRG_PerPass_WithFallback.
AuxGeom/FixedShapeProcessor.cpp requires SRG_PerDraw on ObjectSrg.
Removed names of SceneSrg and ViewSrg from RPISystemDescriptor.cpp
* Moved ShaderLib/Atom/Features/DummyEntryFunctions.azsli
To Gems/Atom/RPI/Assets/ShaderLib/Atom/RPI/DummyEntryFunctions.azsli
Removed redundant checking for finalization in
ShaderResourceGroupLayout.cpp
* Fixed race condition bug for Shader::FindOrCreate.
InstanceDatabase<>::CreateInstance() needs to be atomic
for instance creation and initialization.
Added optional InstanceHandler::CreateFunctionWithParams to accomodate
to the needs of Instances that need more than an asset reference
to be able to be created an initialzed.
Removed ShaderResourceGroup::FindOrCreate() only ::Create is available
now.
* Renamed scene_and_view_srgs.* as SceneAndViewSrgs.*
Changed GetAzslFileOfOrigin for GetUniqueId
* Fixed unit tests.
* Reverted the serialization name of m_uniqueId back to
"m_azslFileOfOrigin" so precompiled shaders don't fail
in layout comparison.
* Fixed AtomCore.Tests
Removed non-applicable test. InstanceDatabase.AddHandler() is not
available anymore.
* The Null rhi is re-enabled for shader compilation.
Signed-off-by: garrieta <garrieta@amazon.com>
* 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
Updated AzFramework::Scene to allow it to serve as the one-stop location for localized singletons. Localized singletons in this case are instance that can only occur once in an environment but multiple times within an application. As an example, this allows settings up a single camera per viewport for instance.
Highlights of changes:
Replaced the original ebuses with interfaces and events for easy of use and performance.
Removed the Entity Context specific code and moved that to new locations within the Entity Context itself.
Allowed basic inheritance. If a subsystem isn't found in a scene the parent can optionally be searched.
Scenes can enter a zombie state and avoid immediately being deleted. This is needed for situations where subsystems can't be destroyed until async calls have been completed.
- Created a template class TagRegistery which implements the previous DrawListTagRegistry. The template is used for both DrawListTagRegistry and DrawFilterTagRegistry
- Added DrawFilterTag to DrawItemKeyPair
- Added DrawFilterMask support in DrawPacket and DrawPacketBuilder
- Added CreateDynamicContext for render pipeline which allows draw to selected render pipeline.
- Updated RasterPass's BuildCommandListInternal function to filter draw items for its owner RenderPipeline.
- Updated RHI unit tests.