Commit Graph

102 Commits

Author SHA1 Message Date
massimo tristano
aa729f3e3b Fix crash in MaterialShader occurring in a Shipping build when bUseChecksInShipping is set to true.
#rb jason.nadro
#preflight 63484047ad0f7e2f20e58fb7

[CL 22547957 by massimo tristano in ue5-main branch]
2022-10-15 02:16:27 -04:00
marc audy
e0dd6f4707 Compute shader base pass and lightmap policy support
#rb charles.derousiers, jason.nadro
[FYI] krysztof.narkowicz, daniel.wright, brian.karis, rune.stubbe, juan.canada, yuriy.odonnell, sebastien.hillaire
#preflight skip

[CL 22317017 by marc audy in ue5-main branch]
2022-10-03 18:17:06 -04:00
zach bethel
378ddb20ea Deprecated local uniform buffers now that RHICreateUniformBuffer works on any thread.
#rb kenzo.terelst
#preflight 62a224461a21ec565ca0fad9

[CL 20580156 by zach bethel in ue5-main branch]
2022-06-09 13:17:06 -04:00
zach bethel
bf1bcafa00 Refactored Nanite material GBuffer passes to run off the render thread.
#preflight 62a2129f081ed277df5aa9ed
#rb yuriy.odonnell, krzysztof.narkowicz, kenzo.terelst

[CL 20579258 by zach bethel in ue5-main branch]
2022-06-09 12:40:44 -04:00
zach bethel
78b6b40701 Remove view uniform buffer from ray tracing mesh draw commands and delete FPersistentUniformBuffers::ViewUniformBuffer. Deprecated the view uniform buffer from MeshPassRenderState.
#rb yuriy.odonnell
#preflight 629915e62e20b63f9a9d2d46

[CL 20475710 by zach bethel in ue5-main branch]
2022-06-02 16:57:29 -04:00
Stu McKenna
5de4d156f1 - Fix for OOB access of PrimitiveFadeUniformBufferMap
#fyi tim.doerries
#jira none
#rnx
#preflight 62758f0ef27a22404d1f47c5

[CL 20085598 by Stu McKenna in ue5-main branch]
2022-05-06 17:27:56 -04:00
tim doerries
d11f348beb Fix for "Distance Cull Fade Node on Material does not work with Skeletal Mesh"
#jira UE-149933
#rb kevin.ortegren, jason.nadro, mihnea.balta
#rnx
#preflight 6273ef2eca0ad32a967fda0e
#fyi mihnea.balta, jason.nadro

[CL 20073555 by tim doerries in ue5-main branch]
2022-05-06 05:36:36 -04:00
jamie hayes
34d31e3fcc Convert Nanite's Micropoly Rasterize CS to a material shader.
Added some support for setting material parameters on a CS and with an FRHIComputeCommandList.
Disable programmable raster for now because the micropoly shader requires DXC for the moment.

#rb graham.whlidal
#preflight skip

#ROBOMERGE-AUTHOR: jamie.hayes
#ROBOMERGE-SOURCE: CL 19314277 via CL 19314281
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19347713 by jamie hayes in ue5-main branch]
2022-03-10 21:36:25 -05:00
graham wihlidal
7e2bfe1928 Refactored Nanite hardware rasterizer to run as material shaders, allowing for future material graph evaluation of features like world position offset, pixel depth offset, and masked materials.
#rb brian.karis, ben.ingram
[FYI] zach.bethel, rune.stubbe, ola.olsson, andrew.lauritzen, jamie.hayes
#preflight 61ea1e0a1739bb8724e468da

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 18685715 in //UE5/Release-5.0/... via CL 18685727 via CL 18685735
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v902-18672795)

[CL 18685741 by graham wihlidal in ue5-main branch]
2022-01-20 22:01:51 -05:00
Ben Ingram
14ea9b00e5 Merging Dev-LWCRendering into Main, this includes initial work to support rendering with LWC-scale position
Basic approach is to add HLSL types FLWCScalar, FLWCMatrix, FLWCVector, etc.  Inside shaders, absolute world space position values should be represented as FLWCVector3.  Matrices that transform *into* absolute world space become FLWCMatrix.  Matrices that transform *from* world space become FLWCInverseMatrix.  Generally LWC values work by extending the regular 'float' value with an additional tile coordinate.  Final tile size will be a trade-off between scale/accuracy; I'm using 256k for now, but may need to be adjusted.  Value represented by a FLWCVector thus becomes V.Tile * TileSize + V.Offset.  Most operations can be performed directly on LWC values.  There are HLSL functions like LWCAdd, LWCSub, LWCMultiply, LWCDivide (operator overloading would be really nice here).  The goal is to stay with LWC values for as long as needed, then convert to regular float values when possible.  One thing that comes up a lot is working in translated (rather than absolute) world space.  WorldSpace + View.PrevPreViewTranslation = TranslatedWorldspace.  Except 'View.PrevPreViewTranslation' is now a FLWCVector3, and WorldSpace quantities should be as well.  So that becomes LWCAdd(WorldSpace, View.PrevPreViewTranslation) = TranslatedWorldspace.  Assuming that we're talking about a position that's "reasonably close" to the camera, it should be safe to convert the translated WS value to float.  The 'tile' coordinate of the 2 LWC values should cancel out when added together in this case.  I've done some work throughout the shader code to do this.  Materials are fully supporting LWC-values as well.  Projective texturing and vertex animation materials that I've tested work correctly even when positioned "far away" from the origin.

Lots of work remains to fully convert all of our shader code.  There's a function LWCHackToFloat(), which is a simple wrapper for LWCToFloat().  The idea of HackToFloat is to mark places that need further attention, where I'm simply converting absolute WS positions to float, to get shaders to compile.  Shaders converted in this way should continue to work for all existing content (without LWC-scale values), but they will break if positions get too large.

General overview of changed files:
LargeWorldCoordinates.ush - This defines the FLWC types and operations
GPUScene.cpp, SceneData.ush - Primitives add an extra 'float3' tile coordinate.  Instance data is unchanged, so instances need to stay within single-precision range of the primitive origin.  Could potentially split instances behind the scenes (I think) if we don't want this limitation
HLSLMaterialDerivativeAutogen.cpp, HLSLMaterialTranslator.cpp, Preshader.cpp - Translated materials to use LWC values
SceneView.cpp, SceneRelativeViewMatrices.cpp, ShaderCompiler.cpp, InstancedStereo.ush - View uniform buffer includes LWC values where appropriate
#jira UE-117101
#rb arne.schober, Michael.Galetzka

[CL 17787435 by Ben Ingram in ue5-main branch]
2021-10-12 13:29:45 -04:00
christopher waters
f60a64644d Adding RHIUniformBufferLayoutInitializer and RHIUniformBufferLayout is a proper FRHIResource. This brings proper RHI lifetime support to RHIUniformBufferLayout so we don't delete the layouts while RHI commands that use them are still in flight.
This should fully address UniformBufferLayout/UniformBuffer crashes that randomly happen during shader compiling in the Editor.

#jira none
#rb arciel.rekman, ben.ingram, mihnea.balta, stu.mckenna, will.damon
#preflight 611eb6c6008be90001f8b031

[CL 17243608 by christopher waters in ue5-main branch]
2021-08-19 23:53:29 -04:00
Dmitriy Dyomin
762b48e011 Mobile specific implementation for auto-instancing. (disabled by default atm)
Run a compute job that packs most commonly used instance data (LocalToWorld matrix and some other bits - 80 bytes) into per-instance vertex buffer. Vertex shader does not have access to GPUScene and instead loads instance data from a per-instance vertex buffer. If it needs more primitive/instance data than available then it will load it from Primitive UB, binding unique uniform buffer and breaking auto-instancing. Pixel shader has a full access to a GPUScene
There are 3 ways how FSceneDataIntermediates gets populated
 1. PrimitiveId + GPUScene (Desktop)
 2. Per-Instance data + Primitive UB (Mobile)
 3. Primitive UB (auto-instancing disabled)
Details for GPUScene specific vertex inputs and access to FSceneDataIntermediates are hidden behind a macro:
VF_GPUSCENE_DECLARE_INPUT_BLOCK
VF_GPUSCENE_GET_INTERMEDIATES
FSceneDataIntermediates is now stored in FVertexFactoryIntermediates, FMaterialVertexParameters. Added a few GetPrimitiveData() overloads that allows you to access PrimitiveData depending on current context. Removed most of the cases where GetPrimitiveData() gets used with PrimitiveId.
#rb Ola.Ollson

[CL 17093848 by Dmitriy Dyomin in ue5-main branch]
2021-08-07 07:16:17 -04:00
christopher waters
83f70197d3 Tessellation Removal: Removing RHI Hull/Domain shader types and enums.
#rb lukas.hermanns
#jira UE-94564
#preflight 607f2e11eb4f050001d4655e

[CL 16066223 by christopher waters in ue5-main branch]
2021-04-20 17:00:25 -04:00
christopher waters
c45f1dfad5 Removing Tessellation:
- Removed Tessellation settings from Materials and Material Interfaces
- Removed Adjacency buffers from Static and Skeletal Meshes.

#jira UE-94564
#rb jeremy.moore, josie.yang, kevin.ortegren, yuriy.odonnell

#ROBOMERGE-OWNER: christopher.waters
#ROBOMERGE-AUTHOR: christopher.waters
#ROBOMERGE-SOURCE: CL 15501023 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
#ROBOMERGE-CONFLICT from-shelf

[CL 15502653 by christopher waters in ue5-main branch]
2021-02-23 14:03:21 -04:00
zach bethel
050410cb10 Refactor of mobile pass / view uniform buffers to use static bindings.
Pass / view uniform buffers are no longer bound through mesh draw commands. Instead, they are bound using static bindings on the RDG pass. This is necessary because pass uniform buffers contain RDG resources, which need to be declared to RDG.

#rb christopher.waters, Dmitriy.Dyomin

[CL 14899861 by zach bethel in ue5-main branch]
2020-12-10 14:45:57 -04:00
zach bethel
056a26cddd Refactored uniform buffers to use static bindings as opposed to FPersistentUniformBuffers across the deferred renderer. This removes the view uniform buffer and reflection capture uniform buffers from mesh draw commands and reduces the use of RHIUpdateUniformBuffers.
- View / InstancedView uniform buffers are now bound through RDG directly from the FViewInfo, or created on-demand for cases like jitter-free custom depth.
 - Removed most of the custom persistent view uniform buffers. Left one in Lumen to be done in a later CL.
 - ReflectionCapture uniform buffer is now bound at the RDG pass level.

#rb christopher.waters

[CL 14873982 by zach bethel in ue5-main branch]
2020-12-07 17:43:21 -04:00
Ben Ingram
3e62b2de7c Allow UnfrozenCopy to copy data that was frozen with FPlatformLayoutParameters that are different from the current/local platform
- This is used to allow editor to load cooked materials/shader maps
- Remove UE_FORCE_64BIT_MEMORY_IMAGE_POINTERS, and instead always force memory image ptrs to be 64bits...this simplifies some code, and plan is to remove 32bit support at some point anyway
- Frozen memory image pointers only need 32bits for offset, which leaves another 32bits to stash a type identifier...this allows us to interpret that frozen data being referenced, even it's packed for a different platform
#jira UE-91444
#rb arciel.rekman

[CL 14592392 by Ben Ingram in ue5-main branch]
2020-10-27 16:35:01 -04:00
Marc Audy
4c1bb11c29 Merge UE5/Release-Engine-Staging to UE5/Main @ 14548662
This represents UE4/Main @ 14525125 + cherrypicked fixes
#skipundocheck

[CL 14551026 by Marc Audy in ue5-main branch]
2020-10-22 19:19:16 -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
Michal Valient
95d19f95b1 [REVERB] Merging //UE4/Private-Reverb-Development@13832732
#rb graham.wihlidal, rune.stubbe, brian.karis, andrew.lauritzen, jeff.farris

[CL 13834854 by Michal Valient in ue5-main branch]
2020-07-06 18:58:26 -04:00
Marc Audy
11f5b21210 Merging //UE5/Release-Engine-Staging @ 13752110 to Main (//UE5/Main)
#rnx

[CL 13753156 by Marc Audy in ue5-main branch]
2020-06-23 18:40:00 -04:00
ben ingram
d9d0535ddc Add freezable hash table, use to accelerate lookup of shaders within ShaderMap
- Shaders are searched by TypeName and PermutationId, so move those fields out of FShader and into separate arrays inside ShaderMap, to reduce cache misses while finding shaders
#rb none

#ROBOMERGE-OWNER: ben.ingram
#ROBOMERGE-AUTHOR: ben.ingram
#ROBOMERGE-SOURCE: CL 12646854 via CL 12646966 via CL 12646981
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v675-12543919)

[CL 12646995 by ben ingram in Main branch]
2020-04-06 21:12:18 -04:00
wei liu
35f199da49 Fix a bug of invalid custom depth is used in PP material.
#jira UE-89660

#rb jack.porter, mi.wang

#ROBOMERGE-SOURCE: CL 11729627 in //UE4/Release-4.25/... via CL 11729654
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v656-11643781)

[CL 11729684 by wei liu in Main branch]
2020-02-28 08:51:06 -05:00
Rolando Caloca
5b82f15def Copying //UE4/Dev-RenderPlat-Staging@11388153 to //UE4/Main
#rb none
#rnx

[CL 11388545 by Rolando Caloca in Main branch]
2020-02-12 13:27:19 -05:00
Josh Adams
aa9705149b Copying Private-LoadTimes-4.24 stream to Main. Biggest changes are in Materials/Shader memory freezing.
#rb none

[CL 11282608 by Josh Adams in Main branch]
2020-02-06 13:13:41 -05:00