Commit Graph

2208 Commits

Author SHA1 Message Date
marc audy
bc7ec15d7a Fix module dependency of FDispatchShaderBundleCS and FDispatchShaderBundle utility by moving it from Renderer into RenderCore (suitable to be called from RHI modules in modular builds).
#jira
[FYI] luke.thatcher, mihnea.balta, brian.karis, rune.stubbe

[CL 26831567 by marc audy in ue5-main branch]
2023-08-03 18:35:39 -04:00
dan elksnitis
9a5a1b6f74 [shaders] minor include cleanup
#rb Jason.Hoerner
#rb Laura.Hermanns

[CL 26817718 by dan elksnitis in ue5-main branch]
2023-08-03 13:40:32 -04:00
dan elksnitis
bad966a2f6 [shaders] add entry point name to input hash when preprocessed job cache is enabled. needed for shaders that are identical aside from entry point name (as in certain global shaders) as minifier does not remove unused entry points.
#rb Jason.Nadro

[CL 26817322 by dan elksnitis in ue5-main branch]
2023-08-03 13:30:43 -04:00
dave belanger
147b9a0171 - Add ShaderCodeLibrary api to ignore some plugins on mount (so that they can be loaded in parallel for several plugins)
- Add an optional param to OpenLibrary to not look for shader lib chunks (because there's strong thread contention surrounding FMountedPakFileInfo::KnownPakFilesAccessLock)
- Removed reading of shared-cooked override since that feature is obsolete
#rb Arciel.Rekman
#rnx

[CL 26815876 by dave belanger in ue5-main branch]
2023-08-03 12:46:28 -04:00
carl lloyd
b716bf7daa Temporarily disabled warning for RealtimeGPUProfiler query been unavailable
#rb Mihnea.Balta
#jira UE-186064

[CL 26774000 by carl lloyd in ue5-main branch]
2023-08-02 11:17:30 -04:00
mihnea balta
79ba042011 Fix out of memory crashes when using DumpGPU.
The views made by DumpGPU must be created with lifetime extension disabled, so they release the underlying resources immediately after each dump pass.

#rnx
#jira UE-157708
#rb Guillaume.Abadie, Zach.Bethel

[CL 26769211 by mihnea balta in ue5-main branch]
2023-08-02 09:06:32 -04:00
jason hoerner
d0fa80e418 Shader Compiler: FShaderJobCache::SubmitJobs now runs in multiple tasks, with fixes necessary for thread safety and minimizing lock contention applied. In a Lyra cook, the time in SubmitJobs on the main thread is now around a fifth of the time spent in GlobalBeginCompileShader, and is thus no longer the main bottleneck on the game thread. Lock contention is only 0.04% of the time in the SubmitJobs tasks, so further lock contention reduction wouldn't help performance.
* FShaderJobCache::ProcessFinishedJob needs to lock CompileQueueSection from FShaderCompilingManager to work from any thread.  Originally, CompileQueueSection was locked higher up in the call stack in FShaderCompilingManager::SubmitJobs.  CompileQueueSection is propagated to the FShaderJobCache constructor to make it available.
* Locking CompileQueueSection there creates deadlock issues if you also lock JobLock from FShaderJobCache, because certain code paths take the locks in the opposite order.  To solve this, we must not take both locks at the same time.  The two places ProcessFinishedJob are called from job cache logic are both moved outside of JobLock scopes.
* To reduce lock contention, the hash table of active jobs no longer uses JobLock.  Game thread related tasks allocate jobs via PrepareJob, adding to the job hash table.  An array of allocated jobs is then passed to SubmitJobs, which doesn't itself access the job hash table at all, so sharing the same lock creates a needless dependency.  Striping by the high bits of the hash key is used to further reduce contention in cases where multiple threads are generating jobs (not sure if that happens now, but maybe it will in the future).
* A wait free linked list algorithm is used to insert items to the queue of pending jobs that haven't been assigned to a worker.  Atomic linked list operations are supported for both head and tail insertion (the latter required for the default FIFO job execution mode).  Tail insertion requires maintaining a tail pointer, and thus can't use the original Core singly linked list class, and the doubly linked list class in Core fundamentally can't support atomic operations, so a version of the singly linked list implementation is copied locally to the ShaderCompiler.cpp, and adapted to our purposes.
* Wait free queue insertion is safe across multiple producer threads, which means we only need an FReadScopeLock for insertion.  Write locks are required for other list operations, but queue insertion is the massively parallel operation we are most concerned about.  Queue removal happens in a much smaller number of manager threads that call GetPendingJobs.
* Because a tail pointer is always maintained for the FIFO, insertion doesn't need to traverse the linked list to find the tail, which is potentially O(N^2), reducing the time a lock is held.
* SerializeOutput no longer occurs inside JobLock scopes for processing existing output and duplicate jobs, again reducing the time a lock is held.

#jira UE-187335 UE-190642
#rnx
#rb jason.nadro dan.elksnitis arciel.rekman

[CL 26760695 by jason hoerner in ue5-main branch]
2023-08-01 19:13:35 -04:00
dan elksnitis
78b1767069 [shaders] implement independent preprocessing API for vulkan shader format
#rb Massimo.Tristano

[CL 26739541 by dan elksnitis in ue5-main branch]
2023-08-01 11:03:24 -04:00
jian ru
3fc817fb6d Add a separate upload limit r.VT.MaxUploadsPerFrame.Streaming for streaming VT pages. When the cvar is not zero, it enables the separate limit and r.VT.MaxUploadsPerFrame will only constrain non-streaming VT pages. When the cvar is zero (currently default), it disables the separate limit for backward compatibility. The motivation to separate SVT pages from other types of VT pages is mainly three-fold: 1) limiting SVT page uploads also throttles the number of loading requests. On platforms where I/O is slow, we may want to let more SVT page requests to go through so that I/O can be initiated earlier to reduce delay in obtaining page data; 2) SVT pages are usually cheaper to produce than RVT pages because they just upload the loaded data to GPU; 3) long standing SVT page requests can block the requests for other types of pages even if the other pages can be requested in parallel and turned around faster.
#rb jeremy.moore
#tests a/b tested perf and visual on two console platforms

[CL 26728158 by jian ru in ue5-main branch]
2023-07-31 20:47:42 -04:00
zach bethel
61311f64b7 Fixed validation error in transient allocator due to transient allocator being destroyed prior to the CustomDepth texture being destroyed.
#jira UE-169984

[CL 26692458 by zach bethel in ue5-main branch]
2023-07-28 19:31:39 -04:00
charles derousiers
2365ee5308 Change D3D diagnostic buffer to output readable assert message (file/line/condition/message).
Use with check() / checkf()

#rb dan.elksnitis, christopher.waters
[FYI] yuriy.odonnell

[CL 26680005 by charles derousiers in ue5-main branch]
2023-07-28 13:55:18 -04:00
zach bethel
a2c7d0ff1b Refactored OnTransformChanged to take an RHI command list so that it can be moved off the render thread.
[CL 26674727 by zach bethel in ue5-main branch]
2023-07-28 11:29:43 -04:00
dan elksnitis
64a5c76444 [shaders] move custom vulkan bindless parameter parser behaviour into baseclass (parameter parser being part of the serialized preprocess output means subclassing is problematic)
#rb JeanNoe.Morissette

[CL 26674182 by dan elksnitis in ue5-main branch]
2023-07-28 11:11:42 -04:00
bryan sefcik
64f140d78d Added shader.build.cs file.
Updated build.cs files to use new shader module.

#jira
#rb Joe.Kirchoff and guillaume.abadie

[CL 26664107 by bryan sefcik in ue5-main branch]
2023-07-27 22:53:25 -04:00
ross goldblum
f222fa5a1d Add GNearClippingPlane_RenderThread to be accessed on only on the RenderThread and use GNearClippingPlane otherwise. This avoids the need for the FlushRenderingCommands call which was causing a ~50ms hitch on Switch.
[REVIEW] [at]alex.nischwitz [at]ben.woodhouse [at]matt.hoffman [at]zach.bethel

[CL 26652729 by ross goldblum in ue5-main branch]
2023-07-27 16:06:11 -04:00
tom holmes
c03020e505 Better fix for UE-190842 generate new shaderversion guid and restore previous DDC logic
#rb dan.elksnitis
#jira UE-190842
#tests ran editor, cook lyra

[CL 26630815 by tom holmes in ue5-main branch]
2023-07-26 21:22:58 -04:00
michael balzer
fd6ff6a106 RenderCore: Fix AddDrawTexturePass() for specific mip level in different format
#rb zach.bethel

[CL 26618725 by michael balzer in ue5-main branch]
2023-07-26 15:54:42 -04:00
dmitriy dyomin
6a350234e4 Fixed assert related to mobile GPUScene on SM5 static shader platforms
[CL 26601823 by dmitriy dyomin in ue5-main branch]
2023-07-26 05:55:48 -04:00
christopher waters
111e1d5046 Fixing various issues with shader previews
- PC previews of SM6 platforms weren't going to DXC correctly.
- Preview platform include paths weren't initialized when compiling with local-only shader compiles.
- A few preview platform DDSPI settings weren't being initialized correctly based on the capabilites of the preview format.

#rb arciel.rekman, dan.elksnitis

[CL 26589147 by christopher waters in ue5-main branch]
2023-07-25 17:16:48 -04:00
jason hoerner
2aae012935 Shader Compiler static analysis warning: need to move include of Runtime/RenderCore/Internal/ShaderCompilerDefinitions.h to top of ShaderCore.h to avoid "Include after first code block" warning. To make this move, a structure required by that header (FShaderCompilerDefinitions) needed to be moved to a different header as well.
#jira UE-191105
#rnx
#rb trivial

[CL 26585005 by jason hoerner in ue5-main branch]
2023-07-25 15:23:02 -04:00
elizabeth baumel
1349184c6d Fix header guard warning.
#jira UE-191104
#rb trivial

[CL 26584006 by elizabeth baumel in ue5-main branch]
2023-07-25 14:52:55 -04:00
keaton stewart
345c4af69d [Backout] - CL26579205 Compile errors in GPUDebugCrashUtils.h
[FYI] elizabeth.baumel
Original CL Desc
-----------------------------------------------------------------
Only include GPU crash utils when it's enabled, fix warning about missing header guard

#jira UE-191104
#rb trivial

[CL 26581778 by keaton stewart in ue5-main branch]
2023-07-25 14:06:08 -04:00
jon cain
27d55af4ed Backout of CL 25764433 to temporarily resolve render resource crash under certain circumstances when pushing changes in UEFN.
#rb Jason.Nadro, Andriy.Tylychko, Sebastian.Thomeczek

[CL 26580177 by jon cain in ue5-main branch]
2023-07-25 13:30:09 -04:00
elizabeth baumel
ebb89f12f4 Only include GPU crash utils when it's enabled, fix warning about missing header guard
#jira UE-191104
#rb trivial

[CL 26579264 by elizabeth baumel in ue5-main branch]
2023-07-25 13:03:22 -04:00
jason hoerner
a843f96b96 Shader Compiler: Fix for circular include issue temporarily introduced as a step towards deprecation of public access to FShaderCompilerDefinitions structure.
#jira UE-190944
#rnx
#rb trivial

[CL 26560769 by jason hoerner in ue5-main branch]
2023-07-24 21:04:14 -04:00