Commit Graph

1480 Commits

Author SHA1 Message Date
luke thatcher
09c05037db Fix crashes when the movie player is disabled
- GetMoviePlayer may return nullptr if the player was never initialized. Callers should first check IsMoviePlayerEnabled()

#rb jeannoe.morissette

[CL 36758491 by luke thatcher in 5.5 branch]
2024-10-01 19:39:36 -04:00
luke thatcher
bdf2d7d6c7 Improved game thread frame sync to resolve crashes introduced in 36468180 and worked around in 36479070
- Various legacy game thread code assumes the render thread will never be more than one frame behind. The original change in 36468180 switched from syncing the GT with the RT, to syncing the GT with the RHIT. That left the render thread "floating" in the center of the pipeline, and led to cases where resources are deleted too soon.
 - New approach is to always sync with the GT with the N-1 RT frame, so the GT is never too far ahead of the RT. This maintains compatibility with the legacy GT code paths. In addition to the GT->RT sync, we also sync with the RHIT to prevent the engine running ahead, which was the original bug that 36468180 was fixing.
 - "r.GTSyncType" mode 0 now allows for 1 frame of GT->RT overlap, and 2 frames of GT->RHIT overlap.
 - For debugging purposes, "r.GTSyncType" can also be made negative, which increases the number of GT->RHIT overlap frames, e.g. "r.GTSyncType -3" gives 5 frames of GT->RHIT overlap. While this is not overly useful in a shipped title, it can be used to prove the correctness of the rendering pipeline.
 - Merged the FDeferredCleanupInterface / FPendingCleanupObjects processing into the FFrameEndSync code path, plus made FFrameEndSync a static singleton. This allows us to manage the N frames of overlap between the GT and RHIT in a central place, and correctly cleanup deferred resources when the RT fences have passed.

In future, we will need to revisit this as part of the frame pacing initiative. Game thread code should be written to not require render thread fences for correctness / threadsafety.

#jira UE-223692
#rb zach.bethel

[CL 36758377 by luke thatcher in 5.5 branch]
2024-10-01 19:38:37 -04:00
luke thatcher
90b16f563a Fix frame sync issues
- The engine still uses legacy syncing behaviour where the game thread syncs with the render thread. Renderer refactors have removed most of the RHI thread flushes that happened per frame, which were the only thing synchronizing the game/render threads with the RHI thread. Without these flushes, and when occlusion queries are disabled, the game thread can run ahead of the RHI thread by several hundred frames, since it is now entirely unsynchronized.
 - This fix changes mode 0 of "r.GTSyncType" to sync with the N-2 RHI thread frame when the RHI thread is active, rather than the N-1 render thread frame. The game thread is now always synchronized with the RHI thread to prevent it running ahead.
 - Mode 1 of "r.GTSyncType" now works even when vsync is disabled, and syncs the game thread with the N-1 RHI thread frame (same behaviour as before).

#jira UE-223692
#rb dave.barrett

[CL 36746684 by luke thatcher in 5.5 branch]
2024-10-01 17:37:57 -04:00
ionut matasaru
462bbee35d Fixed dependency of Launch module to deprecated ProfilerClient and ProfilerService modules (toggled by UE_DEPRECATED_PROFILER_ENABLED).
#rb Catalin.Dragoiu

[CL 36386986 by ionut matasaru in 5.5 branch]
2024-09-18 08:32:59 -04:00
calvin zheng
c4ba0a112b Fix secure coding runtime warning
#rb zack.neyland
#jira Issue-584037
#rnx

[CL 36306637 by calvin zheng in 5.5 branch]
2024-09-16 12:36:21 -04:00
Ryan Hummer
4af2fd066d Updating Dev-Release-5.5 from Main at CL #36144969
#okforversepublic

[CL 36146571 by Ryan Hummer in Dev-5.5 branch]
2024-09-10 10:26:02 -04:00
zach brockway
1e7eb6e4d1 Plugin Manager: Prioritize editor target receipts whose Launch executable matches the currently running executable.
Previously, the first (arbitrary) editor target receipt with a matching configuration was chosen.

This is necessary to disambiguate a second receipt for an editor target in the engine binaries directory, and matches existing logic used to determine the correct receipt in FEngineLoop::AppInit.

#jira UE-196216
#rb jeremie.roy, will.brown

[CL 36017174 by zach brockway in ue5-main branch]
2024-09-04 13:55:33 -04:00
luke thatcher
7ec6ef81f5 New GPU profiler improvements. The TStatId on FRHIBreadcrumb has been replaced with a FRHIBreadcrumbData struct that holds additional profiling related data, which includes:
- The TStatId for "stat gpu" stats.
 - The FName required by the CSV profiler for GPU stats.
 - The source file and line number to allow breadcrumbs shown in Insights to link back to their original source location.

Additional changes:
 - Added temporary support for the Insights GPU track. This is guarded by RHI_TEMP_USE_GPU_TRACE until we have a newer, more capable API.
 - Simplified FMeshDrawEvent into a standard RHI breadcrumb in FMeshDrawCommand::SubmitDraw().
 - Moved "r.GPUCsvStatsEnabled" cvar into GPUProfiler.cpp, so it is accessible to both old and new profilers.

#jira UE-177299
#rb mihnea.balta

[CL 35973862 by luke thatcher in ue5-main branch]
2024-09-03 14:10:13 -04:00
luke thatcher
40a158ad93 Prepare RHI breadcrumbs and GPU event stream for "stat gpu" support
- Added a TStatId field on breadcrumbs. When set, this indicates the breadcrumb should write its computed GPU duration to the given stat.
 - Implemented "stat gpu" alongside the "stat unit" GPU event stream sink. Times in "stat gpu" are now taken as the union of busy time across all GPU queues, in the same way we compute the "stat unit" GPU time.
 - RDG support is handled via the new RHI_EVENT_SCOPE_STAT macro, allowing us to tag RDG scopes with GPU stats. When the new GPU profiler is enabled, RDG_GPU_STAT_SCOPE and SCOPED_GPU_STAT are empty and will eventually be deprecated and removed.

Cleanup of breadcrumb macros
 - Remove unnecessary "Name" arguments.
 - Require the user to wrap the format string in quotes, rather than stringizing the format arg with the preprocessor.
 - Removed "F" version of macros. Both string literal and formatted strings can be handled with the varargs macro, since the varargs are simply empty when using only a string literal.

Added GetTypeHash function for TStatId
 - This didn't exist before, and allows use of TStatId in TMaps etc.

#jira UE-177299
#rb zach.bethel

[CL 35953056 by luke thatcher in ue5-main branch]
2024-09-02 06:24:43 -04:00
daniele vettorel
1245890ed3 Add vendor-aware PSO precaching and the ability to keep PSOs in memory.
This change:

* Introduces the concept of "vendor-aware" precaching with the ability to have the precaching system only precache PSOs that are considered "different" by the graphics driver. Every GPU vendor has a different subset of PSO state that can cause a driver cache hit or miss. This change implements this mechanism for NVIDIA and Intel Arc where testing was performed and assumptions verified. While avoiding the compilation of similar PSOs might seem unimportant (since by definition similar PSOs will cause a cache hit and will be fast), there is significant scheduling overhead and contention that can be avoided. According to my tests, this reduces the number of precached PSOs on NVIDIA by ~40% and on Intel by ~25%.

* Adds the ability to keep the precached PSOs in memory instead of deleting them immediately after creation. This can significantly help PSO re-creation performance on NVIDIA, and avoids otherwise-unavoidable small hitches on the critical path when the PSO is used for rendering. Precached PSOs are deleted once they are actually used for rendering, and CVars are provided to control how many are kept in memory at a time (to take into account all the precached PSOs that don't end up being used and avoid unbounded memory usage). According to my tests on a replay, this reduces the number of >4ms PSO creation hitches from over a thousand to less than 50.

* Moves initialization of the precaching structures to be explicitly controlled instead of relying on static initialization since that's too early for CVars to be set.

#rb elizabeth.bunner, Kenzo.Terelst, mihnea.balta

[CL 35904165 by daniele vettorel in ue5-main branch]
2024-08-29 15:27:53 -04:00
dmytro ivanov
6dbca26029 Implement FPlatformMisc::SetStoredValue, GetStoredValue and others on Android
#jira UE-222628
#rb denys.mentiei

[CL 35822749 by dmytro ivanov in ue5-main branch]
2024-08-27 08:38:49 -04:00
zach bethel
3a4144a0d1 Removed legacy manual sync of oustanding command lists to delay scene render completion. Scene render clean up is handled as a separate task graph that absorbs those command lists. This was previously not doing anything but now blocks async RDG execution tasks from running.
[CL 35743928 by zach bethel in ue5-main branch]
2024-08-22 12:08:22 -04:00
carl lloyd
45eff08780 Fix for rendering occuring when moving from the background to the foreground before the application is ready.
#rb Zack.Neyland, Peter.Sauerbrei

[CL 35616553 by carl lloyd in ue5-main branch]
2024-08-17 19:09:27 -04:00
zousar shaker
3d20fe9de5 Reorganize StorageServerClient module into the base module and a sibling module for debug functionality. Also expose an API for creation of storage server platform file usage outside of the default platform hierarchy.
#rb daniele.pieroni

[CL 35341386 by zousar shaker in ue5-main branch]
2024-08-06 11:00:25 -04:00
luke thatcher
5e8aaf2a97 Remove RHIBeginFrame
- We now only have RHIEndFrame to mark the boundary between engine frames for the purpose of stat gathering and RHI cleanup tasks. The next frame begins immediately after the EndFrame command.
 - RHIEndFrame is called on the RHI thread after all prior command list submissions. Platform RHIs that need to enqueue RHICmdList work can override RHIEndFrame_RenderThread to add this work either side of the actual EndFrame command.
 - The work that platform RHIs performed in RHIBeginFrame has been merged into their implementations of RHIEndFrame.

#rb mihnea.balta
#jira UE-177299

[CL 35106431 by luke thatcher in ue5-main branch]
2024-07-26 08:22:50 -04:00
bryan johnson
e7bdda6b95 [Backout] - CL35087217
[FYI] Bryan.Johnson
Original CL Desc
-----------------------------------------------------------------
[Backout] - CL35079176
[FYI] Mieszko.Zielinski
Original CL Desc
-----------------------------------------------------------------
Moved the rest of MassEntity modules over to the Engine's Source/ code.

#jira UE-216267

[CL 35087666 by bryan johnson in ue5-main branch]
2024-07-25 13:36:25 -04:00
bryan johnson
8571531689 [Backout] - CL35079176
[FYI] Mieszko.Zielinski
Original CL Desc
-----------------------------------------------------------------
Moved the rest of MassEntity modules over to the Engine's Source/ code.

#jira UE-216267

[CL 35087231 by bryan johnson in ue5-main branch]
2024-07-25 13:18:29 -04:00
mieszko zielinski
ec5752f92c Moved the rest of MassEntity modules over to the Engine's Source/ code.
#jira UE-216267

[CL 35079184 by mieszko zielinski in ue5-main branch]
2024-07-25 08:14:32 -04:00
phillip kavan
966496d51e Fix potentially longer startup times in certain non-monolithic platform builds due to plugin discovery phase occurring prior to task graph system initialization.
#rnx
#rb eric.knapik

[CL 35052125 by phillip kavan in ue5-main branch]
2024-07-24 09:11:11 -04:00
yschanghtc
cf1dfddefd Fix issue with HMD initialization on Android
#jira UE-218912
#12055
#android
[REVIEW] [at]Allan.Bentham
#rb Allan.Bentham, Jack.Porter

[CL 34943294 by yschanghtc in ue5-main branch]
2024-07-19 16:23:46 -04:00
dmytro ivanov
75031badfc Add debug UI to FN preload screen on iOS, enable it by tapping 4 fingers on the screen
#rb denys.mentiei

[CL 34678289 by dmytro ivanov in ue5-main branch]
2024-06-26 11:53:49 -04:00
russell johnston
28f8c59883 Acquire Verse heap access for the game thread at the same time Verse is initialized
The game thread context uses manual stack scanning mode, and FrankenGC sets the stack as empty during marking.

This enables module startup to use the Verse heap (previously the context was created too late), and ensures that there is always a Verse context available while FrankenGC is enabled.

#rb Tim.Smith

[CL 34469229 by russell johnston in ue5-main branch]
2024-06-18 13:30:54 -04:00
yevgen abramov
a059db3e0d Remove ASIS outdated functionality
#jira UE-218151
#rb Chris.Babcock
#rnx

[CL 34448883 by yevgen abramov in ue5-main branch]
2024-06-17 21:00:57 -04:00
ben woodhouse
5280549418 Add CSV_PROFILER_MINIMAL define for removing almost all instrumentation overhead. Only a handful of essential stats are captured; the rest are stripped out at compile time. In this mode, the only function which emits stats to the CSV is RecordCustomStatMinimal (with corresponding macros CSV_CUSTOM_STAT_MINIMAL and CSV_CUSTOM_STAT_MINIMAL_GLOBAL).
#rb mickael.gilabert
#tests Tested locally with and without the new cvar

[CL 34374708 by ben woodhouse in ue5-main branch]
2024-06-14 12:30:08 -04:00
christopher waters
ef448e9d0a Updating to Agility SDK 1.614.0
#rb Kenzo.Terelst, mihnea.balta

[CL 34284423 by christopher waters in ue5-main branch]
2024-06-11 14:27:44 -04:00