Commit Graph

98 Commits

Author SHA1 Message Date
aleksander netzel
5fb13876bb Add proper support for streamed geometries (geometries initialized as StreamingDestination) when dynamic ray tracing is enabled:
* Add FRayTracingGeometry::EGeometryStateFlags for tracking the state instead of several bools:
 - Add new state for tracking if the geometry was streamed in - its primary use is for dynamic ray tracing.
 - When ray tracing is toggled on at runtime we only recreate geometries that were marked as streamed in.
* Streamed geometries have to be created in a different way than regular geometries:
 - Creating geometry with StreamingDestination type will not allocate any memory for BLAS buffers.
 - Those can only be initialized by InitRHIForStreaming from temporary geometry with a StreamingSource type
 - Added FRayTracingGeometry::InitRHIForDynamicRayTracing() to handle both StreamingDestination and Rendering
  - For StreamingDestination it will do similar steps as normal mesh streaming does.
* Add missing RayTracingGeometry initialization when dynamic ray tracing was enabled but ray tracing was disabled.

#rb tiago.costa, yuriy.odonnell
#preflight 6372245ebf76990b71f5d021

[CL 23116977 by aleksander netzel in ue5-main branch]
2022-11-14 08:48:54 -05:00
charles bloom
f4f3b76663 FTexture : set debug shader bGreyScaleFormat ReplicateR property from CompressionSettings, not PixelFormat, so it matches what MaterialExpressions wil do
bGreyScaleFormat is only used by debug/editor shaders, game runtime uses SamplerType from MaterialExpressions
bGreyScaleFormat bool is needed because FTexture does not have access to CompressionSettings
behavior is observably different with Grayscale G16 and cases like TC_Alpha non-multiple-of-4

#preflight 636968d6d0174259ccea87f5
#rb dan.thompson

[CL 23023252 by charles bloom in ue5-main branch]
2022-11-07 21:47:57 -05:00
aleksander netzel
c07eb3fff0 Initial support for switching ray tracing on/off at runtime:
* Split IsRayTracingEnabled() into 2 parts: IsRayTracingEnabled() which can be changed at runtime and IsRayTracingAllowed() for checking if ray tracing can be enabled.
* r.Raytracing can now have following values: 0 - disabled, 1 - enabled all the time, 2 - enabled dynamic
* When ray tracing is dynamic, RayTracingGeometryManager will collect all FRayTracingGeometry and allocate/release RHI objects as needed depending on if ray tracing is enabled or not.
* Ray tracing can be switched on/off with r.Raytracing.Enable (default is 1).
* Add support to most features used in CitySample/Lyra for switching ray tracing at runtime.
* TODO: Hair geometries are not yet released.

#rb yuriy.odonnell
#preflight 634feac68176062ea7da933f

[CL 22622885 by aleksander netzel in ue5-main branch]
2022-10-19 09:00:41 -04:00
yuriy odonnell
a7230698dd Fix spelling Plaform -> Platform
#rb Mihnea.Balta
#preflight 6335d35af76de2d4d561dbec

[CL 22263180 by yuriy odonnell in ue5-main branch]
2022-09-30 00:47:45 -04:00
florin pascu
2ff00a89a2 Fix RT for other platforms besides PC
#rb Aleksander.Netzel
#jira none
#preflight 6321be4c29254beccbc5c4bd

[CL 22008205 by florin pascu in ue5-main branch]
2022-09-14 11:35:13 -04:00
florin pascu
0bc3e61f01 - Add IsRayTracingEnabled(ShaderPlatform) overload that returns true when Project has RT on and ShaderPlatform supports RT and has it on for the project
- Don't create FRayTracingMeshProcessor when IsRayTracingEnabled is false
- Only Add RayTracingGeometries when IsRayTracingEnabled returns true
They are added to the FRayTracingMeshProcessor and will try to compile SF_RayHitGroup shaders
#rb Dmitriy.Dyomin, Carl.Lloyd
#jira UE-160278
#preflight 63208193e93a80888c3ea4d9

[CL 21988506 by florin pascu in ue5-main branch]
2022-09-13 14:22:19 -04:00
Florin Pascu
6b3c1469ba Preview Shader Platform using different ShaderMaps and the DDPI/Cvar values of the Previewable Actual Platform
NumPlatforms limit changed from 64 to 65536, limited by NumBits
#jira UE-120561
#rb Chris.Waters, Jack.Porter, Mihnea.Balta
#preflight 630f1604f92416fb92b373ab

[CL 21718179 by Florin Pascu in ue5-main branch]
2022-08-31 04:38:34 -04:00
arne schober
11bcaa521d Add extra debug info for FRenderResource lifetime.
#ROBOMERGE-AUTHOR: arne.schober
#ROBOMERGE-SOURCE: CL 21198085 via CL 21198090 via CL 21198094
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21198504 by arne schober in ue5-main branch]
2022-07-21 04:08:31 -04:00
Bryan sefcik
b4a6e947d8 Ran IWYU on Public headers under Engine/Source/Runtime/...
Headers are updated to contain any missing #includes needed to compile and #includes are sorted.  Nothing is removed.

#ushell-cherrypick of 21065896 by bryan.sefcik
#preflight 62d4b1a5a6141b6adfb0c892
#jira

#ROBOMERGE-OWNER: Bryan.sefcik
#ROBOMERGE-AUTHOR: bryan.sefcik
#ROBOMERGE-SOURCE: CL 21150156 via CL 21151754 via CL 21154719
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)
#ROBOMERGE-CONFLICT from-shelf

[CL 21181076 by Bryan sefcik in ue5-main branch]
2022-07-20 11:31:36 -04:00
zach bethel
8a5ad9558b Implemented support for asynchronous creation and deletion of FRenderResource.
The resource list uses a thread local free list that is coalesced later.

#preflight 62bf468c8d5e6787591b22e5
#rb yuriy.odonnell

[CL 20919518 by zach bethel in ue5-main branch]
2022-07-01 15:32:18 -04:00
zach bethel
058bdd7d2f Implemented support for parallel buffer creation and lock / unlock.
- Refactored relevant FDynamicRHI APIs to take an FRHICommandListBase reference. Platforms which require operations deferred to the RHI thread will enqueue commands into the command list.
 - Hardened platform implementations to use locks where needed.
 - Added unit tests to stress test creating and locking many buffers in parallel.

#preflight 62a2855c54169bd8aa114d29
#rb christopher.waters, jeannoe.morissette, luke.thatcher, will.damon, kenzo.terelst

[CL 20659113 by zach bethel in ue5-main branch]
2022-06-14 17:59:07 -04:00
tiago costa
30c8264346 Implemented ShouldCompileRayTracingCallableShadersForProject(ShaderPlatform)
- added bSupportsRayTracingCallableShaders to DDPI.
- only Windows D3D12 RHI supports callable shaders at the moment.

#rb yuriy.odonnell
#preflight 628bb493693c5e1de282983f

[CL 20331097 by tiago costa in ue5-main branch]
2022-05-23 12:52:55 -04:00
zach bethel
a574adf6d5 Deprecated RHICreateTargetableShaderResource utility method, since it's not actually used to create multisampled resources. Removed instances where it appeared multiple textures were being created, but only one was actually created. Cleaned up FTextureRenderTargetResource derived classes to use TextureRHI and TextureRenderTargetRHI.
#preflight 62798ef94561731dbe14105b
#rb christopher.waters

[CL 20113900 by zach bethel in ue5-main branch]
2022-05-09 19:27:51 -04:00
Steve Robb
cc12aaac04 Math macro prefix fixes for CoreUObject and Engine.
#rb none
#jira UE-140139
#preflight 624af57b637925b5d3fb9fef

[CL 19609424 by Steve Robb in ue5-main branch]
2022-04-04 11:13:42 -04:00
jian ru
798eacf38e Fix a memory stomp caused by writing to a released FLastRenderTimeContainer
[REVIEW] [at]peter.sauerbrei, [at]ben.woodhouse, [at]allan.bentham
#localization none
#tests ran ReplayRun tests on multiple platforms

#ROBOMERGE-AUTHOR: jian.ru
#ROBOMERGE-SOURCE: CL 19315963 via CL 19315975 via CL 19315977 via CL 19316728 via CL 19317123 via CL 19317129
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19347780 by jian ru in ue5-main branch]
2022-03-10 21:40:52 -05:00
Josie Yang
865cd14c53 Refactor to simplify ray tracing geometry update logic for skeletal mesh.
*) All skin cache entries needing RT geometry update are processed altogether in end-of-frame update whether batch dispatching or not, simplifies the logic.
*) Transition buffers to read immediately after skin cache DoDispatch calls, simplifies the logic.
*) No longer cache the flag to indicate whether RT geometry needs rebuild, the logic is calculated directly when updating RT geometry.

#jira FORT-447473
#rb Aleksander.Netzel, Juan.Canada
#preflight 621cd5339a5676d19a327a29

[CL 19177064 by Josie Yang in ue5-main branch]
2022-02-28 13:14:10 -05:00
evgenii babinets
b2a6f3b688 Another attempt at fixing a GameThread stall (waiting for render thread) whenever a CVar is changed during gameplay.
Last attempt failed some editor tests since those tests construct buffers with bNeedsCpuAccess = false even though editors must keep all resources. Changing the condition for freeing the resource object to see if its array was freed directly.

Original description:

It seems like the intent of the callback sink for r.FreeSkeletalMeshBuffers was to free eligible CPU buffers when the CVar was raised to 1, but unfortunately we're currently relying on this sink to free certain helper structures.
This change allows those structures to be freed after submitting the buffers to RHI so that we can change the callback sink to only do work on the rising edge (which generally only happens when switching game-mode/device profile and not during gameplay).

#rb jordan.cristiano
#preflight 620529984c6c33118fa6fdc7

[CL 18937113 by evgenii babinets in ue5-main branch]
2022-02-10 11:26:38 -05:00
evgenii babinets
7dd8af4ddb Backing out 18896978 due to another EngineTest failure. Original description:
Second attempt at fixing a GameThread stall (waiting for render thread) whenever a CVar is changed during gameplay.

It seems like the intent of the callback sink for r.FreeSkeletalMeshBuffers was to free eligible CPU buffers when the CVar was raised to 1, but unfortunately we're currently relying on this sink to free certain helper structures.

This change allows those structures to be freed after submitting the buffers to RHI so that we can change the callback sink to only do work on the rising edge (which generally only happens when switching game-mode/device profile and not during gameplay).

#rb josie.yang
#preflight 62017cbae9567e667308aa18

#ROBOMERGE-OWNER: evgenii.babinets
#ROBOMERGE-AUTHOR: evgenii.babinets
#ROBOMERGE-SOURCE: CL 18894475 via CL 18894521 via CL 18894553 via CL 18896447 via CL 18896609
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)
#ROBOMERGE-CONFLICT from-shelf
#preflight 6203cc23530b346f8618b67b

[CL 18917352 by evgenii babinets in ue5-main branch]
2022-02-09 09:35:00 -05:00
evgenii babinets
00605f283c Second attempt at fixing a GameThread stall (waiting for render thread) whenever a CVar is changed during gameplay.
It seems like the intent of the callback sink for r.FreeSkeletalMeshBuffers was to free eligible CPU buffers when the CVar was raised to 1, but unfortunately we're currently relying on this sink to free certain helper structures.

This change allows those structures to be freed after submitting the buffers to RHI so that we can change the callback sink to only do work on the rising edge (which generally only happens when switching game-mode/device profile and not during gameplay).

#rb josie.yang
#preflight 62017cbae9567e667308aa18

#ROBOMERGE-OWNER: evgenii.babinets
#ROBOMERGE-AUTHOR: evgenii.babinets
#ROBOMERGE-SOURCE: CL 18894475 via CL 18894521 via CL 18894553 via CL 18896447 via CL 18896609
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)
#ROBOMERGE-CONFLICT from-shelf

[CL 18896978 by evgenii babinets in ue5-main branch]
2022-02-07 20:04:27 -05:00
eric mcdaniel
4ae57bc005 [Backout] - CL18864159
- backing out this change as it broke Xbox in UE5/Main
 - Example failed Horde tests:
  - https://horde.devtools.epicgames.com/job/61fd7dc8a6165e535689f6e4?step=0856
   - https://horde.devtools.epicgames.com/job/61fd7dc8a6165e535689f6e4?step=0250

#rb evgenii.babinets
#jira none
#preflight 61fdcfa1e65336d1455736bc
#fyi evgenii.babinets

Original CL Desc
-----------------------------------------------------------------
Fixed a GameThread stall (waiting for render thread) whenever a CVar is changed during gameplay.

It seems like the intent of the callback sink for r.FreeSkeletalMeshBuffers was to free eligible CPU buffers when the CVar was raised to 1, but unfortunately we're currently relying on this sink to free certain helper structures.

This change allows those structures to be freed after submitting the buffers to RHI so that we can change the callback sink to only do work on the rising edge (which generally only happens when switching game-mode/device profile and not during gameplay).

#rb josie.yang
#preflight Horde doesn't work, but compiled locally.

#ROBOMERGE-OWNER: evgenii.babinets
#ROBOMERGE-AUTHOR: evgenii.babinets
#ROBOMERGE-SOURCE: CL 18862796 via CL 18862801 via CL 18862826 via CL 18863875 via CL 18864138
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18878916 by eric mcdaniel in ue5-main branch]
2022-02-04 20:48:30 -05:00
evgenii babinets
1446e36b0f Fixed a GameThread stall (waiting for render thread) whenever a CVar is changed during gameplay.
It seems like the intent of the callback sink for r.FreeSkeletalMeshBuffers was to free eligible CPU buffers when the CVar was raised to 1, but unfortunately we're currently relying on this sink to free certain helper structures.

This change allows those structures to be freed after submitting the buffers to RHI so that we can change the callback sink to only do work on the rising edge (which generally only happens when switching game-mode/device profile and not during gameplay).

#rb josie.yang
#preflight Horde doesn't work, but compiled locally.

#ROBOMERGE-OWNER: evgenii.babinets
#ROBOMERGE-AUTHOR: evgenii.babinets
#ROBOMERGE-SOURCE: CL 18862796 via CL 18862801 via CL 18862826 via CL 18863875 via CL 18864138
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18864159 by evgenii babinets in ue5-main branch]
2022-02-04 11:07:20 -05:00
aleksander netzel
ca5533d4dd Use TRHIResourceUpdateBatcher to load & unload FRHIRaytracingGeometry during MeshStreaming.
* FRayTracingGeometry can now be initialized in one of 3 states: Rendering, StreamingDestination and StreamingSource:
- Rendering: buffer and shader parameters are created.
- StreamingSource: only buffer is created
- StreamingDestination: nothing is created.

* Life of a streamed FRayTracingGeometry looks as follows:
1. Created with StreamingDestination
2. TStaticMeshStreamIn_IO::DoCreateBuffers creates a temporary FRayTracingGeometry (StreamingSource type) from CPU data.
3. FStaticMeshStreamIn::DoFinishUpdate: schedules a copy of RayTracingGeometryRHI on RHI thread (InitRHIForStreaming) and enqueues a render command to update hit group parameters and schedules a build if needed (RequestBuildIfNeeded).
4. Temporary FRayTracingGeometry is released.
5. When no longer needed the original FRayTracingGeometry is released (ReleaseRHIForStreaming)

* Added code to SetInitializer and Swap FRHIRayTracingGeometry that is needed for RHITransferRayTracingGeometryUnderlyingResource.

#rb Kenzo.Terelst, Luke.Thatcher, Yuriy.Odonnell
#jira UE-132838
#preflight 61df5a6e9c1e5c90b618bbec

#ROBOMERGE-AUTHOR: aleksander.netzel
#ROBOMERGE-SOURCE: CL 18595099 in //UE5/Release-5.0/... via CL 18595107 via CL 18595110
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Test -> Main) (v899-18417669)

[CL 18596644 by aleksander netzel in ue5-main branch]
2022-01-13 10:06:50 -05:00
tiago costa
6b7761501e Added flag to FRayTracingGeometry to track if geometry requires an initial BLAS build.
- For example, if it was created using ERTAccelerationStructureBuildPriority::Skip.
- Fix assert for skinned meshes using WorldPositionOffset.

#rb Yuriy.ODonnell, Juan.Canada
#preflight 615f2f21635a7a0001717cdd
#lockdown Michal.Valient

#ROBOMERGE-AUTHOR: tiago.costa
#ROBOMERGE-SOURCE: CL 17753623 via CL 17985240 via CL 18368045 via CL 18368107
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18368140 by tiago costa in ue5-release-engine-test branch]
2021-12-03 09:55:58 -05:00
yuriy odonnell
5765bf1f4c Fix various issues with ray tracing scene construction when running without ray tracing shader support (inline-only mode).
* Add IsRayTracingEnabledForProject() to check if ray tracing is enabled independently from RT shader support
* Skip creating the RayTracingMaterialPipeline when RT shaders are not supported
* Update FRayTracingMeshProcessor::Process() to work without full RT sahders, as it's still needed to compute the RT instance masks

#rb aleksander.netzel, tiago.costa

#ROBOMERGE-AUTHOR: yuriy.odonnell
#ROBOMERGE-SOURCE: CL 18295300 in //UE5/Release-5.0/... via CL 18295310
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18295319 by yuriy odonnell in ue5-release-engine-test branch]
2021-11-25 11:58:24 -05:00
aurel cordonnier
fc542f6cfd Merge from Release-Engine-Staging @ 18081189 to Release-Engine-Test
This represents UE4/Main @18073326, Release-5.0 @18081140 and Dev-PerfTest @18045971

[CL 18081471 by aurel cordonnier in ue5-release-engine-test branch]
2021-11-07 23:43:01 -05:00