Commit Graph

23 Commits

Author SHA1 Message Date
zach bethel
b5b17e2ae7 Render Command Pipe Implementation and API
Render Command Pipes dedicated asynchronous task pipes for render commands. Users can easily define new pipes and enqueue commands into them. Pipes can be synchronized using a scope to run serial render commands on the render thread, but initially pipes cannot be synchronized individually with each other. Render command overhead is reduced by recording command lambdas into MPSC queues which are serviced by the task graph; both for pipes and for the render thread. This reduces the task overhead as commands are no longer 1-to-1 with tasks.

Pipe behavior is controlled with new CVars. `r.RenderCommandPipeMode` controls overall behavior:
 0 - Legacy render thread tasks,
 1 - Render thread MPSC queue,
 2 - Render thread and async pipe MPSC queues.

To define a Render Command Pipe, use DEFINE_RENDER_COMMAND_PIPE(MyPipe), or DECLARE_RENDER_COMMAND_PIPE(MyPipe, MODULE_API) to declare an extern reference.

Enqueue a command into the pipe like so:

ENQUEUE_RENDER_COMMAND(MyCommand)(UE::RenderCommandPipe::MyPipe, [] (FRHICommandList&) {}).

Omitting a pipe will fallback to the 'general' pipe which is the render thread.

Eventually pipes need to be synced back to the general pipe for scene renders and other GPU work. On the game thread timeline, use UE::RenderCommandPipe::FSyncScope to synchronize the pipes. This waits for pipes and disables recording of new pipe commands until the scope completes, at which point pipe recording is restarted. This creates a 'sync point', so render commands issued prior to a sync scope will be waited on at the start of the scope, and render commands issued after the scope ends will not be able to start until the render thread finishes processing prior commands.

#rb christopher.waters, luke.thatcher

[CL 27074956 by zach bethel in ue5-main branch]
2023-08-14 12:52:45 -04:00
bob tellez
afd943db61 [Backout] - CL27042396 and 27048615
[FYI] zach.bethel
Original CL Desc
-----------------------------------------------------------------
Render Command Pipe Implementation and API

Render Command Pipes dedicated asynchronous task pipes for render commands. Users can easily define new pipes and enqueue commands into them. Pipes can be synchronized using a scope to run serial render commands on the render thread, but initially pipes cannot be synchronized individually with each other. Render command overhead is reduced by recording command lambdas into MPSC queues which are serviced by the task graph; both for pipes and for the render thread. This reduces the task overhead as commands are no longer 1-to-1 with tasks.

Pipe behavior is controlled with new CVars. `r.RenderCommandPipeMode` controls overall behavior:
 0 - Legacy render thread tasks,
 1 - Render thread MPSC queue,
 2 - Render thread and async pipe MPSC queues.

To define a Render Command Pipe, use DEFINE_RENDER_COMMAND_PIPE(MyPipe), or DECLARE_RENDER_COMMAND_PIPE(MyPipe, MODULE_API) to declare an extern reference.

Enqueue a command into the pipe like so:

ENQUEUE_RENDER_COMMAND(MyCommand)(UE::RenderCommandPipe::MyPipe, [] (FRHICommandList&) {}).

Omitting a pipe will fallback to the 'general' pipe which is the render thread.

Eventually pipes need to be synced back to the general pipe for scene renders and other GPU work. On the game thread timeline, use UE::RenderCommandPipe::FSyncScope to synchronize the pipes. This waits for pipes and disables recording of new pipe commands until the scope completes, at which point pipe recording is restarted. This creates a 'sync point', so render commands issued prior to a sync scope will be waited on at the start of the scope, and render commands issued after the scope ends will not be able to start until the render thread finishes processing prior commands.

#rb christopher.waters, luke.thatcher

[CL 27054009 by bob tellez in ue5-main branch]
2023-08-11 20:05:11 -04:00
zach bethel
2d143afc83 Render Command Pipe Implementation and API
Render Command Pipes dedicated asynchronous task pipes for render commands. Users can easily define new pipes and enqueue commands into them. Pipes can be synchronized using a scope to run serial render commands on the render thread, but initially pipes cannot be synchronized individually with each other. Render command overhead is reduced by recording command lambdas into MPSC queues which are serviced by the task graph; both for pipes and for the render thread. This reduces the task overhead as commands are no longer 1-to-1 with tasks.

Pipe behavior is controlled with new CVars. `r.RenderCommandPipeMode` controls overall behavior:
 0 - Legacy render thread tasks,
 1 - Render thread MPSC queue,
 2 - Render thread and async pipe MPSC queues.

To define a Render Command Pipe, use DEFINE_RENDER_COMMAND_PIPE(MyPipe), or DECLARE_RENDER_COMMAND_PIPE(MyPipe, MODULE_API) to declare an extern reference.

Enqueue a command into the pipe like so:

ENQUEUE_RENDER_COMMAND(MyCommand)(UE::RenderCommandPipe::MyPipe, [] (FRHICommandList&) {}).

Omitting a pipe will fallback to the 'general' pipe which is the render thread.

Eventually pipes need to be synced back to the general pipe for scene renders and other GPU work. On the game thread timeline, use UE::RenderCommandPipe::FSyncScope to synchronize the pipes. This waits for pipes and disables recording of new pipe commands until the scope completes, at which point pipe recording is restarted. This creates a 'sync point', so render commands issued prior to a sync scope will be waited on at the start of the scope, and render commands issued after the scope ends will not be able to start until the render thread finishes processing prior commands.

#rb christopher.waters, luke.thatcher

[CL 27042459 by zach bethel in ue5-main branch]
2023-08-11 15:51:26 -04:00
zach bethel
a7a9029b20 Deprecated InitRHI() in favor of InitRHI(FRHICommandListBase&).
#rb mihnea.balta, luke.thatcher, christopher.waters

[CL 26097009 by zach bethel in ue5-main branch]
2023-06-19 13:56:56 -04:00
dmitriy dyomin
ea9a5ee31f Added a separate entry in a RuntimeVirtualTexture component for a streaming VT that is specific to mobile rendering
Depending on target platform shading path one or the other SVT will be used
This is required for projects that has a significantly different landscape materials for each shading path
#rb jeremy.moore

[CL 24376462 by dmitriy dyomin in ue5-main branch]
2023-02-23 01:23:57 -05:00
dmitriy dyomin
80324d62ab [Backout] - CL24335980
[FYI] Dmitriy.Dyomin
Original CL Desc
-----------------------------------------------------------------
Added a separate entry in a RuntimeVirtualTexture component for a streaming VT that is specific to mobile rendering
Depending on target platform shading path one or the other SVT will be used
This is required for projects that has a significantly different landscape materials for each shading path
#rb jeremy.moore

[CL 24343407 by dmitriy dyomin in ue5-main branch]
2023-02-21 13:05:08 -05:00
dmitriy dyomin
65ad8e95e6 Added a separate entry in a RuntimeVirtualTexture component for a streaming VT that is specific to mobile rendering
Depending on target platform shading path one or the other SVT will be used
This is required for projects that has a significantly different landscape materials for each shading path
#rb jeremy.moore

[CL 24336769 by dmitriy dyomin in ue5-main branch]
2023-02-21 06:00:13 -05:00
Luke Thatcher
75cee9fd43 Marked several functions on the immediate RHICmdList that do not use "this" as deprecated.
- Replaced uses of these functions in the engine with the global scope equivalents.
 - Added some missing global scope RHI...() functions.
 - LLM scopes have been moved into the global scope function, where necessary.

Removed several _RenderThread() RHICmdList functions
 - These were previously provided for the automatic RHI thread stall / flush mechanism, but now provide no benefit
 - Removing these also helps prevent use of FRHICommandListExecutor::GetImmediateCommandList() on threads other than the rendering thread.

Remove RHIExecuteCommandList
 - Unused, legacy code path. No platform RHIs provide an implementation. No need to deprecate since there's no way anyone would be calling it already.

#jira none
#rb Zach.Bethel
#preflight 63c86e2dfb1a8cf245f44469

[CL 23771476 by Luke Thatcher in ue5-main branch]
2023-01-19 06:13:08 -05:00
jeremy moore
e71f3cec33 Fix crash when building RVT streaming mips.
Fence needs to be explicitly cleared after recent RHI parallel rendering updates.

[CL 22546737 by jeremy moore in ue5-main branch]
2022-10-14 22:20:40 -04:00
Jeremy Moore
a72dcd01bf #jira UE-158632
Remove some non-inclusive language.
Deprecates AddViewSlaveLocation() for AddViewLocation() and AddTextureStreamingSlaveLoc() for AddTextureStreamingLoc().
#preflight 62cc8e5e1a786c1bbcf6e6aa

[CL 21056879 by Jeremy Moore in ue5-main branch]
2022-07-12 11:18:47 -04:00
zach bethel
34623f0321 Replaced thread-local MemStack with ConcurrentLinearAllocator across the renderer.
- Removed scene render mem-mark among others. MemStack usage is now restricted to local scopes with known marks.
 - Render resources with destructors are allocated using the FSceneRenderingBulkObjectAllocator on FSceneRenderer, which is deleted when the scene render is.

#preflight 62b266e20d4d6228de97babe
#rb mihnea.balta, yuriy.odonnell

[CL 20907647 by zach bethel in ue5-main branch]
2022-06-30 19:55:24 -04:00
charles bloom
ada7f6b1d8 Texture GetBuildRequiredEstimate better estimate of texture build memory needed
create new TextureBuildUtilities module that can be used from Engine or TextureBuildWorker
new cvar memory.WindowsPlatformMemoryGetStatsLimitTotalVirtualGB simulates a lower memory system

#rb fabian.giesen
#preflight 62b34bf8650c9d5857a38514

[CL 20786800 by charles bloom in ue5-main branch]
2022-06-22 20:21:16 -04:00
christopher waters
4b9e68073c Deprecating RHICreateTexture2D and RHICreateTextureExternal2D.
#jira none
#rb zach.bethel
#preflight 627a6ec010766ef8c1f54f1e

[CL 20129702 by christopher waters in ue5-main branch]
2022-05-10 17:13:37 -04:00
charles bloom
81695dcab8 deprecate crunch and zlib compression support on VT tiles
remove crunch use from engine

#rb fabian.giesen
#preflight 621bb341106e3d8da269ff37

[CL 19185785 by charles bloom in ue5-main branch]
2022-02-28 17:59:11 -05:00
yangke li
1731093fe0 Add a Mobile friendly RVT MaterialType BaseColor_Normal_Roughness with basecolor in RT0, NormalXY and roughness in RT1, NormalZ is considered always a positive number( which is the situation for local space normal)
Add A  flag bUseLowQualityCompression to BaseColor_Normal_Roughness, which fakes compression by 16bit format(RGB565)

#rb Dmitriy.Dyomin

[CL 16977982 by yangke li in ue5-main branch]
2021-07-27 22:06:06 -04:00
Emil Persson
4516b985df Name all resources and make naming mandatory
#rb yuriy.odonnel, kenzo.terelst

[CL 15416919 by Emil Persson in ue5-main branch]
2021-02-16 08:37:39 -04:00
Jeremy Moore
11b6560ac9 Use RenderPagesStandAlone() when building RVT and VHM MinMax textures.
Plays correctly with GPUScene and stops ensure() firing.
#rb none

[CL 15100429 by Jeremy Moore in ue5-main branch]
2021-01-14 20:15:23 -04:00
Jeremy Moore
ebba8166a1 Fix regression after PVS fix.
Fixes bad data produced by building streaming virtual texture.
#rb none
#fyi tim.smith

[CL 15099488 by Jeremy Moore in ue5-main branch]
2021-01-14 19:42:15 -04:00
Tim Smith
19dbfb1f07 Fixing PVS 7.7 Issues:
warning V1028: Possible overflow. Consider casting operands, not the result.

#rb trivial
#jira UE-91644

[CL 15068181 by Tim Smith in ue5-main branch]
2021-01-13 12:38:04 -04:00
zach bethel
2bc88676d6 Converted virtual texture system and GPU lightmass to RDG.
#rb yujiang.wang, jeremy.moore
#jira none

[CL 14581416 by zach bethel in ue5-main branch]
2020-10-26 16:44:44 -04:00
Marcus Wassmer
3b81cf8201 Merging using //UE5/Main_to_//UE5/Release-Engine-Staging @14384769
autoresolved files
#rb none

[CL 14384911 by Marcus Wassmer in ue5-main branch]
2020-09-24 00:43:27 -04:00
Marc Audy
7379fa99c5 Merging //UE5/Release-Engine-Staging to Main (//UE5/Main) @ 14229157
[CL 14233282 by Marc Audy in ue5-main branch]
2020-09-01 14:07:48 -04:00
Marc Audy
a7c9001a94 Merging //UE5/Release-Engine-Staging to Main (//UE5/Main) @ 14075166
#rb
#rnx

[CL 14075271 by Marc Audy in ue5-main branch]
2020-08-11 01:36:57 -04:00