Fixed potential render scene time precision issues.
The timestamp was simply converted from GetTimeAtCurrentTick to a float. Since this value is backed by QueryPerformanceCounter which is 0 at boot, you could see broken animations on the GPU when your system has been on for a long time. So I simplified the RPI's time API (removed unused code), and subtracted the application start time each frame before converting the time value to a float.
Also moved FindShaderInputConstantIndex("m_time") to be called only once, instead of every frame.
Testing:
Originally: I had a local material shader that did vertex animation and it wasn't working at all before, and now it works.
More recently, I made local changes to StandardPBR to add a simple sin wave animation. I also modified GetTimeNowMicroSecond() to artificially add 30 days to the clock. This showed choppy animation before my changes, and smooth animation after.
AtomSampleViewer passed dx12 and vulkan (other than pre-existing issues)
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
* Atom Timer fix - changed milliseconds to seconds
- Tested on both fog and EyeAdaptation animations - both are the only affected and were broken before
- This is a small fix for pull #3969 that replaced the timer mechanism: https://github.com/o3de/o3de/pull/3969
Signed-off-by: Adi-Amazon <barlev@amazon.com>
* Atom Timer fix - using seconds to begin with and removing obsolete variable
Signed-off-by: Adi-Amazon <barlev@amazon.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>
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>
* 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>
- 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.