Commit Graph

191 Commits

Author SHA1 Message Date
Arciel Rekman
12a704a68a Make sure reflection capture View knows it's a capture during the construction.
#rb Rob.Srinivasiah
#jira prerequisite for UE-168931
#preflight none

[CL 23140802 by Arciel Rekman in ue5-main branch]
2022-11-15 14:56:36 -05:00
luke thatcher
0a443d68c5 Improve performance of RHI GPU draw call / num primitive stats
- Old code relied on atomic increments in the RHI_DRAW_CALL_INC /  RHI_DRAW_CALL_STATS macros, which is expensive, particularly on platforms with poor atomic performance.
 - New system replaces the atomic writes with a context-specific stats structure, which is accumulated by the RHI thread into the global structure.
 - Contexts write stat data through a "Stats" pointer on the IRHIComputeContext, which is set automatically by the command list management code. The pointer is replaced whenever a new "draw call category" is pushed, to redirect the counts.
 - Also moved some macro definitions around so more of the system can be removed when HAS_GPU_STATS is 0. Removed dependencies on CSV_PROFILER.

Moved Begin/EndFrame, Begin/EndScene, Begin/EndDrawingViewport into the immediate RHICmdList
 - They were already immediate-only functions due to a check() they contain.

#rb Zach.Bethel
#preflight 635fed4af97758810b50cb06

[CL 22875455 by luke thatcher in ue5-main branch]
2022-10-31 20:02:27 -04:00
Sebastien Hillaire
bf24d336d4 Added support for FP32 sky light specified cubemap high dynamic range.
#rb charles.derousiers
#jira UE-158915
#preflight https://horde.devtools.epicgames.com/job/6318577bf448dc6e58525f4d

[CL 21886454 by Sebastien Hillaire in ue5-main branch]
2022-09-08 04:57:35 -04:00
Wei Liu
628cca2177 Fix a bug of missing reflection because of feature level SM6.
#jira none

#rb Dmitriy.Dyomin
#preflight 630475930061f895d007eda9

[CL 21503129 by Wei Liu in ue5-main branch]
2022-08-23 02:40:53 -04:00
zach bethel
bab0b52058 Constrained async uniform expression cache updates to happen during a scene render. This avoids multiple race conditions that can occur due to various material parmeter changes.
#rb jonathan.bard

#ROBOMERGE-AUTHOR: zach.bethel
#ROBOMERGE-SOURCE: CL 21431185 via CL 21431247 via CL 21433716 via CL 21433957 via CL 21434058
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v981-21435820)

[CL 21436491 by zach bethel in ue5-main branch]
2022-08-17 20:34:04 -04:00
jason hoerner
1432825600 Sphere Reflection Capture: Fix for OOM prevention logic, so it properly handles building or loading cached captures, without generating invalid cache data or asserting.
Capturing is disabled if resolution has been reduced, requiring the user to solve memory issues before capturing (by deleting items or reducing resolution).  Logic was added so the reflection capture scene data is reset to allow it to shrink, in cases where an OOM had occurred due to resolution -- without this fix, the user would need to restart the editor.  And if the resolution has been reduced since captures were taken (some were successfully captured, but then more were added, triggering the OOM logic), excess mips are discarded from the cached data to avoid an assert.

#jira UE-158096
#rnx
#rb mihnea.balta
#preflight 62ee8a7abc175ec68c7c958a

[CL 21297235 by jason hoerner in ue5-main branch]
2022-08-09 16:16:19 -04:00
jason hoerner
b7bf93b9dd Build fix for missing SIZE_T_MAX
#jira none
#rnx
#preflight trivial

[CL 21091846 by jason hoerner in ue5-main branch]
2022-07-14 12:06:53 -04:00
jason hoerner
61287a06a7 Sphere reflection capture: Added logic to automatically adjust cube map resolution based on what will fit in GPU memory without producing an OOM, in WITH_EDITOR builds. In non-editor builds, the same logic estimates if an OOM will occur, to give the user more detailed information about what may have caused the OOM.
The specific case we are trying to handle is that D3D12 fails to allocate a texture resource if its size equals or exceeds 4 GB, returning an OOM error, even if plenty of GPU memory is available.  The goal is to degrade quality gracefully in the editor rather than crashing, and produce an actionable message otherwise.

#jira UE-158096
#rnx
#rb mihnea.balta
#preflight 62d031598a3c9910d1465bfc

[CL 21091695 by jason hoerner in ue5-main branch]
2022-07-14 11:55:43 -04:00
zach bethel
d62d286474 Merged PreRender view extension RDG builder with scene render RDG builder.
- Ported remaining ISceneViewExtension calls to RDG.
 - Removed several empty override passes being added to the graph.
 - Merged two graphs into one.

#preflight 62c4c61a2a05d4f55bd5912f
#rb luke.thatcher

[CL 20971717 by zach bethel in ue5-main branch]
2022-07-06 15:33:30 -04:00
jason hoerner
11ea386451 RHI validation fix: avoid redundant RHI frame begin/end when cubemap capture occurs during UEngine::Tick, and other Tick related functions where the RHI frame will already be active. A boolean "bInsideTick" flag is passed to UReflectionCaptureComponent::UpdateReflectionCaptureContents, specifying whether the cubemap capture is happening during Tick.
The four places this applies include UEditorEngine::Tick, UGameEngine::Tick, FAdvancedPreviewScene::Tick, and FPreviewScene::UpdateCaptureContents.  The last example is called from FBlueprintEditor::Tick and FThumbnailPreviewScene::Tick.

The counter-example is "UEditorEngine::BuildReflectionCaptures", which doesn't appear to be called anywhere from a Tick related function.  It's called in startup functions, various commands, and as part of static lighting generation.  If we run into further validation errors, we could add a flag to that function to differentiate those cases.  Even though there's only one counter-example, I figured it was best to err on the side of not changing behavior of client code that may also be using the function, so by default "bInsideTick" is set to false.

#jira UE-153604
#rb mihnea.balta jason.nadro
#rnx
#preflight 628d89082f2409bc1e08a42e

[CL 20362380 by jason hoerner in ue5-main branch]
2022-05-25 07:11:28 -04:00
zach bethel
29d075c4c8 Deprecated GRHISupportsResolveCubemapFaces.
#preflight 62880985192a338d864ba496

[CL 20304268 by zach bethel in ue5-main branch]
2022-05-20 18:14:00 -04:00
zach bethel
3cc87760bd Removed cases of AddCopyToResolveTargetPass which either weren't necessary or weren't performing multisample resolves.
#preflight 628270aa046b81bf93c13e50

[CL 20226032 by zach bethel in ue5-main branch]
2022-05-16 12:09:51 -04:00
carl lloyd
49d2564572 Removed depth texture binding in CopySceneToCubeFace pass on Mobile platforms
#rb Jack.Porter
#jira UE-151325
#lockdown Mitchell.Wilson
#preflight 627b7dc10a5817c9d93cfa75

#ROBOMERGE-AUTHOR: carl.lloyd
#ROBOMERGE-SOURCE: CL 20138648 in //UE5/Release-5.0/... via CL 20140427
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20143855 by carl lloyd in ue5-main branch]
2022-05-11 13:17:32 -04:00
Tiantian Xie
2d7f3c3317 Fix crash when building lighting with a reflection capture.
* Capture in editor(was +2) and loading from file(+1) added different reference count. The cubemap in use is not marked as delete correctly.
* When a capture is rebuilt, all reference should change to the new capture.

#jira UE-150154
#rb Juan.Canada
#preflight 626ca44eef3968f419d12513

[CL 20008692 by Tiantian Xie in ue5-main branch]
2022-05-02 10:53:51 -04:00
carl lloyd
73c8996430 Mobile GL Deferred ReflectionCapture UBO fix (passed too many elements and hit the GL limit)
#rb Zach.Bethal, Dmitriy.Dyomin
#preflight 626a69d52d28b9d0f7831abc

[CL 19957425 by carl lloyd in ue5-main branch]
2022-04-28 06:34:43 -04:00
richard wallis
3212aa1990 Fix for macOS VRTemplate project crashes when adding a const 4 in a new material.: Use Resolve scene textures in CopySceneToCubeFace() as Target can cause MSAA texture type binding issues in Metal. Part 2 of this fix has already been addressed in CL 19857000.
#jira UE-149469
[REVIEW] [at]zach.bethel,  [at]will.damon
#preflight 6266a2077e06ec7505a69deb
#lockdown Mihnea.Balta

#ROBOMERGE-AUTHOR: richard.wallis
#ROBOMERGE-SOURCE: CL 19936476 in //UE5/Release-5.0/... via CL 19936682
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 19937369 by richard wallis in ue5-main branch]
2022-04-27 07:38:30 -04:00
zach bethel
10131e1285 Refactored RDG in preparation for UnifiedBuffer conversions.
- Refactord 'Finalized Access' feature into a more flexible 'External' vs. 'Internal' access mode per resource toggle.
      - Resources can transition between modes multiple times within the graph.
      - Supports async compute pipeline.
      - Supports queueing of requests to avoid back-to-back helper passes.
      - This feature is needed to support conversion of GPU scene buffers.

 - Deprecated the ReadOnly and ForceTracking resource flags and added a 'SkipTracking' flag instead.
      - Previous semantics were confusing and error prone.
      - New model requires a manual flag to tell RDG never to transition a resource.
      - This flag is used for read-only dummy resources as an optimization.

 - Renamed some of the auxiliary 'FinalizedResource' utilities since the name no longer matches the semantics.

#preflight 6266cc6d0634d0904ce4ba46

[CL 19904734 by zach bethel in ue5-main branch]
2022-04-25 13:00:12 -04:00
jason hoerner
af48ea5a98 UE5_MAIN: Multi-view-family scene renderer refactor, part 2. Move FSceneTextures singleton out of RDG blackboard and FSceneTexturesConfig global variable singleton, into FViewFamilyInfo. This is necessary to allow multiple view families to render in a single render graph and a single scene renderer call.
* Existing calls to CreateSceneTextureShaderParameters and similar functions use "GetSceneTexturesChecked", which allows for the possibility that they are reached in a code path where scene textures haven't been initialized, and nullptr is returned instead of asserting.  The shader parameter setup functions then fill in dummy defaults for that case.  The goal was to precisely match the original behavior, which queried the RDG blackboard, and gracefully handled null if scene textures weren't there.  This definitely appears to occur in FNiagaraGpuComputeDispatch::ProcessPendingTicksFlush, which can be called with a dummy scene with no scene textures.  In the future, I may change this so dummy defaults are filled in for FSceneTextures at construction time, so the structure is never in an uninitialized state, but I would like to set up a test case for the Niagara code path before doing that, and the checks aren't harmful in the meantime.
* I marked as deprecated global functions which query values from FSceneTexturesConfig, but they'll still work with the caveat that if you use multi-view-family rendering, the results will be indeterminate (whatever view family rendered last).  There was only one case outside the scene renderer that accessed the globals (depth clear value), which I removed, noting that there is nowhere in the code where we modify the depth clear value from its global default.  I would like to permanently deprecate or remove these at some point.  Display Cluster is the only code that's currently using the multi-view-family code path, and as a new (still incomplete) feature, third party code can't be using it, and won't be affected.

#jira NONE
#rb chris.kulla zach.bethel mihnea.balta
#preflight 6261aca76119a1a496bd2644

[CL 19873983 by jason hoerner in ue5-main branch]
2022-04-22 17:33:02 -04:00
rtrick
4ecbb1ce26 PR #8520: Fix for Reflection Captures sometimes showing up black in packaged game. (Contributed by rtrick)
#ushell-cherrypick of 17834874 by UnrealBot

#jira UE-131950
#preflight 624dd34f8e5ae00f0acc7a58
#rb none

[CL 19670744 by rtrick in ue5-main branch]
2022-04-07 11:53:12 -04:00
christopher waters
cb6ce0960c Easier FRHITextureCreateDesc construction and FRHITextureDesc static CreateXXX deprecation
- Deprecated all the Create functions in FRHITextureDesc
- Added Create functions to FRDGTextureDesc which now derives from FRHITextureDesc instead of just being an alias
- FRHITextureCreateDesc can now be constructed functionally via SetXXX functions that return a reference to the FRHITextureCreateDesc
- Fixed a couple bad uses of FRHITexture*Desc types that should have been using FRDGTextureDesc

#jira none
#rb zach.bethel, luke.thatcher, mihnea.balta
#preflight 623df2e16d39f6b5a057299e

[CL 19516773 by christopher waters in ue5-main branch]
2022-03-25 14:18:22 -04:00
zach bethel
51d195d21f Major refactor of reflection capture code.
- Converted to RDG.
 - Converted mobile to use subresource transitions instead of awkward ping-ponging between render targets.
 - Merged duplicate code paths between mobile / desktop.
 - Eliminated FReflectionScratchCubemaps singleton in favor of explicit resource marshalling.

#preflight 623cdecc573f51b292c9c84a
#rb christopher.waters

[CL 19513281 by zach bethel in ue5-main branch]
2022-03-25 11:17:23 -04:00
Arciel Rekman
111627d950 Flip HMD extensions to opt-in rather than opt-out
#rb Rob.Srinivasiah, Jonathan.Bard, Jules.Blok
#review @Robert.Srinivasiah
#jira none
#preflight 6238b58f9304d833f4e65e3b

[CL 19472593 by Arciel Rekman in ue5-main branch]
2022-03-22 17:27:12 -04:00
arciel rekman
8d77b85911 Disable HMD extensions for reflection capture rendering.
#rb Rob.Srinivasiah, Jonathan.Bard, Jules.Blok
[REVIEW] [at]Robert.Srinivasiah, [at]Jonathan.Bard, [at]Jules.Blok
#jira UE-142863
#preflight 620c5ad66d2ea505c3e90684

#ROBOMERGE-AUTHOR: arciel.rekman
#ROBOMERGE-SOURCE: CL 19059799 in //UE5/Release-5.0/... via CL 19074931
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19076728 by arciel rekman in ue5-main branch]
2022-02-22 13:57:04 -05:00
jonathan bard
96f58b74b5 Made sure that view extensions are gathered and that PreRenderView_RenderThread/PreRenderViewFamily_RenderThread and SetupView/SetupViewFamily are called on all of them for all code paths triggering a scene render.
* For thumbnail renderers, the prototype of RenderViewFamily (which is called by all the types of thumbnail renderers) has been changed to take a non-const FSceneView* parameter (so that SetupView can be called on it) and the various GetView functions have been renamed CreateView since it more accurately depicts what the functions do (plus they return the non-const view they've created)
* UGameViewportClient::Draw was calling SetupViewFamily but not SetupView
* Made sure FSceneRenderer::ViewExtensionPreRender_RenderThread is called right before RenderThreadBegin for all code paths
* Made sure view extensions are gathered for all code paths rendering a view family

Note: BeginRenderViewFamily (i.e. game-thread), PostRenderView_RenderThread and PostRenderViewFamily_RenderThread are still not called on the non-standard code paths

#jira UE-140273, UE-140489, UE-139067, UE-140425
#rb sebastien.lussier, rob.srinivasiah
#tests EngineTests (screenshots), editor
#preflight 61fd216ae17efe76d1b49a2d
#lockdown mihnea.balta

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 18884880 in //UE5/Release-5.0/... via CL 18884941 via CL 18885221
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18885607 by jonathan bard in ue5-main branch]
2022-02-07 10:11:19 -05:00
andrew davidson
cac76b118e Fix FVector2D variant casts - Renderer
Submitted on behalf of fred.kimberley
#rb andy.davidson
#preflight 61f8700e41414fb013dd4002

#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 18801433 in //UE5/Release-5.0/... via CL 18802090 via CL 18821511
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18821594 by andrew davidson in ue5-main branch]
2022-02-02 01:43:41 -05:00