Commit Graph

214 Commits

Author SHA1 Message Date
zach bethel
c176b233da Renamed CopyTextureWithTransitions to TransitionAndCopyTexture.
#preflight 6287ddfe8828ea88c8701eea

[CL 20303093 by zach bethel in ue5-main branch]
2022-05-20 17:14:41 -04:00
jonathan bard
64f30d41a2 Added support for non-square heightmaps in landscape edit layers local merge
#rb luc.eygasier
#jira UE-145722
#preflight 6284fb021f474f0660ecbf70

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 20281291 via CL 20282922 via CL 20283132
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20285715 by jonathan bard in ue5-main branch]
2022-05-19 15:37:35 -04:00
jonathan bard
b6620fed9b Changed landscape edit layers streaming textures tracking to weak object pointers in order to avoid preventing worlds being dynamically unloaded (e.g. world composition) to hold references to internal landscape textures
#rb luc.eygasier
#jira UE-150092
#preflight 6283c1fb114e08fa2f20c011

[CL 20244624 by jonathan bard in ue5-main branch]
2022-05-17 11:56:30 -04:00
jonathan bard
62f566009a Fixed random crash ocurring in HLOD builder commandlet, where we're hashing landscape texture source data while potentially asynchronously building textures. UTexture2D::GetSizeX() / UTexture2D::GetSizeY() should be prevented in those cases, since unlike in the landscape editor, nothing ensures that FinishCachePlatformData() is called on those textures and the returned sizes end up being wrong / thread-unsafe.
Also fixed a couple of places where we were not using the FTextureSource's data (even though those calls should be fine since they happen in a place where texture compilation is done)

#rb paul.chipchase
#jira UE-150653
#preflight 62829ff6216d06861f3b7ca9

[CL 20239776 by jonathan bard in ue5-main branch]
2022-05-17 05:21:54 -04:00
zach bethel
2156756315 Replaced use of CopyToResolveTarget with CopyTexture.
#preflight 627a90ff7e5f24d1edd73422
#rb luke.thatcher, jason.hoerner

[CL 20127337 by zach bethel in ue5-main branch]
2022-05-10 14:47:34 -04:00
jonathan bard
e479ed3735 Fixed bHasLayersContent not being set properly for the main ALandscape actor in distributed landscape setups (One ALandscape, multiple ALandscapeStreamingProxy actors).
This meant that the test in ALandscapeProxy::PostRegisterAllComponents() to know whether data migration (from non-edit layers to edit layers) should occur, which relies on the cached value bHasLayersContent (which was always false in that case, since there's no landscape component in the ALandscape) and the result of virtual function HasLayersContent() (overridden in ALandscape::HasLayersContent to return true if there's at least one registered landscape edit layer) was always forcing data migration to occur, which would do nothing (no landscape component, hence, no data to migrate) but was still marking the level as dirty

#rb patrick.enfedaque
#preflight 627a67a610766ef8c1f3d590

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 20123696 via CL 20123706 via CL 20123718
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20125767 by jonathan bard in ue5-main branch]
2022-05-10 13:53:26 -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
jonathan bard
72505dc8ac * Added common function for whether landscape edit layers are supported on a given platform
* Added landscape runtime utils for this (the function is needed for global shaders, which have to live in a runtime module)

#jira UE-147655
#preflight 625dc7c4804460ab0fdb9fdf
#rb semion.piskarev

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 19806837 via CL 19806839 via CL 19806842
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v939-19570697)

[CL 19811850 by jonathan bard in ue5-main branch]
2022-04-19 13:19:03 -04:00
michael balzer
a942806ea1 Landscape: Change LogLandscape default verbosity from Warning to Log
#preflight 623e4e9f6d39f6b5a0622c12
#rb jonathan.bard

[CL 19542148 by michael balzer in ue5-main branch]
2022-03-29 10:50:47 -04:00
michael balzer
d2959cc79a Landscape: Resolve static analysis warning in LandscapeEditLayers.cpp
#jira UE-146921
#preflight 623bce4ec73745c600c5432b
#rb jonathan.bard

[CL 19496705 by michael balzer in ue5-main branch]
2022-03-24 11:50:59 -04:00
jonathan bard
a3842f01e1 Added support for subsections in landscape edit layers local merge
#rb luc.eygasier
#preflight 6228ad81695c94f981cf0ce3

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 19319842 via CL 19320693 via CL 19323505 via CL 19323665
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19348040 by jonathan bard in ue5-main branch]
2022-03-10 21:51:08 -05:00
luc eygasier
643ed6eea9 Undo //UE5/Main/Engine/Source/... changelist 19235312
Fixes uninitialized member in FLandscapePerLODMaterialOverride

#rb Jonathan.Bard
#jira UE-144566
#preflight 6220c3397e0217a606ee7545

Original CL Desc
* Removed incomplete per-platform per-LOD level material overrides for landscape. The code isn't meant to support that since material instances are built at edit-time. We would need to somewhat hack it at cook time in order to regenerate (and recompile) the list of material instances per-platform, which is not a recommended thing to to in the engine. Instead, we choose to simply make the per-LOD level material overrides constant across platforms since the recommended way is to customize the material for platforms using material expressions such as Quality Level switc, Shading Path Switc or Feature Level Switc.
* Deprecated/merged FLandscapeComponentMaterialOverride and FLandscapeProxyMaterialOverride into FLandscapePerLODMaterialOverride since they were identical
* Fixed UpdateLayersMaterialInstances which, unlike UpdateMaterialInstances, didn't take into account per-component material overrides

[CL 19242882 by luc eygasier in ue5-main branch]
2022-03-03 08:55:00 -05:00
eric mcdaniel
78d6c0d3f5 [Backout] - CL19230219
#rb none
#jira UE-144566
#preflight 62200fba943787f1d21ae8ae

#fyi luc.eygasier, Jonathan.Bard
Original CL Desc
-----------------------------------------------------------------
* Removed incomplete per-platform per-LOD level material overrides for landscape. The code isn't meant to support that since material instances are built at edit-time. We would need to somewhat hack it at cook time in order to regenerate (and recompile) the list of material instances per-platform, which is not a recommended thing to to in the engine. Instead, we choose to simply make the per-LOD level material overrides constant across platforms since the recommended way is to customize the material for platforms using material expressions such as Quality Level switc, Shading Path Switc or Feature Level Switc.
* Deprecated/merged FLandscapeComponentMaterialOverride and FLandscapeProxyMaterialOverride into FLandscapePerLODMaterialOverride since they were identical
* Fixed UpdateLayersMaterialInstances which, unlike UpdateMaterialInstances, didn't take into account per-component material overrides

From shelve 17931928 on behalf on Jonathan.Bard

#rb Jonathan.Bard
#jira UE-132031
#preflight 621cd5cd49723678579d9ec1

#ROBOMERGE-OWNER: luc.eygasier
#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 19221589 via CL 19223810 via CL 19223838 via CL 19226205
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19235312 by eric mcdaniel in ue5-main branch]
2022-03-02 20:08:32 -05:00
luc eygasier
e78d41114a * Removed incomplete per-platform per-LOD level material overrides for landscape. The code isn't meant to support that since material instances are built at edit-time. We would need to somewhat hack it at cook time in order to regenerate (and recompile) the list of material instances per-platform, which is not a recommended thing to to in the engine. Instead, we choose to simply make the per-LOD level material overrides constant across platforms since the recommended way is to customize the material for platforms using material expressions such as Quality Level switc, Shading Path Switc or Feature Level Switc.
* Deprecated/merged FLandscapeComponentMaterialOverride and FLandscapeProxyMaterialOverride into FLandscapePerLODMaterialOverride since they were identical
* Fixed UpdateLayersMaterialInstances which, unlike UpdateMaterialInstances, didn't take into account per-component material overrides

From shelve 17931928 on behalf on Jonathan.Bard

#rb Jonathan.Bard
#jira UE-132031
#preflight 621cd5cd49723678579d9ec1

#ROBOMERGE-OWNER: luc.eygasier
#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 19221589 via CL 19223810 via CL 19223838 via CL 19226205
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19230219 by luc eygasier in ue5-main branch]
2022-03-02 16:51:01 -05:00
Ben Ingram
b6f8dbd89b Use HLSLTree to generate cached data when using new HLSL translator
This allows cached data to be based on expressions that are active/connected
#rb none
#jira none
#preflight 621fce7831454c90cc079dd2

[CL 19227403 by Ben Ingram in ue5-main branch]
2022-03-02 15:20:48 -05:00
jonathan bard
dc0273093d Landscape edit layers local merge fixes :
* Fixed assert when updating heightmaps of different sizes
* Fixed crash when deleting components : the deleted components were still referenced in the shared weightmap texture usages

Misc:
* Properly delete edit layers heightmaps and weightmaps when deleting landscape components

#rb luc.eygasier
#jira UE-140551
#preflight 62164eea37178b0175ac9cf9

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 19094154 via CL 19100022 via CL 19100646 via CL 19109891
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19147208 by jonathan bard in ue5-main branch]
2022-02-25 10:09:16 -05:00
Jason Nadro
dcd55e3f15 Fix Game Thread and Render Thread access issues when performing shader compilation using FMaterial.
- SubmitCompileJobs was assumed to be render thread only.  Make this explicit in the function name and add a render thread check.
- Add SubmitCompileJobs_GameThread to perform shader compilation submitted from the Game Thread safe.
- Keep a ref to a GameThreadPendingCompilerEnvironment because the one on the GameThreadShaderMap goes away after we clone.
- Add render thread check to GetRuntimeVirtualTextureOutputAttibuteMask_RenderThread
- Move simple enum types from ShaderCompiler.h to ShaderCompilerCore.h so we can access EShaderCompileJobPriority in MaterialShared.h
- Fixup incorrect usage SubmitCompileJobs that was submitted from the Game Thread using the Render Thread maps.

#rb Ben.Ingram
#jira none
#preflight 6216879fdb60b6b592f1d97f

[CL 19098715 by Jason Nadro in ue5-main branch]
2022-02-23 14:59:45 -05:00
sebastien lussier
245f347384 #jira UE-132273
WorldPartition - Added Lanscape HLODs

Created a custom HLOD builder for ULandscapeComponent
* Landscape LOD used to generate the HLOD is autocomputed from the expected draw distance, same for the baked texture size

* Expose ALandscapeProxy::GetLODScreenSizeArray()
* Actually reverting changes done in CL 18794652 (moving proxy mesh creation back to ALandscapeProxy)
* ComputeLayerHash() now takes a bool to choose if we want to compute the hash for edition or runtime data
#preflight 620a60a1583261b0a6539c22
#rb Patrick.Enfedaque

#ROBOMERGE-AUTHOR: sebastien.lussier
#ROBOMERGE-SOURCE: CL 18980225 in //UE5/Release-5.0/... via CL 18980661 via CL 18981014
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v917-18934589)

[CL 18981050 by sebastien lussier in ue5-main branch]
2022-02-14 12:02:22 -05:00
christopher waters
343ba94423 Deprecating RHI*CommandList::SetComputeShader and switching uses to the PSO cache's SetComputePipelineState. This is to get compute shaders in our PSO cache lists as well as move towards ComputePipelineState as the default binding method.
#jira none
#rb arciel.rekman, mihnea.balta, jeannoe.morissette
#preflight 6202a549e85c7a08bbee815f

[CL 18905326 by christopher waters in ue5-main branch]
2022-02-08 13:19:37 -05:00
fred kimberley
7fbfaf57c8 Require explicit constructors/casts when converting between FVector, FVector3d, and FVector3f.
#jira UE-122078
#rb Andrew.Davidson, Colin.McGinley
#preflight standard build

#ROBOMERGE-AUTHOR: fred.kimberley
#ROBOMERGE-SOURCE: CL 18817999 in //UE5/Release-5.0/... via CL 18818012 via CL 18822871
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18824721 by fred kimberley in ue5-main branch]
2022-02-02 07:59:31 -05:00
andrew davidson
8e95b10069 Fix FVector2D variant casts - Runtime
Submitted on behalf of fred.kimberley
#rb andy.davidson
#preflight 61f8729a5a026d2d19bb9ca6
#preflight 61f87a025a026d2d19be76ed

#ROBOMERGE-OWNER: andrew.davidson
#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 18802361 in //UE5/Release-5.0/... via CL 18802891 via CL 18821557
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18821641 by andrew davidson in ue5-main branch]
2022-02-02 01:47:07 -05:00
zach bethel
9996233f7a Removed unused legacy MSAA multi-texture support from IPooledRenderTarget.
- Deprecated legacy members from FPooledRenderTargetDesc.
 - Deprecated ETextureRenderTarget and removed from RDG.
 - TargetableTexture always equals ShaderResourceTexture.
 - Simplified render target pool FindFreeElement.
 - Create pooled buffers and textures with a known state.

#rb graham.wihlidal
#preflight 61f8488568795b2f45852274

#ROBOMERGE-AUTHOR: zach.bethel
#ROBOMERGE-SOURCE: CL 18796880 in //UE5/Release-5.0/... via CL 18797840 via CL 18799070
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18799188 by zach bethel in ue5-main branch]
2022-01-31 17:22:31 -05:00
jonathan bard
581269fda8 Fixed last minute change that prevented landscape painting to work
#rb sebastien.lussier
#rnx

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 18754628 via CL 18754645 via CL 18754653 via CL 18756450 via CL 18758784
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18760812 by jonathan bard in ue5-main branch]
2022-01-27 15:46:53 -05:00
andrew davidson
f089ae83f4 FMatrix explicit cast fixes
#preflight 61f277cbaf74b68515c0bd64

#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 18751911 in //UE5/Release-5.0/... via CL 18751924 via CL 18752067
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18752076 by andrew davidson in ue5-main branch]
2022-01-27 06:25:37 -05:00
jonathan bard
2b57f2ff53 Local merge of landscape edit layers : complete refactor of the merge algorithm that doesn't require allocating several render targets the size of the entire loaded landscape components. Instead, each landscape component is merged individually and heightmaps/weightmaps are then resolved in several small batches. This allows working on large and/or partially loaded landscapes without overtaxing GPU memory.
* The new merge algorithm also speeds up the merging process by performing the merge operation in a single shader pass, which avoids intermediate clear/copies, even more so when dealing with several edit layers (O(n) -> O(1))
* Implemented via FRDGBuilder to benefit from transient memory allocation and optimal resource transitions.
* This is activated by a CVar (landscape.EditLayersLocalMerge.Enable, disabled by default) and disabled for landscapes containing BP brushes, since customers (similar to what the WaterBrushManager did) might have made the assumption that the merge is global and we don't want to break the existing landscapes.

For heightmaps:
* The algorithm is divided into several "component resolve batches" that render a list of neighboring components and merge all their edit layers into a single slice of a scratch texture array (first, copy all the edit layers texture subregions to a texture array then merge them in a single shader pass). Then those rendered components' borders are stitched (in order to mimic the behavior of global merge) so that there are no seams in between components even if they were not properly authored (i.e. one component authored while its neighbor was not loaded). Then normals are generated in another pass.
* In order to limit the amount of temporary copies of heightmaps, batches only render a max number of landscape components (including neighbor components), controlled by CVar landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch. This means that a given component can effectively be rendered (i.e. merged) multiple times if it's needed for the computation of different batches but batches are built in a way to minimize this situation.
* Finally, mips are generated and the resulting heightmaps are copied to staging textures the same way they used to.

For weightmaps:
* The algorithm is divided into several "weightmap resolve batches" that render a list of components that participate to the output of a list of given weightmaps, processing each individual channel into a single slice of a scratch texture array (first, copy all the edit layers texture channels to a texture array then merge them in a single shader pass). Then, the weightmaps to resolve within the batch are finalized (i.e. individual, single-channel, weightmaps are packed into the final multi-channel weightmap), their mips are generated and the resulting weightmaps are copied to staging textures the same way they used to.
* In order to limit the amount of temporary copies of weightmaps, batches only render a max number of individual weightmaps, controlled by CVar landscape.EditLayersLocalMerge.MaxComponentsPerWeightmapResolveBatch. This means that a given weightmap can effectively be rendered (i.e. merged) multiple times if it's needed for the computation of different batches but batches are built in a way to minimize this situation.

Misc:
* Fixed RHI validation for GlobalMerge of weightmaps
* Moved landscape render resources to their own file to de-clutter LandscapeEditLayers.cpp a bit
* landscape.RenderCaptureLayersNextHeightmapDraws and landscape.RenderCaptureLayersNextWeightmapDraws now support capturing several draw calls
* Moved all intermediate containers (LandscapeComponentHeightmapsToRender/ToResolve, MapHelper, etc.) to a context object in order to centralize the local/global merge common structures. Note : the context is mutable and can be partially refreshed since weightmaps can be potentially added by the merge algorithms and therefore those structures were not up to date and we could miss reading back from newly-added weightmap textures
* Removed unused WeightmapLayersBlendSubstractive in global merge algorithm
* CVar commands landscape.Dirty and landscape.FixSplines now process all loaded game worlds

The next step is to re-work our internal brushes and provide a new API for them and user-implemented ones to work in the same fashion. Then the old BP brush API will be progressively phased out.

#rb sebastien.lussier, patrick.enfedaque
#tests full QA pass (UEENGQA-60460)
#preflight 61d8bc681f62d3ad4d728095

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 18751747 via CL 18751748 via CL 18751754 via CL 18751906 via CL 18751983
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18751988 by jonathan bard in ue5-main branch]
2022-01-27 06:12:09 -05:00