Commit Graph

202 Commits

Author SHA1 Message Date
Sebastien Hillaire
b19df6202a Strata - fixed static variable shadowing.
#rb none
#preflight none

[CL 23158492 by Sebastien Hillaire in ue5-main branch]
2022-11-16 13:54:10 -05:00
Sebastien Hillaire
cd4aa07281 Strata - added high quality normal according to GBuffer format.
#rb none
#preflight https://horde.devtools.epicgames.com/job/6374f970b6636838280f3278
#fyi charles.derousiers

[CL 23155230 by Sebastien Hillaire in ue5-main branch]
2022-11-16 11:35:48 -05:00
christopher waters
977f66039e Removing uniform buffer name locks from FShaderType and FVertexFactory
- FlushShaderFileCache() used to be called to force all shader types to update their list of referenced uniform buffers, but they are only updated if they were ever used to compile in the current session. This would impact *any* shader type that had been used instead of just being limited to changed shader types.
- Moved the uniform buffer reference updating into a new function: UpdateReferencedUniformBufferNames.
- UpdateReferencedUniformBufferNames should be called before all shader recompiles but after FlushShaderFileCache does reset itself. This function requires a list of outdated types so we can reduce the shader type updates to only the types that need it.

#jira none
#rb jason.nadro, zach.bethel
#preflight 636a7a537c2b505190a464fb

[CL 23063334 by christopher waters in ue5-main branch]
2022-11-09 16:39:32 -05:00
christopher waters
c6e9015a91 Cache uniform buffer definitions
- Remove shader platform specific info from uniform buffers, we can generate code with macros that translates to what each platform needs.
- With the per-platform differences removed, uniform buffer declarations (read: generated text) can be created once per shader parameter type that needs them instead of once per shader type's shader parameter type usage.
- FShaderType and FVertexFactoryType now hold a TSet of used uniform buffer names instead of a TMap that held potentially duplicated FStrings of uniform buffer defintions.
- Lists of uniform buffers are *potentially* different per platform, so the annoying CachedUniformBufferPlatform variables need to stick around for now.
- GenerateReferencedUniformBuffers renamed to GenerateReferencedUniformBufferNames and now populates a TSet instead of a TMap.
- ShaderType::AddReferencedUniformBufferIncludes renamed to ShaderType::AddUniformBufferIncludesToEnvironment which calls the shared UE::ShaderParameters::AddUniformBufferIncludesToEnvironment.
- CreateUniformBufferShaderDeclaration moved to UE::ShaderParameters::CreateUniformBufferShaderDeclaration and now returns its FString.
- CacheUniformBufferIncludes was removed since it was only populated values from CreateUniformBufferShaderDeclaration.
- Deprecated FShaderCompilerInput::SourceFilePrefix since nothing has populated it in 9 years.

#jira none
#rb dan.elksnitis, yuriy.odonnell
#preflight 63643e5ff233f06a127c11c1

[CL 22988611 by christopher waters in ue5-main branch]
2022-11-04 12:04:48 -04:00
christopher waters
0621d20368 More shader compiling code wrapped with WITH_EDITOR checks
- Focused around moving GlobalBeginCompileShader and friends.
- ModifyCompilationEnvironment and ValidateCompiledResult now only compiled in Editor builds.
- Measured 0.5MB to 1.0MB elf size reduction depending on platform.

#jira none
#rb jason.nadro, arciel.rekman, florin.pascu
#preflight 63613f992b5338aceb442902

[CL 22890964 by christopher waters in ue5-main branch]
2022-11-01 16:31:27 -04:00
chris kulla
60ddb1867f Hide unused payload structs from shaders which did not declare them
This is meant to help avoid inconsistencies between GetRayTracingPayloadType() and the shader code.

As an example of the usage, convert RayTracingDebug related shaders to only enable the payload conditionally. Fix the current incorrect mixing of payload uses in the same shader by introducing a permutation for the material version of the debug shader vs. the one that uses the debug payload (this was previously a runtime shader parameter only which implied two different payloads could theoretically be compiled into one RTPSO).

Also conditionaly enable some of the simpler payload types like the niagara and decal ones that are only used in a few places. Other payloads will be handled in future refactors.

Split RayTracingDebug.usf into smaller files that only have one raytracing entry in them to reduce the amount of counditional logic needed around payloads.

#rb Yuriy.ODonnell
#jira none
#preflight 635c49e9ae6840072d4df82f

[CL 22849513 by chris kulla in ue5-main branch]
2022-10-28 23:28:11 -04:00
chris kulla
5da8820c19 Redesign the raytracing payload type tagging to use a function instead of a hardcoded field
This allows the raytracing payload type to vary according to shader permutation parameters which is more flexible and simplifies the code for complex cases like Lumen or deferred reflections

#rb Yuriy.ODonnell
#jira none
#preflight 635a8ba96a2a692f5d720eb3

[CL 22809506 by chris kulla in ue5-main branch]
2022-10-27 10:21:14 -04:00
tim doerries
1efb722a91 Reworked CL for adding support for filtered virtual shadow maps on SingleLayerWater. Implemented by applying the VSM shadow mask to the SeparateMainDirLight texture that is written out by the main water pass in the presence of distance field shadows (or VSM filtering) and then later composing it back into the scene. Also removed EncodeLightAttenuationFromMask() function from VirtualShadowMapMaskBitsCommon.ush.
Originally reviewed in review 22330833.

#rb andrew.lauritzen, Ola.Olsson, Sebastien.Hillaire
#jira FORT-515227
#rnx
#preflight 6356c6700313c24974e8f7dd

[CL 22749579 by tim doerries in ue5-main branch]
2022-10-25 09:19:25 -04:00
chris kulla
b00b7d70d0 Organize Ray Tracing shaders by their payload
Every shader now has the ability to declare which payload it uses. HitGroup, Miss and Callable shaders may only specify a single type, whereas Raygen shaders may provide more than one.

The global raytracing shader libraries have been categorized according to their payload type, which helps facilitate the creation of minimal ray-tracing pipelines.

Avoid adding callable shaders to the RTPSO if they are not being used.

All RHI shader compilers and shader loaders that support ray tracing have been modified to track an extra uint representing the payload type flagged in the source (at time of compilation).

Add the RayTracingPayloadType to the shadermap DDC key so that we can properly detect when a shader's payload type is invalidated. This is required because we serialize the payload type into the shaders from the C++ side.

#rb Yuriy.ODonnell
#jira none
#preflight 635715cae6096564af4dd28e

[CL 22742893 by chris kulla in ue5-main branch]
2022-10-24 20:11:02 -04:00
yiliang siew
fd6f72459d Changing static TArrays to be declared as function statics instead of global class statics in order
to avoid a memory leak.
   #rnx
   #rb Florin.Pascu
      #rb Matt.Peters
#preflight 6350f4608449f85a479db179

[CL 22662474 by yiliang siew in ue5-main branch]
2022-10-20 13:41:15 -04:00
bob tellez
58a94a0239 Merging CL#22581718
[Backout] - CL22476756
[FYI] tim.doerries
Original CL Desc
-----------------------------------------------------------------
Added support for filtered virtual shadow maps on SingleLayerWater. Implemented by applying the VSM shadow mask to the SeparateMainDirLight texture that is written out by the main water pass in the presence of distance field shadows (or VSM filtering) and then later composing it back into the scene. Also removed EncodeLightAttenuationFromMask() function from VirtualShadowMapMaskBitsCommon.ush.

#rb andrew.lauritzen, Ola.Olsson, Sebastien.Hillaire
#rnx
#preflight 6345d0aeb757820b7a90db71

[CL 22587146 by bob tellez in ue5-main branch]
2022-10-17 19:32:43 -04:00
tim doerries
462a1f21d5 Added support for filtered virtual shadow maps on SingleLayerWater. Implemented by applying the VSM shadow mask to the SeparateMainDirLight texture that is written out by the main water pass in the presence of distance field shadows (or VSM filtering) and then later composing it back into the scene. Also removed EncodeLightAttenuationFromMask() function from VirtualShadowMapMaskBitsCommon.ush.
#rb andrew.lauritzen, Ola.Olsson, Sebastien.Hillaire
#rnx
#preflight 6345d0aeb757820b7a90db71

[CL 22565339 by tim doerries in ue5-main branch]
2022-10-17 10:51:56 -04:00
christopher waters
d8b6c60a8e Allowing SM5 to support bindless only in RayTracing shaders.
#jira UE-162014
#rb elizabeth.baumel, yuriy.odonnell
#preflight 634456c66e400a8e20f57202

[CL 22458545 by christopher waters in ue5-main branch]
2022-10-11 11:19:10 -04:00
Charles deRousiers
cd578e6040 * Change r.RectLightAtlas.Translucent to be readonly
* Enforce shader change when the CVar is toggled

#rb none
#jira none
#preflight 633ea5163a20cf302cb21de2
#fyi sebastien.hillaire

[CL 22373221 by Charles deRousiers in ue5-main branch]
2022-10-06 05:56:28 -04:00
ola olsson
e929658097 Implemented depth prepass for SingleLayerWater. Depth prepass output is fed into VSM page marking/allocation shader to get correct VSM pages for sampling VSM on water. The depth prepass is also used in the main water pass by setting the main pass depth test to EQUAL and forcing earlyZ. CopyTexture() is currently not supported for depth buffers on all platforms, so I had to write a custom copy shader to create a copy of the main depth buffer to render the water depth prepass into.
#ushell-cherrypick of 21812612 by tim.doerries
#rb Ola.Olsson, andrew.lauritzen, Sebastien.Hillaire
#rnx
#preflight 6331ccc3a4769ad714ad3473

[CL 22307543 by ola olsson in ue5-main branch]
2022-10-03 12:55:37 -04:00
dmitriy dyomin
c833228e68 Mobile: Use 3 shadow cascades on Epic shadow quality (Android, iOS)
Remove r.Shadow.CSM.MaxMobileCascades, use r.Shadow.CSM.MaxCascades to limit number of cascades
#jira UE-142377
#rb jack.porter
#preflight 632843baf258fccf9879925a

[CL 22084614 by dmitriy dyomin in ue5-main branch]
2022-09-19 19:48:09 -04:00
Charles deRousiers
f7a18f5fbf Add support for blending DBuffer as a post-pass.
The post base-pass dbuffer blending only works for simple and single materials. Complex material are still apply during the base pass. This pass is disabled by default, and will be enabled only per-platform. Following needs to happen making unpacking/packing modulare and reusable.

On lower-platform this allows to reduce significatly the cost of base pass (BasePass:-1.2ms DBufferPass+0.4ms = -0.8ms net), as the compiler can better prune code, and allows to increase occupancy.

#rb none
#jira none
#preflight 6324633b74361465145e0f75
#fyi sebastien.hillaire

[CL 22048223 by Charles deRousiers in ue5-main branch]
2022-09-16 08:21:00 -04:00
Yuriy ODonnell
6db429d732 ShaderMinifier - Add experimental CFLAG_RemoveDeadCode to run shader rewriting step that removes unused functions and types from shader source before compilation to improve compile times
#rb Jason.Nadro
#preflight 632363a75a44869a7d025585

[CL 22036834 by Yuriy ODonnell in ue5-main branch]
2022-09-15 15:45:20 -04:00
Charles deRousiers
64aa33f6c2 Change Strata byte per pixel budget to be driven per platform, rather than a global project settings.
#rb none
#jira none
#preflight 6322ef526a1299de1d3daaa6
#fyi sebastien.hillaire

[CL 22025779 by Charles deRousiers in ue5-main branch]
2022-09-15 05:43:33 -04:00
robert srinivasiah
7717a11e22 Remove Omni-Directional Stereo Capture (experimental)
#jira UE-147895
#preflight 630723b7c85b7fef22eccd17
#rb Jeff.Fisher Alejandro.Arango Juan.Canada

[CL 21567260 by robert srinivasiah in ue5-main branch]
2022-08-25 12:50:10 -04:00
dmitriy dyomin
ba4c590e33 Added ShadingModels mask.
r.Mobile.ShadingModelsMask can be used to mask out specific shading models on mobile platforms.
Masked shading models will fallback to DefaultLit

[CL 21540496 by dmitriy dyomin in ue5-main branch]
2022-08-24 10:40:03 -04:00
christopher waters
aee024fd71 Adding bindless support to more MDC parameter types. Removing unneeded data from MDC UB binding info.
#jira UE-139616
#rb zach.bethel
#preflight 6303ec020061f895d0edfe3d

[CL 21496103 by christopher waters in ue5-main branch]
2022-08-22 18:22:37 -04:00
Florin Pascu
960d2cf9d4 Filter Frequencies for mobile platforms(only allow vertex, pixel and compute)
#rb Dmitriy.Dyomin
#jira UE-159449
#preflight 62f50941086f90bbc415bb9d

[CL 21335708 by Florin Pascu in ue5-main branch]
2022-08-11 10:19:42 -04:00
serge bernier
6df0b584ae Use DDPI option to use the compressed transforms with scenedata. For platforms not supporting nanite, using non compressed transforms saves 0.4ms on the GPU.
#rb [at]jamie.hayes

#ROBOMERGE-AUTHOR: serge.bernier
#ROBOMERGE-SOURCE: CL 21090729 via CL 21090755 via CL 21095104
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21099187 by serge bernier in ue5-main branch]
2022-07-14 17:05:33 -04:00
wei liu
87f2d95ada 1.Supports more shading models on mobile, including twoside foliage, cloth and eye shading models.
2.Uses the same shading models and dynamic lightings code path on desktop.

3.Remove the division of PI on mobile directional light's color in C++ to line up with desktop in shaders.

#jira UE-114145

#rb Dmitriy.Dyomin, Sebastien.Hillaire
#preflight 62b0411fd8082c5c200fa32a

[CL 20734991 by wei liu in ue5-main branch]
2022-06-20 06:02:51 -04:00