2019-12-26 14:45:42 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
/*=============================================================================
2020-09-24 00:43:27 -04:00
PostProcessceSetupce . cpp : Screenspace subsurface scattering implementation .
2019-08-13 17:16:21 -04:00
Indirect dispatch implementation high level description
1. Initialize counters
2. Setup pass : record the tiles that need to draw Burley and Separable in two different buffer .
3. Indirect dispatch Burley .
4. Indirect dispatch Separable .
5. Recombine .
2014-03-14 14:13:41 -04:00
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
# include "PostProcess/PostProcessSubsurface.h"
# include "PostProcess/SceneRenderTargets.h"
2019-06-11 18:27:07 -04:00
# include "Engine/SubsurfaceProfile.h"
# include "CanvasTypes.h"
# include "RenderTargetTemp.h"
2020-10-20 12:12:06 -04:00
# include "ScenePrivate.h"
2019-08-13 17:16:21 -04:00
# include "GenerateMips.h"
# include "ClearQuad.h"
2020-12-04 15:46:10 -04:00
# include "Strata/Strata.h"
2021-02-09 06:30:16 -04:00
# include "TemporalAA.h"
2021-10-29 12:53:33 -04:00
# include "SubsurfaceTiles.h"
2014-03-14 14:13:41 -04:00
2019-06-11 18:27:07 -04:00
namespace
{
2019-08-13 17:16:21 -04:00
// Subsurface common parameters
2019-06-11 18:27:07 -04:00
TAutoConsoleVariable < int32 > CVarSubsurfaceScattering (
TEXT ( " r.SubsurfaceScattering " ) ,
1 ,
TEXT ( " 0: disabled \n " )
TEXT ( " 1: enabled (default) " ) ,
ECVF_RenderThreadSafe | ECVF_Scalability ) ;
2014-09-05 17:48:09 -04:00
2019-06-11 18:27:07 -04:00
TAutoConsoleVariable < float > CVarSSSScale (
TEXT ( " r.SSS.Scale " ) ,
1.0f ,
2019-08-13 17:16:21 -04:00
TEXT ( " Affects the Screen space Separable subsurface scattering pass " )
2019-06-11 18:27:07 -04:00
TEXT ( " (use shadingmodel SubsurfaceProfile, get near to the object as the default) \n " )
TEXT ( " is human skin which only scatters about 1.2cm) \n " )
TEXT ( " 0: off (if there is no object on the screen using this pass it should automatically disable the post process pass) \n " )
TEXT ( " <1: scale scatter radius down (for testing) \n " )
TEXT ( " 1: use given radius form the Subsurface scattering asset (default) \n " )
TEXT ( " >1: scale scatter radius up (for testing) " ) ,
ECVF_Scalability | ECVF_RenderThreadSafe ) ;
2016-02-16 05:48:48 -05:00
2019-06-11 18:27:07 -04:00
TAutoConsoleVariable < int32 > CVarSSSHalfRes (
TEXT ( " r.SSS.HalfRes " ) ,
1 ,
2019-09-03 19:19:28 -04:00
TEXT ( " 0: full quality (Combined Burley and Separable pass. Separable is not optimized, as reference) \n " )
TEXT ( " 1: parts of the algorithm runs in half resolution which is lower quality but faster (default, Separable only) " ) ,
2019-06-11 18:27:07 -04:00
ECVF_RenderThreadSafe | ECVF_Scalability ) ;
2014-10-16 13:08:38 -04:00
2019-06-11 18:27:07 -04:00
TAutoConsoleVariable < int32 > CVarSSSQuality (
TEXT ( " r.SSS.Quality " ) ,
0 ,
TEXT ( " Defines the quality of the recombine pass when using the SubsurfaceScatteringProfile shading model \n " )
TEXT ( " 0: low (faster, default) \n " )
TEXT ( " 1: high (sharper details but slower) \n " )
TEXT ( " -1: auto, 1 if TemporalAA is disabled (without TemporalAA the quality is more noticable) " ) ,
ECVF_RenderThreadSafe | ECVF_Scalability ) ;
2014-09-05 17:48:09 -04:00
2019-06-11 18:27:07 -04:00
TAutoConsoleVariable < int32 > CVarSSSFilter (
TEXT ( " r.SSS.Filter " ) ,
1 ,
TEXT ( " Defines the filter method for Screenspace Subsurface Scattering feature. \n " )
TEXT ( " 0: point filter (useful for testing, could be cleaner) \n " )
TEXT ( " 1: bilinear filter " ) ,
ECVF_RenderThreadSafe | ECVF_Scalability ) ;
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3091903)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3072947 on 2016/08/01 by Uriel.Doyon
Texture GUIDs are now included in cooked builds, as they are required by the texture streamer to link build data to in game texture.
#review-3072934 @marcus.wassmer
#jira UE-34045
Change 3073301 on 2016/08/02 by Ben.Woodhouse
Fix for large spotlight culling precision issues, reported on UDN by Aaron Jacobs at Double Fine. For a full description, see the UDN post
https://udn.unrealengine.com/questions/305440/shadowed-light-flicker-caused-by-floating-point-pr.html
#jira UE-34052
Change 3073689 on 2016/08/02 by Ben.Woodhouse
Improved skin postprocess - support for full resolution, with diffuse/spec lighting combined into single RGBA (sharing chroma)
Full res lighting gives less temporal AA flickering, sharper diffuse and specular lighting in the surface (since this is now at full resolution), faster postprocessing if using a 64-bit rendertarget (on NV 980Ti).
Checkerboard rendering is controlled via the r.sss.checkerboard cvar. - 0 is off/full res, 1 is checkerboard, 2 is automatic based on scenecolor (non-checkerboard requires 64bit or more rendertarget w/separate alpha)
Tested/profiled on PC, PS4
Change 3074666 on 2016/08/02 by Daniel.Wright
Fixed stationary skylight brightness
Change 3074667 on 2016/08/02 by Daniel.Wright
Fixed r.ReflectionEnvironmentLightmapMixing
Change 3074687 on 2016/08/02 by Daniel.Wright
Disallowed DrawMaterialToRenderTarget and Begin/EndDrawCanvasToRenderTarget in construction scripts, since they don't work in game. Blutilities can be used to do blueprint rendering in the editor.
Change 3075241 on 2016/08/03 by Rolando.Caloca
DR - Fix linux compile issue & static analysis warning
Change 3075746 on 2016/08/03 by Daniel.Wright
Removed bOverride_AntiAliasingMethod and outdated ini references to PP AntiAliasingMethod
Change 3075783 on 2016/08/03 by Ryan.Brucks
#code.review Marcus.Wassmer
Added two material nodes that return Atmospheric Light Vector and Light Direction using:
View.AtmosphericFogSunColor
View.AtmosphericFogSunDirection
Nodes are called:
AtmosphericLightVector
AtmosphericLightColor
Also changed SceneRendering.cpp so that values will be grabbed from directional lights without needing an Atmospheric Fog actor in the scene.
Change 3075969 on 2016/08/03 by Uriel.Doyon
Material GUIDs are not updated anymore when parents or textures change.
Lighting now uses a hash built from the list of parents, textures and shader functions.
#review-3072980 @marcus.wassmer @daniel.wright
Change 3076116 on 2016/08/03 by Ryan.Brucks
#code.review marcus.wassmer
Fixed typo in the Caption of new Nodes "Atmospheric Light Vector" and "Atmospheric Light Color"
Change 3076456 on 2016/08/03 by Rolando.Caloca
DR - Fix geometry shader gl_Layer for SPIR-V
Change 3076730 on 2016/08/03 by Uriel.Doyon
Added user warning logic for the texture streaming build. Ran in MapCheck, BeginPlay and PreSave.
#review-3072984 @marcus.wassmer
Change 3077616 on 2016/08/04 by Daniel.Wright
Planar reflection show flags can now be edited
Change 3077621 on 2016/08/04 by Daniel.Wright
Changed default Planar Reflection DistanceFromPlaneFadeoutEnd from 600 to 100, which reduces artifacts and is a more intuitive initial setting
Change 3077792 on 2016/08/04 by Daniel.Wright
Fixed an unnecessary sky capture caused by the sky light component owned by the default ASkyLight
Change 3077799 on 2016/08/04 by Daniel.Wright
Skip RF_ArchetypeObject for reflection captures
Change 3077876 on 2016/08/04 by Marc.Olano
Noise material perf improvements
Change random number generator for Gradient-ALU (1.7x perf boost), improve speed of Voronoi noise quality level 3.
Removes integer BBS random number generators. Fewer instructions, but too slow to use (see 1.7x perf boost above)
Change 3077884 on 2016/08/04 by Daniel.Wright
Lighting channels can now be edited on components with static mobility, since dynamic lights can still affect them
Change 3078994 on 2016/08/05 by Simon.Tovey
Fix for UE-34241
Scene proxy ptr was being cached during a downcast.
Inside a call to CreateDynamicData, CheckMaterialUsage_Concurrent() was causing the scene proxy to be recreated an so the cached ptr was stale.
I've fixed the immediate issue but recreating the scene proxy here doesn't seem great. Maybe CheckMaterailUsage() should be rethought a bit.
Change 3079162 on 2016/08/05 by Ben.Woodhouse
Fix for jittering in Paper2D. Was caused by override being ignored due to a change in intiialization order for AA settings.
#jira UE-34091
Change 3079613 on 2016/08/05 by Daniel.Wright
New blueprint function ClearRenderTarget2D, which is the only way to set a render target alpha directly
New blueprint function CreateRenderTarget2D
Change 3079708 on 2016/08/05 by Uriel.Doyon
Fixed crash when building texture streaming on some levels.
Change 3079795 on 2016/08/05 by Uriel.Doyon
Fixed issue with instanced static meshes when building texture streaming.
Fixed typo with func "GetNumTextureStreamingPrimitives"
Change 3079806 on 2016/08/05 by Uriel.Doyon
Enabled PerTexture MipBias. The per texture mip bias now resets to 0 when the texture gets required at low resolution.
New scalability setting named "r.Streaming.LimitPoolSizeToVRAM" enabling the PoolSize to be limited the available VRAM
(according to GPoolSizeVRAMPercentage)
#review-3074662 @marcus.wassmer
Change 3082698 on 2016/08/09 by Daniel.Wright
Copy - CreateRenderTarget2D uses a world context object as owner, allows use in a construction script
Change 3082699 on 2016/08/09 by Daniel.Wright
Changed display name for 'Two Sided' shading model to 'Two Sided Foliage' to make it clear what it's intended to be used for
Change 3083909 on 2016/08/10 by Olaf.Piesche
#jira UE-34106
#jira UE-32784
#jira UE-31198
Reset vertex factories on mesh emitters if mesh has been reimported (if mesh package is dirty)
Change 3084645 on 2016/08/10 by Olaf.Piesche
#jira UE-30398
Fix offset added to particle collision locations.
Change 3084709 on 2016/08/10 by Daniel.Wright
Copy - Scene capture alpha is now inverted to match DrawMaterialToRenderTarget, and to allow compositing with existing render target contents
Added CompositeMode to SceneCapture2D, which can be used to addively accumulate or composite instead of the default overwrite behavior
Added bCaptureOnMovement to SceneCapture, which can be disabled so the only source of scene capturing is a manual capture by calling CaptureScene()
Change 3084783 on 2016/08/10 by Rolando.Caloca
DR - Use the first targeted rhi shader platform as the initial RHI to load on Windows
#jira UE-34510
Change 3084958 on 2016/08/10 by Daniel.Wright
Copy - Reverted cl 2938543 "Lightmass now respects owner bHidden, and bCastHiddenShadow" because it did not have backwards compatibility so breaks content using hidden light cards
Change 3086023 on 2016/08/11 by Marcus.Wassmer
Merging //UE4/Dev-Main@3085468 to Dev-Rendering (//UE4/Dev-Rendering)
#test none
Change 3086778 on 2016/08/11 by Ben.Woodhouse
Workaround for fortnite character rendering issue. Enable checkerboard rendering by default until we can fix properly
#jira UE-34561
Change 3087404 on 2016/08/12 by Rolando.Caloca
DR - Upgrade glslang to 1.0.21.1
- Added some more debug output
Change 3087524 on 2016/08/12 by Rolando.Caloca
DR - vk - Fixed StencilRef, fixed size of RHIReadSurfaceFloatData (but still returns dummy data)
Change 3087663 on 2016/08/12 by Rolando.Caloca
DR - vk - Fix for SRGB; support for mip texture views
Change 3087735 on 2016/08/12 by Daniel.Wright
TextureRenderTarget2D's can now be up to 8192^2. Anything over 2048 pops up an 'are you sure' dialog.
Change 3087750 on 2016/08/12 by Rolando.Caloca
DR - vk - Minor renaming in prep for merge
Change 3087813 on 2016/08/12 by Rolando.Caloca
DR - vk - More minor cleanup
Change 3087819 on 2016/08/12 by Chris.Bunner
Check material function input types directly, no need to traverse connected graph.
#jira UE-32134
Change 3087901 on 2016/08/12 by Rolando.Caloca
DR - vk - Fix RT view to use 1 mip
Fix depth buffer component swizzle
Change 3088193 on 2016/08/12 by Daniel.Wright
DFAO and RTDF shadows are enabled in High and Epic scalability settings by default
Change 3088988 on 2016/08/15 by Rolando.Caloca
DR - Add Accessors
Change 3089104 on 2016/08/15 by Olaf.Piesche
#jira UE-34241
Sceneproxy can be nullptr in FDynamicMeshEmitterData::Init if the proxy is being recreated
Change 3089208 on 2016/08/15 by Daniel.Wright
Downsampled separate translucency uses a separate view uniform buffer with correct buffer sizes
* Fixes WorldPosition in downsampled translucency
* View uniform buffer parameters are now cached on the view, to allow recreating the uniform buffer without having to rebuild the entire struct. Currently used by global distance field, downsampled separate translucency.
* Fixed the downsampled translucency depth buffer being full res used together with a smaller color target, now they are both the downsampled res
Change 3089209 on 2016/08/15 by Daniel.Wright
Fixed atmospheric fog on translucency
Change 3089457 on 2016/08/15 by Daniel.Wright
Fixed lighting build failure from UMaterialInstanceDynamic assigned to a mesh that's being exported to Lightmass. The Swarm cache entry is created using the parent's guid, causing multiple MID's with the same parent to acquire a file handle multiple times which fails after the first.
Change 3089549 on 2016/08/15 by Daniel.Wright
UMaterialInterface initializes LightingGuid to something valid - causes UMaterialInstanceDynamic to have a valid LightingGuid so they can be used in lighting builds
Change 3089703 on 2016/08/15 by Daniel.Wright
Custom expression fixup for View.RenderTargetSize
Change 3090546 on 2016/08/16 by Daniel.Wright
Hopeful fix for recycled snapshot view crash
Change 3091202 on 2016/08/16 by Daniel.Wright
Manually clear FViewInfo::CachedViewUniformShaderParameters on creating a snapshot, since memcpy is used to create the snapshot view
[CL 3091931 by Gil Gribb in Main branch]
2016-08-17 11:38:13 -04:00
2019-06-11 18:27:07 -04:00
TAutoConsoleVariable < int32 > CVarSSSSampleSet (
TEXT ( " r.SSS.SampleSet " ) ,
2 ,
2019-08-13 17:16:21 -04:00
TEXT ( " Defines how many samples we use for Separable Screenspace Subsurface Scattering feature. \n " )
2019-06-11 18:27:07 -04:00
TEXT ( " 0: lowest quality (6*2+1) \n " )
TEXT ( " 1: medium quality (9*2+1) \n " )
TEXT ( " 2: high quality (13*2+1) (default) " ) ,
ECVF_RenderThreadSafe | ECVF_Scalability ) ;
2014-10-15 16:18:43 -04:00
2019-08-13 17:16:21 -04:00
TAutoConsoleVariable < int32 > CVarSSSBurleyUpdateParameter (
TEXT ( " r.SSS.Burley.AlwaysUpdateParametersFromSeparable " ) ,
2019-09-03 19:19:28 -04:00
0 ,
TEXT ( " 0: Will not update parameters when the program loads. (default) " )
TEXT ( " 1: Always update from the separable when the program loads. (Correct only when Subsurface color is 1). " ) ,
2019-08-13 17:16:21 -04:00
ECVF_RenderThreadSafe | ECVF_Scalability
2019-07-12 11:50:25 -04:00
) ;
2019-08-13 17:16:21 -04:00
2019-06-11 18:27:07 -04:00
TAutoConsoleVariable < int32 > CVarSSSCheckerboard (
TEXT ( " r.SSS.Checkerboard " ) ,
2 ,
TEXT ( " Enables or disables checkerboard rendering for subsurface profile rendering. \n " )
TEXT ( " This is necessary if SceneColor does not include a floating point alpha channel (e.g 32-bit formats) \n " )
TEXT ( " 0: Disabled (high quality) \n " )
TEXT ( " 1: Enabled (low quality). Surface lighting will be at reduced resolution. \n " )
TEXT ( " 2: Automatic. Non-checkerboard lighting will be applied if we have a suitable rendertarget format \n " ) ,
ECVF_RenderThreadSafe ) ;
2019-09-03 19:19:28 -04:00
TAutoConsoleVariable < int32 > CVarSSSBurleyQuality (
TEXT ( " r.SSS.Burley.Quality " ) ,
1 ,
TEXT ( " 0: Fallback mode. Burley falls back to run scattering in Separable with transmission in Burley for better performance. Separable parameters are automatically fitted. " )
TEXT ( " 1: Automatic. The subsurface will only switch to separable in half resolution. (default) " ) ,
ECVF_RenderThreadSafe | ECVF_Scalability
) ;
2020-02-12 13:27:19 -05:00
TAutoConsoleVariable < int32 > CVarSSSBurleyNumSamplesOverride (
TEXT ( " r.SSS.Burley.NumSamplesOverride " ) ,
0 ,
TEXT ( " When zero, Burley SSS adaptively determines the number of samples. When non-zero, this value overrides the sample count. \n " ) ,
ECVF_RenderThreadSafe ) ;
2020-09-24 00:43:27 -04:00
TAutoConsoleVariable < int32 > CVarSSSBurleyEnableProfileIdCache (
TEXT ( " r.SSS.Burley.EnableProfileIdCache " ) ,
2021-10-27 16:39:57 -04:00
1 ,
2020-09-24 00:43:27 -04:00
TEXT ( " 0: Disable profile id cache using in the sampling pass. \n " )
TEXT ( " 1: Consumes 1 byte per pixel more memory to make Burley pass much faster. (default) \n " ) ,
ECVF_RenderThreadSafe ) ;
TAutoConsoleVariable < int32 > CVarSSSBurleyBilateralFilterKernelFunctionType (
TEXT ( " r.SSS.Burley.BilateralFilterKernelFunctionType " ) ,
1 ,
TEXT ( " 0: Depth Only. It is more performant (x2 faster for close view). " )
TEXT ( " 1: Depth and normal. It leads to better quality in regions like eyelids. (default) " ) ,
ECVF_RenderThreadSafe ) ;
2021-10-29 12:53:33 -04:00
TAutoConsoleVariable < int32 > CVarSSSMipmapsMinTileCount (
TEXT ( " r.SSS.Burley.MinGenerateMipsTileCount " ) ,
4000 ,
TEXT ( " 4000. (default) The minimal number of tiles to trigger subsurface radiance mip generation. Set to zero to always generate mips (Experimental value) " ) ,
ECVF_RenderThreadSafe ) ;
2021-08-23 15:22:35 -04:00
DECLARE_GPU_STAT ( SubsurfaceScattering )
2019-06-11 18:27:07 -04:00
}
2019-08-13 17:16:21 -04:00
// Define to use a custom ps to clear UAV.
2019-08-19 13:27:06 -04:00
# define USE_CUSTOM_CLEAR_UAV
2019-06-11 18:27:07 -04:00
enum class ESubsurfaceMode : uint32
{
// Performs a full resolution scattering filter.
FullRes ,
// Performs a half resolution scattering filter.
HalfRes ,
// Reconstructs lighting, but does not perform scattering.
Bypass ,
MAX
} ;
2020-07-06 18:58:26 -04:00
const TCHAR * GetEventName ( ESubsurfaceMode SubsurfaceMode )
{
static const TCHAR * const kEventNames [ ] = {
TEXT ( " FullRes " ) ,
TEXT ( " HalfRes " ) ,
TEXT ( " Bypass " ) ,
} ;
static_assert ( UE_ARRAY_COUNT ( kEventNames ) = = int32 ( ESubsurfaceMode : : MAX ) , " Fix me " ) ;
return kEventNames [ int32 ( SubsurfaceMode ) ] ;
}
2019-06-11 18:27:07 -04:00
// Returns the [0, N] clamped value of the 'r.SSS.Scale' CVar.
2014-10-15 16:18:43 -04:00
float GetSubsurfaceRadiusScale ( )
2014-03-14 14:13:41 -04:00
{
2014-10-15 16:18:43 -04:00
static const auto CVar = IConsoleManager : : Get ( ) . FindTConsoleVariableDataFloat ( TEXT ( " r.SSS.Scale " ) ) ;
check ( CVar ) ;
2019-06-11 18:27:07 -04:00
return FMath : : Max ( 0.0f , CVar - > GetValueOnRenderThread ( ) ) ;
2014-10-15 16:18:43 -04:00
}
2019-08-13 17:16:21 -04:00
int32 GetSSSFilter ( )
{
return CVarSSSFilter . GetValueOnRenderThread ( ) ;
}
int32 GetSSSSampleSet ( )
{
return CVarSSSSampleSet . GetValueOnRenderThread ( ) ;
}
int32 GetSSSQuality ( )
{
return CVarSSSQuality . GetValueOnRenderThread ( ) ;
}
2020-09-24 00:43:27 -04:00
int32 GetSSSBurleyBilateralFilterKernelFunctionType ( )
{
return CVarSSSBurleyBilateralFilterKernelFunctionType . GetValueOnRenderThread ( ) ;
}
2019-06-11 18:27:07 -04:00
// Returns the current subsurface mode required by the current view.
ESubsurfaceMode GetSubsurfaceModeForView ( const FViewInfo & View )
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3091903)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3072947 on 2016/08/01 by Uriel.Doyon
Texture GUIDs are now included in cooked builds, as they are required by the texture streamer to link build data to in game texture.
#review-3072934 @marcus.wassmer
#jira UE-34045
Change 3073301 on 2016/08/02 by Ben.Woodhouse
Fix for large spotlight culling precision issues, reported on UDN by Aaron Jacobs at Double Fine. For a full description, see the UDN post
https://udn.unrealengine.com/questions/305440/shadowed-light-flicker-caused-by-floating-point-pr.html
#jira UE-34052
Change 3073689 on 2016/08/02 by Ben.Woodhouse
Improved skin postprocess - support for full resolution, with diffuse/spec lighting combined into single RGBA (sharing chroma)
Full res lighting gives less temporal AA flickering, sharper diffuse and specular lighting in the surface (since this is now at full resolution), faster postprocessing if using a 64-bit rendertarget (on NV 980Ti).
Checkerboard rendering is controlled via the r.sss.checkerboard cvar. - 0 is off/full res, 1 is checkerboard, 2 is automatic based on scenecolor (non-checkerboard requires 64bit or more rendertarget w/separate alpha)
Tested/profiled on PC, PS4
Change 3074666 on 2016/08/02 by Daniel.Wright
Fixed stationary skylight brightness
Change 3074667 on 2016/08/02 by Daniel.Wright
Fixed r.ReflectionEnvironmentLightmapMixing
Change 3074687 on 2016/08/02 by Daniel.Wright
Disallowed DrawMaterialToRenderTarget and Begin/EndDrawCanvasToRenderTarget in construction scripts, since they don't work in game. Blutilities can be used to do blueprint rendering in the editor.
Change 3075241 on 2016/08/03 by Rolando.Caloca
DR - Fix linux compile issue & static analysis warning
Change 3075746 on 2016/08/03 by Daniel.Wright
Removed bOverride_AntiAliasingMethod and outdated ini references to PP AntiAliasingMethod
Change 3075783 on 2016/08/03 by Ryan.Brucks
#code.review Marcus.Wassmer
Added two material nodes that return Atmospheric Light Vector and Light Direction using:
View.AtmosphericFogSunColor
View.AtmosphericFogSunDirection
Nodes are called:
AtmosphericLightVector
AtmosphericLightColor
Also changed SceneRendering.cpp so that values will be grabbed from directional lights without needing an Atmospheric Fog actor in the scene.
Change 3075969 on 2016/08/03 by Uriel.Doyon
Material GUIDs are not updated anymore when parents or textures change.
Lighting now uses a hash built from the list of parents, textures and shader functions.
#review-3072980 @marcus.wassmer @daniel.wright
Change 3076116 on 2016/08/03 by Ryan.Brucks
#code.review marcus.wassmer
Fixed typo in the Caption of new Nodes "Atmospheric Light Vector" and "Atmospheric Light Color"
Change 3076456 on 2016/08/03 by Rolando.Caloca
DR - Fix geometry shader gl_Layer for SPIR-V
Change 3076730 on 2016/08/03 by Uriel.Doyon
Added user warning logic for the texture streaming build. Ran in MapCheck, BeginPlay and PreSave.
#review-3072984 @marcus.wassmer
Change 3077616 on 2016/08/04 by Daniel.Wright
Planar reflection show flags can now be edited
Change 3077621 on 2016/08/04 by Daniel.Wright
Changed default Planar Reflection DistanceFromPlaneFadeoutEnd from 600 to 100, which reduces artifacts and is a more intuitive initial setting
Change 3077792 on 2016/08/04 by Daniel.Wright
Fixed an unnecessary sky capture caused by the sky light component owned by the default ASkyLight
Change 3077799 on 2016/08/04 by Daniel.Wright
Skip RF_ArchetypeObject for reflection captures
Change 3077876 on 2016/08/04 by Marc.Olano
Noise material perf improvements
Change random number generator for Gradient-ALU (1.7x perf boost), improve speed of Voronoi noise quality level 3.
Removes integer BBS random number generators. Fewer instructions, but too slow to use (see 1.7x perf boost above)
Change 3077884 on 2016/08/04 by Daniel.Wright
Lighting channels can now be edited on components with static mobility, since dynamic lights can still affect them
Change 3078994 on 2016/08/05 by Simon.Tovey
Fix for UE-34241
Scene proxy ptr was being cached during a downcast.
Inside a call to CreateDynamicData, CheckMaterialUsage_Concurrent() was causing the scene proxy to be recreated an so the cached ptr was stale.
I've fixed the immediate issue but recreating the scene proxy here doesn't seem great. Maybe CheckMaterailUsage() should be rethought a bit.
Change 3079162 on 2016/08/05 by Ben.Woodhouse
Fix for jittering in Paper2D. Was caused by override being ignored due to a change in intiialization order for AA settings.
#jira UE-34091
Change 3079613 on 2016/08/05 by Daniel.Wright
New blueprint function ClearRenderTarget2D, which is the only way to set a render target alpha directly
New blueprint function CreateRenderTarget2D
Change 3079708 on 2016/08/05 by Uriel.Doyon
Fixed crash when building texture streaming on some levels.
Change 3079795 on 2016/08/05 by Uriel.Doyon
Fixed issue with instanced static meshes when building texture streaming.
Fixed typo with func "GetNumTextureStreamingPrimitives"
Change 3079806 on 2016/08/05 by Uriel.Doyon
Enabled PerTexture MipBias. The per texture mip bias now resets to 0 when the texture gets required at low resolution.
New scalability setting named "r.Streaming.LimitPoolSizeToVRAM" enabling the PoolSize to be limited the available VRAM
(according to GPoolSizeVRAMPercentage)
#review-3074662 @marcus.wassmer
Change 3082698 on 2016/08/09 by Daniel.Wright
Copy - CreateRenderTarget2D uses a world context object as owner, allows use in a construction script
Change 3082699 on 2016/08/09 by Daniel.Wright
Changed display name for 'Two Sided' shading model to 'Two Sided Foliage' to make it clear what it's intended to be used for
Change 3083909 on 2016/08/10 by Olaf.Piesche
#jira UE-34106
#jira UE-32784
#jira UE-31198
Reset vertex factories on mesh emitters if mesh has been reimported (if mesh package is dirty)
Change 3084645 on 2016/08/10 by Olaf.Piesche
#jira UE-30398
Fix offset added to particle collision locations.
Change 3084709 on 2016/08/10 by Daniel.Wright
Copy - Scene capture alpha is now inverted to match DrawMaterialToRenderTarget, and to allow compositing with existing render target contents
Added CompositeMode to SceneCapture2D, which can be used to addively accumulate or composite instead of the default overwrite behavior
Added bCaptureOnMovement to SceneCapture, which can be disabled so the only source of scene capturing is a manual capture by calling CaptureScene()
Change 3084783 on 2016/08/10 by Rolando.Caloca
DR - Use the first targeted rhi shader platform as the initial RHI to load on Windows
#jira UE-34510
Change 3084958 on 2016/08/10 by Daniel.Wright
Copy - Reverted cl 2938543 "Lightmass now respects owner bHidden, and bCastHiddenShadow" because it did not have backwards compatibility so breaks content using hidden light cards
Change 3086023 on 2016/08/11 by Marcus.Wassmer
Merging //UE4/Dev-Main@3085468 to Dev-Rendering (//UE4/Dev-Rendering)
#test none
Change 3086778 on 2016/08/11 by Ben.Woodhouse
Workaround for fortnite character rendering issue. Enable checkerboard rendering by default until we can fix properly
#jira UE-34561
Change 3087404 on 2016/08/12 by Rolando.Caloca
DR - Upgrade glslang to 1.0.21.1
- Added some more debug output
Change 3087524 on 2016/08/12 by Rolando.Caloca
DR - vk - Fixed StencilRef, fixed size of RHIReadSurfaceFloatData (but still returns dummy data)
Change 3087663 on 2016/08/12 by Rolando.Caloca
DR - vk - Fix for SRGB; support for mip texture views
Change 3087735 on 2016/08/12 by Daniel.Wright
TextureRenderTarget2D's can now be up to 8192^2. Anything over 2048 pops up an 'are you sure' dialog.
Change 3087750 on 2016/08/12 by Rolando.Caloca
DR - vk - Minor renaming in prep for merge
Change 3087813 on 2016/08/12 by Rolando.Caloca
DR - vk - More minor cleanup
Change 3087819 on 2016/08/12 by Chris.Bunner
Check material function input types directly, no need to traverse connected graph.
#jira UE-32134
Change 3087901 on 2016/08/12 by Rolando.Caloca
DR - vk - Fix RT view to use 1 mip
Fix depth buffer component swizzle
Change 3088193 on 2016/08/12 by Daniel.Wright
DFAO and RTDF shadows are enabled in High and Epic scalability settings by default
Change 3088988 on 2016/08/15 by Rolando.Caloca
DR - Add Accessors
Change 3089104 on 2016/08/15 by Olaf.Piesche
#jira UE-34241
Sceneproxy can be nullptr in FDynamicMeshEmitterData::Init if the proxy is being recreated
Change 3089208 on 2016/08/15 by Daniel.Wright
Downsampled separate translucency uses a separate view uniform buffer with correct buffer sizes
* Fixes WorldPosition in downsampled translucency
* View uniform buffer parameters are now cached on the view, to allow recreating the uniform buffer without having to rebuild the entire struct. Currently used by global distance field, downsampled separate translucency.
* Fixed the downsampled translucency depth buffer being full res used together with a smaller color target, now they are both the downsampled res
Change 3089209 on 2016/08/15 by Daniel.Wright
Fixed atmospheric fog on translucency
Change 3089457 on 2016/08/15 by Daniel.Wright
Fixed lighting build failure from UMaterialInstanceDynamic assigned to a mesh that's being exported to Lightmass. The Swarm cache entry is created using the parent's guid, causing multiple MID's with the same parent to acquire a file handle multiple times which fails after the first.
Change 3089549 on 2016/08/15 by Daniel.Wright
UMaterialInterface initializes LightingGuid to something valid - causes UMaterialInstanceDynamic to have a valid LightingGuid so they can be used in lighting builds
Change 3089703 on 2016/08/15 by Daniel.Wright
Custom expression fixup for View.RenderTargetSize
Change 3090546 on 2016/08/16 by Daniel.Wright
Hopeful fix for recycled snapshot view crash
Change 3091202 on 2016/08/16 by Daniel.Wright
Manually clear FViewInfo::CachedViewUniformShaderParameters on creating a snapshot, since memcpy is used to create the snapshot view
[CL 3091931 by Gil Gribb in Main branch]
2016-08-17 11:38:13 -04:00
{
2019-06-11 18:27:07 -04:00
const float Radius = GetSubsurfaceRadiusScale ( ) ;
const bool bShowSubsurfaceScattering = Radius > 0 & & View . Family - > EngineShowFlags . SubsurfaceScattering ;
if ( bShowSubsurfaceScattering )
{
const bool bHalfRes = CVarSSSHalfRes . GetValueOnRenderThread ( ) ! = 0 ;
if ( bHalfRes )
{
return ESubsurfaceMode : : HalfRes ;
}
else
{
return ESubsurfaceMode : : FullRes ;
}
}
else
{
return ESubsurfaceMode : : Bypass ;
}
}
2019-08-13 17:16:21 -04:00
// A shader parameter struct for a single subsurface input texture.
BEGIN_SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , )
2019-08-19 13:27:06 -04:00
SHADER_PARAMETER_STRUCT_INCLUDE ( FScreenPassTextureViewportParameters , Viewport )
SHADER_PARAMETER_RDG_TEXTURE ( Texture2D , Texture )
2019-08-13 17:16:21 -04:00
END_SHADER_PARAMETER_STRUCT ( )
BEGIN_SHADER_PARAMETER_STRUCT ( FSubsurfaceSRVInput , )
2019-08-19 13:27:06 -04:00
SHADER_PARAMETER_STRUCT_INCLUDE ( FScreenPassTextureViewportParameters , Viewport )
SHADER_PARAMETER_RDG_TEXTURE_SRV ( Texture2D , Texture )
2019-08-13 17:16:21 -04:00
END_SHADER_PARAMETER_STRUCT ( ) ;
// Set of common shader parameters shared by all subsurface shaders.
BEGIN_SHADER_PARAMETER_STRUCT ( FSubsurfaceParameters , )
2021-09-22 10:01:48 -04:00
SHADER_PARAMETER ( FVector4f , SubsurfaceParams )
2020-09-24 00:43:27 -04:00
SHADER_PARAMETER_RDG_UNIFORM_BUFFER ( FSceneTextureUniformParameters , SceneTextures )
2019-08-19 13:27:06 -04:00
SHADER_PARAMETER_STRUCT_REF ( FViewUniformShaderParameters , ViewUniformBuffer )
2019-08-13 17:16:21 -04:00
END_SHADER_PARAMETER_STRUCT ( )
2020-09-24 00:43:27 -04:00
FSubsurfaceParameters GetSubsurfaceCommonParameters ( FRDGBuilder & GraphBuilder , const FViewInfo & View , TRDGUniformBufferRef < FSceneTextureUniformParameters > SceneTextures )
2019-08-13 17:16:21 -04:00
{
const float DistanceToProjectionWindow = View . ViewMatrices . GetProjectionMatrix ( ) . M [ 0 ] [ 0 ] ;
const float SSSScaleZ = DistanceToProjectionWindow * GetSubsurfaceRadiusScale ( ) ;
const float SSSScaleX = SSSScaleZ / SUBSURFACE_KERNEL_SIZE * 0.5f ;
2020-02-12 13:27:19 -05:00
const float SSSOverrideNumSamples = float ( CVarSSSBurleyNumSamplesOverride . GetValueOnRenderThread ( ) ) ;
2021-10-29 12:53:33 -04:00
const float MinGenerateMipsTileCount = FMath : : Max ( 0.0f , CVarSSSMipmapsMinTileCount . GetValueOnRenderThread ( ) ) ;
2020-02-12 13:27:19 -05:00
2019-08-13 17:16:21 -04:00
FSubsurfaceParameters Parameters ;
2021-10-29 12:53:33 -04:00
Parameters . SubsurfaceParams = FVector4f ( SSSScaleX , SSSScaleZ , SSSOverrideNumSamples , MinGenerateMipsTileCount ) ;
2019-08-13 17:16:21 -04:00
Parameters . ViewUniformBuffer = View . ViewUniformBuffer ;
2020-09-24 00:43:27 -04:00
Parameters . SceneTextures = SceneTextures ;
2019-08-13 17:16:21 -04:00
return Parameters ;
}
FSubsurfaceInput GetSubsurfaceInput ( FRDGTextureRef Texture , const FScreenPassTextureViewportParameters & ViewportParameters )
{
FSubsurfaceInput Input ;
Input . Texture = Texture ;
Input . Viewport = ViewportParameters ;
return Input ;
}
FSubsurfaceSRVInput GetSubsurfaceSRVInput ( FRDGTextureSRVRef Texture , const FScreenPassTextureViewportParameters & ViewportParameters )
{
FSubsurfaceSRVInput Input ;
Input . Texture = Texture ;
Input . Viewport = ViewportParameters ;
return Input ;
2019-04-01 19:37:48 -04:00
}
2019-06-11 18:27:07 -04:00
bool IsSubsurfaceEnabled ( )
{
const bool bEnabled = CVarSubsurfaceScattering . GetValueOnAnyThread ( ) ! = 0 ;
const bool bHasScale = CVarSSSScale . GetValueOnAnyThread ( ) > 0.0f ;
return ( bEnabled & & bHasScale ) ;
}
bool IsSubsurfaceRequiredForView ( const FViewInfo & View )
{
const bool bSimpleDynamicLighting = IsAnyForwardShadingEnabled ( View . GetShaderPlatform ( ) ) ;
const bool bSubsurfaceEnabled = IsSubsurfaceEnabled ( ) ;
const bool bViewHasSubsurfaceMaterials = ( ( View . ShadingModelMaskInView & GetUseSubsurfaceProfileShadingModelMask ( ) ) ! = 0 ) ;
return ( bSubsurfaceEnabled & & bViewHasSubsurfaceMaterials & & ! bSimpleDynamicLighting ) ;
}
2020-09-24 00:43:27 -04:00
bool IsProfileIdCacheEnabled ( )
{
2021-12-16 19:29:23 -05:00
return RHIIsTypedUAVLoadSupported ( PF_R8_UINT ) & & CVarSSSBurleyEnableProfileIdCache . GetValueOnRenderThread ( ) ! = 0 ;
2020-09-24 00:43:27 -04:00
}
uint32 GetSubsurfaceRequiredViewMask ( TArrayView < const FViewInfo > Views )
2019-06-11 18:27:07 -04:00
{
const uint32 ViewCount = Views . Num ( ) ;
uint32 ViewMask = 0 ;
// Traverse the views to make sure we only process subsurface if requested by any view.
for ( uint32 ViewIndex = 0 ; ViewIndex < ViewCount ; + + ViewIndex )
{
const FViewInfo & View = Views [ ViewIndex ] ;
if ( IsSubsurfaceRequiredForView ( View ) )
{
const uint32 ViewBit = 1 < < ViewIndex ;
ViewMask | = ViewBit ;
}
}
return ViewMask ;
}
bool IsSubsurfaceCheckerboardFormat ( EPixelFormat SceneColorFormat )
{
2022-03-15 03:11:08 -04:00
if ( Strata : : IsStrataOpaqueMaterialRoughRefractionEnabled ( ) )
{
// With this mode, specular and subsurface colors are correctly separated so checkboard is not required.
return false ;
}
2019-06-11 18:27:07 -04:00
int CVarValue = CVarSSSCheckerboard . GetValueOnRenderThread ( ) ;
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3091903)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3072947 on 2016/08/01 by Uriel.Doyon
Texture GUIDs are now included in cooked builds, as they are required by the texture streamer to link build data to in game texture.
#review-3072934 @marcus.wassmer
#jira UE-34045
Change 3073301 on 2016/08/02 by Ben.Woodhouse
Fix for large spotlight culling precision issues, reported on UDN by Aaron Jacobs at Double Fine. For a full description, see the UDN post
https://udn.unrealengine.com/questions/305440/shadowed-light-flicker-caused-by-floating-point-pr.html
#jira UE-34052
Change 3073689 on 2016/08/02 by Ben.Woodhouse
Improved skin postprocess - support for full resolution, with diffuse/spec lighting combined into single RGBA (sharing chroma)
Full res lighting gives less temporal AA flickering, sharper diffuse and specular lighting in the surface (since this is now at full resolution), faster postprocessing if using a 64-bit rendertarget (on NV 980Ti).
Checkerboard rendering is controlled via the r.sss.checkerboard cvar. - 0 is off/full res, 1 is checkerboard, 2 is automatic based on scenecolor (non-checkerboard requires 64bit or more rendertarget w/separate alpha)
Tested/profiled on PC, PS4
Change 3074666 on 2016/08/02 by Daniel.Wright
Fixed stationary skylight brightness
Change 3074667 on 2016/08/02 by Daniel.Wright
Fixed r.ReflectionEnvironmentLightmapMixing
Change 3074687 on 2016/08/02 by Daniel.Wright
Disallowed DrawMaterialToRenderTarget and Begin/EndDrawCanvasToRenderTarget in construction scripts, since they don't work in game. Blutilities can be used to do blueprint rendering in the editor.
Change 3075241 on 2016/08/03 by Rolando.Caloca
DR - Fix linux compile issue & static analysis warning
Change 3075746 on 2016/08/03 by Daniel.Wright
Removed bOverride_AntiAliasingMethod and outdated ini references to PP AntiAliasingMethod
Change 3075783 on 2016/08/03 by Ryan.Brucks
#code.review Marcus.Wassmer
Added two material nodes that return Atmospheric Light Vector and Light Direction using:
View.AtmosphericFogSunColor
View.AtmosphericFogSunDirection
Nodes are called:
AtmosphericLightVector
AtmosphericLightColor
Also changed SceneRendering.cpp so that values will be grabbed from directional lights without needing an Atmospheric Fog actor in the scene.
Change 3075969 on 2016/08/03 by Uriel.Doyon
Material GUIDs are not updated anymore when parents or textures change.
Lighting now uses a hash built from the list of parents, textures and shader functions.
#review-3072980 @marcus.wassmer @daniel.wright
Change 3076116 on 2016/08/03 by Ryan.Brucks
#code.review marcus.wassmer
Fixed typo in the Caption of new Nodes "Atmospheric Light Vector" and "Atmospheric Light Color"
Change 3076456 on 2016/08/03 by Rolando.Caloca
DR - Fix geometry shader gl_Layer for SPIR-V
Change 3076730 on 2016/08/03 by Uriel.Doyon
Added user warning logic for the texture streaming build. Ran in MapCheck, BeginPlay and PreSave.
#review-3072984 @marcus.wassmer
Change 3077616 on 2016/08/04 by Daniel.Wright
Planar reflection show flags can now be edited
Change 3077621 on 2016/08/04 by Daniel.Wright
Changed default Planar Reflection DistanceFromPlaneFadeoutEnd from 600 to 100, which reduces artifacts and is a more intuitive initial setting
Change 3077792 on 2016/08/04 by Daniel.Wright
Fixed an unnecessary sky capture caused by the sky light component owned by the default ASkyLight
Change 3077799 on 2016/08/04 by Daniel.Wright
Skip RF_ArchetypeObject for reflection captures
Change 3077876 on 2016/08/04 by Marc.Olano
Noise material perf improvements
Change random number generator for Gradient-ALU (1.7x perf boost), improve speed of Voronoi noise quality level 3.
Removes integer BBS random number generators. Fewer instructions, but too slow to use (see 1.7x perf boost above)
Change 3077884 on 2016/08/04 by Daniel.Wright
Lighting channels can now be edited on components with static mobility, since dynamic lights can still affect them
Change 3078994 on 2016/08/05 by Simon.Tovey
Fix for UE-34241
Scene proxy ptr was being cached during a downcast.
Inside a call to CreateDynamicData, CheckMaterialUsage_Concurrent() was causing the scene proxy to be recreated an so the cached ptr was stale.
I've fixed the immediate issue but recreating the scene proxy here doesn't seem great. Maybe CheckMaterailUsage() should be rethought a bit.
Change 3079162 on 2016/08/05 by Ben.Woodhouse
Fix for jittering in Paper2D. Was caused by override being ignored due to a change in intiialization order for AA settings.
#jira UE-34091
Change 3079613 on 2016/08/05 by Daniel.Wright
New blueprint function ClearRenderTarget2D, which is the only way to set a render target alpha directly
New blueprint function CreateRenderTarget2D
Change 3079708 on 2016/08/05 by Uriel.Doyon
Fixed crash when building texture streaming on some levels.
Change 3079795 on 2016/08/05 by Uriel.Doyon
Fixed issue with instanced static meshes when building texture streaming.
Fixed typo with func "GetNumTextureStreamingPrimitives"
Change 3079806 on 2016/08/05 by Uriel.Doyon
Enabled PerTexture MipBias. The per texture mip bias now resets to 0 when the texture gets required at low resolution.
New scalability setting named "r.Streaming.LimitPoolSizeToVRAM" enabling the PoolSize to be limited the available VRAM
(according to GPoolSizeVRAMPercentage)
#review-3074662 @marcus.wassmer
Change 3082698 on 2016/08/09 by Daniel.Wright
Copy - CreateRenderTarget2D uses a world context object as owner, allows use in a construction script
Change 3082699 on 2016/08/09 by Daniel.Wright
Changed display name for 'Two Sided' shading model to 'Two Sided Foliage' to make it clear what it's intended to be used for
Change 3083909 on 2016/08/10 by Olaf.Piesche
#jira UE-34106
#jira UE-32784
#jira UE-31198
Reset vertex factories on mesh emitters if mesh has been reimported (if mesh package is dirty)
Change 3084645 on 2016/08/10 by Olaf.Piesche
#jira UE-30398
Fix offset added to particle collision locations.
Change 3084709 on 2016/08/10 by Daniel.Wright
Copy - Scene capture alpha is now inverted to match DrawMaterialToRenderTarget, and to allow compositing with existing render target contents
Added CompositeMode to SceneCapture2D, which can be used to addively accumulate or composite instead of the default overwrite behavior
Added bCaptureOnMovement to SceneCapture, which can be disabled so the only source of scene capturing is a manual capture by calling CaptureScene()
Change 3084783 on 2016/08/10 by Rolando.Caloca
DR - Use the first targeted rhi shader platform as the initial RHI to load on Windows
#jira UE-34510
Change 3084958 on 2016/08/10 by Daniel.Wright
Copy - Reverted cl 2938543 "Lightmass now respects owner bHidden, and bCastHiddenShadow" because it did not have backwards compatibility so breaks content using hidden light cards
Change 3086023 on 2016/08/11 by Marcus.Wassmer
Merging //UE4/Dev-Main@3085468 to Dev-Rendering (//UE4/Dev-Rendering)
#test none
Change 3086778 on 2016/08/11 by Ben.Woodhouse
Workaround for fortnite character rendering issue. Enable checkerboard rendering by default until we can fix properly
#jira UE-34561
Change 3087404 on 2016/08/12 by Rolando.Caloca
DR - Upgrade glslang to 1.0.21.1
- Added some more debug output
Change 3087524 on 2016/08/12 by Rolando.Caloca
DR - vk - Fixed StencilRef, fixed size of RHIReadSurfaceFloatData (but still returns dummy data)
Change 3087663 on 2016/08/12 by Rolando.Caloca
DR - vk - Fix for SRGB; support for mip texture views
Change 3087735 on 2016/08/12 by Daniel.Wright
TextureRenderTarget2D's can now be up to 8192^2. Anything over 2048 pops up an 'are you sure' dialog.
Change 3087750 on 2016/08/12 by Rolando.Caloca
DR - vk - Minor renaming in prep for merge
Change 3087813 on 2016/08/12 by Rolando.Caloca
DR - vk - More minor cleanup
Change 3087819 on 2016/08/12 by Chris.Bunner
Check material function input types directly, no need to traverse connected graph.
#jira UE-32134
Change 3087901 on 2016/08/12 by Rolando.Caloca
DR - vk - Fix RT view to use 1 mip
Fix depth buffer component swizzle
Change 3088193 on 2016/08/12 by Daniel.Wright
DFAO and RTDF shadows are enabled in High and Epic scalability settings by default
Change 3088988 on 2016/08/15 by Rolando.Caloca
DR - Add Accessors
Change 3089104 on 2016/08/15 by Olaf.Piesche
#jira UE-34241
Sceneproxy can be nullptr in FDynamicMeshEmitterData::Init if the proxy is being recreated
Change 3089208 on 2016/08/15 by Daniel.Wright
Downsampled separate translucency uses a separate view uniform buffer with correct buffer sizes
* Fixes WorldPosition in downsampled translucency
* View uniform buffer parameters are now cached on the view, to allow recreating the uniform buffer without having to rebuild the entire struct. Currently used by global distance field, downsampled separate translucency.
* Fixed the downsampled translucency depth buffer being full res used together with a smaller color target, now they are both the downsampled res
Change 3089209 on 2016/08/15 by Daniel.Wright
Fixed atmospheric fog on translucency
Change 3089457 on 2016/08/15 by Daniel.Wright
Fixed lighting build failure from UMaterialInstanceDynamic assigned to a mesh that's being exported to Lightmass. The Swarm cache entry is created using the parent's guid, causing multiple MID's with the same parent to acquire a file handle multiple times which fails after the first.
Change 3089549 on 2016/08/15 by Daniel.Wright
UMaterialInterface initializes LightingGuid to something valid - causes UMaterialInstanceDynamic to have a valid LightingGuid so they can be used in lighting builds
Change 3089703 on 2016/08/15 by Daniel.Wright
Custom expression fixup for View.RenderTargetSize
Change 3090546 on 2016/08/16 by Daniel.Wright
Hopeful fix for recycled snapshot view crash
Change 3091202 on 2016/08/16 by Daniel.Wright
Manually clear FViewInfo::CachedViewUniformShaderParameters on creating a snapshot, since memcpy is used to create the snapshot view
[CL 3091931 by Gil Gribb in Main branch]
2016-08-17 11:38:13 -04:00
if ( CVarValue = = 0 )
{
return false ;
}
2019-06-11 18:27:07 -04:00
else if ( CVarValue = = 1 )
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3091903)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3072947 on 2016/08/01 by Uriel.Doyon
Texture GUIDs are now included in cooked builds, as they are required by the texture streamer to link build data to in game texture.
#review-3072934 @marcus.wassmer
#jira UE-34045
Change 3073301 on 2016/08/02 by Ben.Woodhouse
Fix for large spotlight culling precision issues, reported on UDN by Aaron Jacobs at Double Fine. For a full description, see the UDN post
https://udn.unrealengine.com/questions/305440/shadowed-light-flicker-caused-by-floating-point-pr.html
#jira UE-34052
Change 3073689 on 2016/08/02 by Ben.Woodhouse
Improved skin postprocess - support for full resolution, with diffuse/spec lighting combined into single RGBA (sharing chroma)
Full res lighting gives less temporal AA flickering, sharper diffuse and specular lighting in the surface (since this is now at full resolution), faster postprocessing if using a 64-bit rendertarget (on NV 980Ti).
Checkerboard rendering is controlled via the r.sss.checkerboard cvar. - 0 is off/full res, 1 is checkerboard, 2 is automatic based on scenecolor (non-checkerboard requires 64bit or more rendertarget w/separate alpha)
Tested/profiled on PC, PS4
Change 3074666 on 2016/08/02 by Daniel.Wright
Fixed stationary skylight brightness
Change 3074667 on 2016/08/02 by Daniel.Wright
Fixed r.ReflectionEnvironmentLightmapMixing
Change 3074687 on 2016/08/02 by Daniel.Wright
Disallowed DrawMaterialToRenderTarget and Begin/EndDrawCanvasToRenderTarget in construction scripts, since they don't work in game. Blutilities can be used to do blueprint rendering in the editor.
Change 3075241 on 2016/08/03 by Rolando.Caloca
DR - Fix linux compile issue & static analysis warning
Change 3075746 on 2016/08/03 by Daniel.Wright
Removed bOverride_AntiAliasingMethod and outdated ini references to PP AntiAliasingMethod
Change 3075783 on 2016/08/03 by Ryan.Brucks
#code.review Marcus.Wassmer
Added two material nodes that return Atmospheric Light Vector and Light Direction using:
View.AtmosphericFogSunColor
View.AtmosphericFogSunDirection
Nodes are called:
AtmosphericLightVector
AtmosphericLightColor
Also changed SceneRendering.cpp so that values will be grabbed from directional lights without needing an Atmospheric Fog actor in the scene.
Change 3075969 on 2016/08/03 by Uriel.Doyon
Material GUIDs are not updated anymore when parents or textures change.
Lighting now uses a hash built from the list of parents, textures and shader functions.
#review-3072980 @marcus.wassmer @daniel.wright
Change 3076116 on 2016/08/03 by Ryan.Brucks
#code.review marcus.wassmer
Fixed typo in the Caption of new Nodes "Atmospheric Light Vector" and "Atmospheric Light Color"
Change 3076456 on 2016/08/03 by Rolando.Caloca
DR - Fix geometry shader gl_Layer for SPIR-V
Change 3076730 on 2016/08/03 by Uriel.Doyon
Added user warning logic for the texture streaming build. Ran in MapCheck, BeginPlay and PreSave.
#review-3072984 @marcus.wassmer
Change 3077616 on 2016/08/04 by Daniel.Wright
Planar reflection show flags can now be edited
Change 3077621 on 2016/08/04 by Daniel.Wright
Changed default Planar Reflection DistanceFromPlaneFadeoutEnd from 600 to 100, which reduces artifacts and is a more intuitive initial setting
Change 3077792 on 2016/08/04 by Daniel.Wright
Fixed an unnecessary sky capture caused by the sky light component owned by the default ASkyLight
Change 3077799 on 2016/08/04 by Daniel.Wright
Skip RF_ArchetypeObject for reflection captures
Change 3077876 on 2016/08/04 by Marc.Olano
Noise material perf improvements
Change random number generator for Gradient-ALU (1.7x perf boost), improve speed of Voronoi noise quality level 3.
Removes integer BBS random number generators. Fewer instructions, but too slow to use (see 1.7x perf boost above)
Change 3077884 on 2016/08/04 by Daniel.Wright
Lighting channels can now be edited on components with static mobility, since dynamic lights can still affect them
Change 3078994 on 2016/08/05 by Simon.Tovey
Fix for UE-34241
Scene proxy ptr was being cached during a downcast.
Inside a call to CreateDynamicData, CheckMaterialUsage_Concurrent() was causing the scene proxy to be recreated an so the cached ptr was stale.
I've fixed the immediate issue but recreating the scene proxy here doesn't seem great. Maybe CheckMaterailUsage() should be rethought a bit.
Change 3079162 on 2016/08/05 by Ben.Woodhouse
Fix for jittering in Paper2D. Was caused by override being ignored due to a change in intiialization order for AA settings.
#jira UE-34091
Change 3079613 on 2016/08/05 by Daniel.Wright
New blueprint function ClearRenderTarget2D, which is the only way to set a render target alpha directly
New blueprint function CreateRenderTarget2D
Change 3079708 on 2016/08/05 by Uriel.Doyon
Fixed crash when building texture streaming on some levels.
Change 3079795 on 2016/08/05 by Uriel.Doyon
Fixed issue with instanced static meshes when building texture streaming.
Fixed typo with func "GetNumTextureStreamingPrimitives"
Change 3079806 on 2016/08/05 by Uriel.Doyon
Enabled PerTexture MipBias. The per texture mip bias now resets to 0 when the texture gets required at low resolution.
New scalability setting named "r.Streaming.LimitPoolSizeToVRAM" enabling the PoolSize to be limited the available VRAM
(according to GPoolSizeVRAMPercentage)
#review-3074662 @marcus.wassmer
Change 3082698 on 2016/08/09 by Daniel.Wright
Copy - CreateRenderTarget2D uses a world context object as owner, allows use in a construction script
Change 3082699 on 2016/08/09 by Daniel.Wright
Changed display name for 'Two Sided' shading model to 'Two Sided Foliage' to make it clear what it's intended to be used for
Change 3083909 on 2016/08/10 by Olaf.Piesche
#jira UE-34106
#jira UE-32784
#jira UE-31198
Reset vertex factories on mesh emitters if mesh has been reimported (if mesh package is dirty)
Change 3084645 on 2016/08/10 by Olaf.Piesche
#jira UE-30398
Fix offset added to particle collision locations.
Change 3084709 on 2016/08/10 by Daniel.Wright
Copy - Scene capture alpha is now inverted to match DrawMaterialToRenderTarget, and to allow compositing with existing render target contents
Added CompositeMode to SceneCapture2D, which can be used to addively accumulate or composite instead of the default overwrite behavior
Added bCaptureOnMovement to SceneCapture, which can be disabled so the only source of scene capturing is a manual capture by calling CaptureScene()
Change 3084783 on 2016/08/10 by Rolando.Caloca
DR - Use the first targeted rhi shader platform as the initial RHI to load on Windows
#jira UE-34510
Change 3084958 on 2016/08/10 by Daniel.Wright
Copy - Reverted cl 2938543 "Lightmass now respects owner bHidden, and bCastHiddenShadow" because it did not have backwards compatibility so breaks content using hidden light cards
Change 3086023 on 2016/08/11 by Marcus.Wassmer
Merging //UE4/Dev-Main@3085468 to Dev-Rendering (//UE4/Dev-Rendering)
#test none
Change 3086778 on 2016/08/11 by Ben.Woodhouse
Workaround for fortnite character rendering issue. Enable checkerboard rendering by default until we can fix properly
#jira UE-34561
Change 3087404 on 2016/08/12 by Rolando.Caloca
DR - Upgrade glslang to 1.0.21.1
- Added some more debug output
Change 3087524 on 2016/08/12 by Rolando.Caloca
DR - vk - Fixed StencilRef, fixed size of RHIReadSurfaceFloatData (but still returns dummy data)
Change 3087663 on 2016/08/12 by Rolando.Caloca
DR - vk - Fix for SRGB; support for mip texture views
Change 3087735 on 2016/08/12 by Daniel.Wright
TextureRenderTarget2D's can now be up to 8192^2. Anything over 2048 pops up an 'are you sure' dialog.
Change 3087750 on 2016/08/12 by Rolando.Caloca
DR - vk - Minor renaming in prep for merge
Change 3087813 on 2016/08/12 by Rolando.Caloca
DR - vk - More minor cleanup
Change 3087819 on 2016/08/12 by Chris.Bunner
Check material function input types directly, no need to traverse connected graph.
#jira UE-32134
Change 3087901 on 2016/08/12 by Rolando.Caloca
DR - vk - Fix RT view to use 1 mip
Fix depth buffer component swizzle
Change 3088193 on 2016/08/12 by Daniel.Wright
DFAO and RTDF shadows are enabled in High and Epic scalability settings by default
Change 3088988 on 2016/08/15 by Rolando.Caloca
DR - Add Accessors
Change 3089104 on 2016/08/15 by Olaf.Piesche
#jira UE-34241
Sceneproxy can be nullptr in FDynamicMeshEmitterData::Init if the proxy is being recreated
Change 3089208 on 2016/08/15 by Daniel.Wright
Downsampled separate translucency uses a separate view uniform buffer with correct buffer sizes
* Fixes WorldPosition in downsampled translucency
* View uniform buffer parameters are now cached on the view, to allow recreating the uniform buffer without having to rebuild the entire struct. Currently used by global distance field, downsampled separate translucency.
* Fixed the downsampled translucency depth buffer being full res used together with a smaller color target, now they are both the downsampled res
Change 3089209 on 2016/08/15 by Daniel.Wright
Fixed atmospheric fog on translucency
Change 3089457 on 2016/08/15 by Daniel.Wright
Fixed lighting build failure from UMaterialInstanceDynamic assigned to a mesh that's being exported to Lightmass. The Swarm cache entry is created using the parent's guid, causing multiple MID's with the same parent to acquire a file handle multiple times which fails after the first.
Change 3089549 on 2016/08/15 by Daniel.Wright
UMaterialInterface initializes LightingGuid to something valid - causes UMaterialInstanceDynamic to have a valid LightingGuid so they can be used in lighting builds
Change 3089703 on 2016/08/15 by Daniel.Wright
Custom expression fixup for View.RenderTargetSize
Change 3090546 on 2016/08/16 by Daniel.Wright
Hopeful fix for recycled snapshot view crash
Change 3091202 on 2016/08/16 by Daniel.Wright
Manually clear FViewInfo::CachedViewUniformShaderParameters on creating a snapshot, since memcpy is used to create the snapshot view
[CL 3091931 by Gil Gribb in Main branch]
2016-08-17 11:38:13 -04:00
{
return true ;
}
else if ( CVarValue = = 2 )
{
switch ( SceneColorFormat )
{
case PF_A32B32G32R32F :
case PF_FloatRGBA :
return false ;
default :
return true ;
}
}
return true ;
}
2019-06-11 18:27:07 -04:00
// Base class for a subsurface shader.
class FSubsurfaceShader : public FGlobalShader
2014-10-15 16:18:43 -04:00
{
public :
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3809756)
#rb None
#lockdown Nick.Penwarden
============================
MAJOR FEATURES & CHANGES
============================
Change 3629223 by Rolando.Caloca
DR - Rollback //UE4/Dev-Rendering/Engine/Source/Runtime/VulkanRHI to changelist 3627847
Change 3629708 by Rolando.Caloca
DR - vk - Redo some changes from DevMobile
3601439
3604186
3606672
3617383
3617474
3617483
Change 3761370 by Arne.Schober
DR - Added CityHash to use with conatiners and stuff. It provides good performance and high quallity across multiple platforms.
Change 3761437 by Guillaume.Abadie
Optimises motion blur compute shader for consoles.
Change 3761483 by Guillaume.Abadie
Fixes D3D11 RHI lying to dynamic resolution heuristic with t.MaxFPS.
Change 3761995 by Mark.Satterthwaite
Add the Metal compiler path to the local .pch filename to avoid problems when Xcode moves.
Change 3761996 by Mark.Satterthwaite
Emit more details when a pixel shader is found to have no outputs at all which Metal doesn't permit. More likely this is a bug in the shader compiler not configuring the in-out mask correctly...
#jira UE-52292
Change 3761999 by Mark.Satterthwaite
No need to avoid tessellation for FMetalRHICommandContext::RHIEndDrawIndexedPrimitiveUP anymore - that was from back when the tessellation logic was replicated in each RHI*Draw* implementation.
#jira UE-51937
Change 3762181 by Joe.Graf
Changed MaxShaderJobBatchSize to 25 on Mac as it reduced shader compile time by 21%
Change 3762607 by Mark.Satterthwaite
Remove accidentally included changes from 3761995.
Change 3762612 by Mark.Satterthwaite
Enable the explicit sincos intrinsic for Metal to avoid instances of UE-52477 that can cause shaders to compile incorrectly through hlslcc.
#jira UE-52477
Change 3762772 by Michael.Lentine
Move RHI calls to render thread.
Change 3763021 by Richard.Wallis
Remove shader cache tool project and implementation.
#jira UE-51613
Change 3763082 by Guillaume.Abadie
More SceneTexture, SceneColor and SceneDepth automated tests
Change 3763111 by Richard.Wallis
Clone of CL 3763033 (Release-4.18):
Fix for crash upon launching packaged game on Mac with Share Material Shader Code enabled.
#jira UE-52121
Change 3763657 by Michael.Lentine
Invalidate ddc for skeletal mesh render data so that the duplicated vertex render structures are properly serialized.
Change 3763727 by Jian.Ru
Fix Player Collision view mode. It is caused by checking an uninitialized vertex buffer so the check always fail.
#jira UE-52052
Change 3763738 by Guillaume.Abadie
Implements SSR input post process material location.
Change 3764271 by Mark.Satterthwaite
Allow ControlPointPatch lists to flow through MetalRHI as it was setup to handle this transparently - the VSHS compute shader will convert them to triangles to draw. Report the same warning as in the pipeline creation stage as this hasn't been formally validated.
#jira UE-52454
Change 3764316 by Daniel.Wright
Added AVolumetricLightmapDensityVolume - gives local control over Volumetric Lightmap density. Dropping the top mip outside of the play area in Monolith saves 20Mb (35Mb original).
Volumetric Lightmap no longer refines around static translucent geometry - saves 5Mb in Monolith
Reworked brick culling by error mechanism. Now compares error to interpolated parent lighting instead of the brick average - prevents dropping constant value bricks which are near a wall and cause leaking due to parent interpolation after being culled.
Change 3764318 by Daniel.Wright
Missing file
Change 3764321 by Daniel.Wright
Shader compiling memory optimizations
* Editor memory: Sharing uniform buffer includes and GeneratedInstancedStereo.ush per FShaderType (was previously duplicated per FShader job)
* SCW input size: Sharing uniform buffer includes and SharedEnvironment per batch
* 7.6Gb of shader job inputs in memory -> .5Gb (13x less) when doing a full shader compile of Paragon Editor
* 13.8Gb written into worker input files -> 2.9Gb (4.7x less). Global shaders are never batched when sent to SCW so unoptimized by these changes.
Change 3764595 by Daniel.Wright
Added VolumetricLightmapDensityVolume asset icons
Change 3764701 by Michael.Lentine
Add duplicated vertices merging for meshmerge.
Change 3766002 by Guillaume.Abadie
Fixes a crash in translucency.
Change 3766007 by Guillaume.Abadie
Oups.... Fixes compilation failure.
Change 3766697 by Guillaume.Abadie
Giant refactor of global shader interface for upcoming native support of permutation.
CL generated by python script.
Change 3767205 by Chris.Bunner
Deferring FMaterial::RenderingThreadShaderMap update to render-thread rather than assumption commands have been flushed.
#jira UE-50652
Change 3767207 by Chris.Bunner
Clamp fetched texture coordinates to those available on the mesh.
Change 3767209 by Chris.Bunner
PR #4203: Early-outs in UMaterialInstance parameter setters (Contributed by stefanzimecki)
#jira UE-52193
Change 3767772 by Mark.Satterthwaite
MetalShaderFormat will no longer fallback to text shaders when you ask it to compile to bytecode but the bytecode compiler is not available (either locally or remotely) - this ensures that the DDC can't be poisoned by incorrectly configured clients. The Editor is already setup such that if the remote shader compiler is not configured & Xcode is not available locally the shader-compiler will be invoked to generate text shaders.
#jira UE-52554
Change 3768604 by Guillaume.Abadie
Polish up with new global shader function signature.
Change 3768993 by Guillaume.Abadie
Fixes r.Upscale.Panini cvars
Change 3769478 by Mark.Satterthwaite
Move the ue4_stdlib.metal & PCH into a temporary directory that exists for the lifetime of the SCW on the remote side as well as the local one and add this path as an include directory.
#jira UE-52587
Change 3769703 by Mark.Satterthwaite
For all Metal platforms >= Metal v1.2 transform mul(a,b) into fma(a,b,0) to prevent the Apple compiler reordering operations differently between the base & depth passes which results in variance in the position output.
For iOS disable fast-math when the vertex-shader uses World-Position-Offset because there are additional problems on the iOS shader compiler that result in position variance even with the above fix - WPO performance will suffer but I don't have any alternatives.
Remove the depth-offset hack from the depth-only vertex shader again.
#jira UES-5651
Change 3769763 by Mark.Satterthwaite
Handle swizzle's in the hlslcc fma identification pass so that we reduce the number of instructions and the platform compiler can't break the instructions up.
Change 3769849 by Mark.Satterthwaite
Fix CIS error.
Change 3770517 by Richard.Wallis
Fix for crash when creating a new media texture (AppleIntelHD5000GraphicsMTLDriver!SamplerStage::bindSamplerToTexture()). Missing texture resource for binding. Old InitDynamicRHI() code has been refactored out into seperate functions which leaves us on Mac with a NULL resource initially after creation which Metal doesn't like. This fix puts InitDynamicRHI down the default setup/clear path which inits default resources - I don't think we should use a global dummy in this instance as this is a render target.
#jira UE-51940
Change 3770688 by Uriel.Doyon
Fixed texture resolution returning 0 when running blueprint construction scripts at cook time.
Change 3771115 by Mark.Satterthwaite
Report errors from failed attempts to compile global shaders or we can't see why things fail on non-Windows platforms.
Change 3771263 by Mark.Satterthwaite
Change the way ManualVertexFetch is enabled on Metal platforms so that it is enabled when targeting Metal v1.2 and higher (macOS 10.12+/iOS 10+). This brings iOS in the Desktop Forward renderer back into line with the Mac.
#jira UERNDR-300
Change 3773472 by Guillaume.Abadie
Fixes a crash on PIE of SimpleComposure project.
Change 3773475 by Guillaume.Abadie
Fixes bug in editor viewport caused by SSR input changes.
Change 3774677 by Arne.Schober
DR - Deprecated SetLocal from the RHICmdlist
Fixed some unnecessary PSO collisions.
Change 3777037 by Mark.Satterthwaite
Remove incorrect change that caused a reference to "accurate::sincos" to appear in some Metal shaders rather than "precise::sincos".
Change 3777122 by Mark.Satterthwaite
Back out changelist 3777037 - I'm blind and wasn't seeing the real problem was a stale shader cache...
Change 3777196 by Mark.Satterthwaite
Fix text-shader compilation on iOS 10 - maybe iOS 9 too (untested!).
We need our own make_scalar type-trait template for ue4_stdlib.metal so that we still compile with older iOS runtime compilers and we can't use as_type to directly implement the packHalf2x16/unpackHalf2x16 intrinsics for these older runtime compilers either.
Change 3779098 by Rolando.Caloca
DR - vk - Fix query index
Change 3779275 by Mark.Satterthwaite
Silence the Metal runtime compiler warning caused by use of a deprecated enum value when running text shaders compiled for Metal v1.0/1.1 on a Metal v1.2+ OS.
#jira UE-52554
Change 3779427 by Rolando.Caloca
DR - vk - Fix for allocator contention
Change 3779608 by Uriel.Doyon
Fixed invalid access in the resave package commantlet when building texture streaming material data for materials enabling tesselation.
Change 3784496 by Mark.Satterthwaite
Temporarily disable USE_OBJECT_COMPOSITING_TILE_CULLING for Metal shader compilation only - other platforms are unaffected - as it isn't working properly for some reason. need to work out what's up but don't want Distance Fields to be completely snookered in the interim.
#jira UE-52952
Change 3784608 by Rolando.Caloca
DR - Copy 3784588
- Fix for drivers returning out of date swapchains during resizes
Change 3784734 by Mark.Satterthwaite
Real fix for UE-52952 - MetalShaderFormat wasn't propagating the full thread-group value.
#jira UE-52952
Change 3784741 by Mark.Satterthwaite
More Metal debugging commandline options "-metalfastmath" & "-metalnofastmath" to force fast-math on or off for all shaders, must be using runtime-compiled shaders (i.e. -metalshaderdebug or r.Shaders.Optimise=0) to take effect.
Change 3787103 by Guillaume.Abadie
Kills BuiltinSamplers UB
Change 3787207 by Guillaume.Abadie
Sorry, compile fix that were fine with local changes...
Change 3787396 by Marcus.Wassmer
PR #4271: UE-52901: Set VIS_Max meta to hidden (Contributed by projectgheist)
Change 3788028 by Peter.Sumanaseni
Working linear HDR exr output from sequencer
Change 3788536 by Mark.Satterthwaite
Track whether the Metal shader uses the discard_fragment function as when this is used but without any other outputs we know we need to bind at least one render-target or a depth-stencil surface but we don't know which. This lets us correctly error when we encounter a shader with no outputs at all which Metal doesn't permit.
#jira UE-52292
Change 3788538 by Mark.Satterthwaite
Let's try mitigating UE-46604 on Nvidia by retaining resource references in the command-buffer. This shouldn't be necessary and isn't typically on other vendors but we haven't been able to reproduce this reliably enough to get to the bottom of it.
#jira UE-46604
Change 3789083 by Guillaume.Abadie
Implements global shader permutations. Example in ScreenSpaceReflections.cpp.
Change 3789090 by Guillaume.Abadie
Fixes linux build.
Change 3789106 by Guillaume.Abadie
Fixes compilation failure in niagara plugin.
Change 3789274 by Guillaume.Abadie
Avoid hit proxies to clobber TAA's hitsory.
#jira UE-52968
Change 3789380 by Guillaume.Abadie
Back out changelist 3789083: global shader permutation because compilation failure in clang.
Change 3789648 by Guillaume.Abadie
Relands global shader permutation, with clang support.
Change 3789712 by Guillaume.Abadie
Fixes TestImage show flag with TAAU on.
#jira UE-53061
Change 3791593 by Guillaume.Abadie
Reinvalidates shaders with shader permutations.
Change 3791884 by Daniel.Wright
Added BP setter for LowerHemisphereColor
Change 3791886 by Daniel.Wright
Added LightmapType to PrimitiveComponent
* ForceVolumetric allows forcing static geometry to use Volumetric Lightmaps, which can be useful on instanced foliage where seams are prevalent. Lightmass internal caching still requires lightmap UVs and reasonable lightmap resolution.
* ForceSurface replaces bLightAsIfStatic
Improvements to Volumetric Lightmap quality needed for static geometry
* Stationary light shadowing is now dilated inside geometry
* Now doing two dilation passes since samples near geometry see inside due to ray start bias
* Refinement around geometry uses an expanded cell bounds when the geometry is going to use Volumetric Lightmaps, since cross-resolution stitching causes leaking
Lightmass debug primitives are now tied to a swarm task instead of global - allows debugging of Volumetric Lightmap tasks
Change 3792256 by Guillaume.Abadie
Fixes a bug where permutation was not actually serialised in FShader, so was ending up recompiling shader at every load.
Change 3792884 by Marcus.Wassmer
Copying //UE4/Partner-AMD to Dev-Rendering (//UE4/Dev-Rendering)
Change 3793200 by Marcus.Wassmer
Copying //UE4/Partner-IDV-SpeedTree to Dev-Rendering (//UE4/Dev-Rendering)
Speedtree 8 support
Change 3793206 by Brian.Karis
Added color grading control BlueCorrection to correct for artifacts with "electric" blues due to the ACEScg color space. Bright blue desaturates instead of going to violet.
Added color grading control ExpandGamut which expands bright saturated colors outside the sRGB gamut to fake wide gamut rendering.
ACES changes.
Change 3793344 by Marcus.Wassmer
Fix editortest compile
Change 3794285 by Guillaume.Abadie
Serializes PermutationId according to archive rendering version to avoid issues with old material that were serializing a shader map into UObject.
Change 3794307 by Guillaume.Abadie
Resaves uassets that were modified between 3789648 and 3794285
Change 3794627 by Mark.Satterthwaite
Implement two components for MTLPP, an IMP cache for Objective-C selector implementations & an interposition framework for those same selectors:
- imp_SelectorCache & friends provide the IMP caching for each of the Metal protocols which constitute most of the API, so far I've not covered the Metal classes used for the various descriptor/initializer types. Each type has its own IMPTable which caches the selector's implementation pointer and provides the mechanism to hook that implementation. As Objective-C is runtime dynamic this look up must be performed on the actual Class value returned by an object at runtime - you can't do this at compile time. Even things like NSString which appear compile-time static are really not as NSString is an alias for a class-cluster (NSString, NSMutableString, __NSInlineString and more).
- The interpose directory contains MTI* files which are the framework for interposing all the functions in Metal's runtime API - I deliberately omit the descriptor classes & read-only functions as there's no benefit to interposing them - which I can build off to create a trace tool or a superior validation layer. Right now this is Mac only as there'll be some problems to solve for iOS/tvOS due to difference in linking requirements - not insurmountable.
- Rebuild MTLPP's implementation of the C++ wrapper classes around the IMPTable's - this means we avoid all the objc_msgSend overhead for all the classes and functions whose implementations are cached. Right now the IMPTable is going to incur a look-up for all non-copy/move constructors which is suboptimal - ideally the Metal IMPTables would be cached in the Device object as they will be consistent within a single Device.
- Sort out the MTLPP availability logic - it now exports the availability warnings to the caller and internally just blithely assumes it may call the functions, the caller is responsible for ensuring that calls are made only on appropriate devices & OSes. This reduces MTLPP complexity and better fits how MetalRHI works.
- Fix a number of retain/release bugs that were lying dormant in MTLPP but exposed by the switch to IMPTables.
- Add tvOS support.
Next up, put this into MetalRHI and start fixing all the fallout.
Change 3794631 by Mark.Satterthwaite
Missed updating mtlpp's build.cs for TVOS.
Change 3794651 by Uriel.Doyon
UPointLightComponent::GetUnitsConversionFactor() now takes the cone angle as parameter. This allows to fix spotlight unit conversion when using lumens.
Change 3794720 by Guillaume.Abadie
Fixes a bug in Global{Bilinear,Trilinear}ClampedSampler that was actually doing a Point sampling.
Change 3794749 by Mark.Satterthwaite
Fix mtlpp.build.cs paths.
Change 3794856 by Mark.Satterthwaite
Fix some shadowing warnings.
Change 3795484 by Daniel.Wright
Implemented the Spherical Harmonic windowing algorithm from 'Stupid Spherical Harmonics (SH) Tricks'
New WorldSettings Lightmass property VolumetricLightmapSphericalHarmonicSmoothing controls the global amount of smoothing applied
Change 3795590 by Brian.Karis
Area light fixes
Fixed order of operations. This helps mixing of SourceRadius, SourceLength, and SoftSourceRadius.
Change 3796832 by Marcus.Wassmer
Correct shouldcache condition for new resolve shader
Change 3796884 by Marcus.Wassmer
Doing it right this time.
Change 3797196 by Mark.Satterthwaite
More updates to MTLPP to make things simpler and reduce the number of spurious Objective-C warnings that are emitted because of the way we are using the runtime.
Change 3797200 by Daniel.Wright
Lightmass now uses the highest density VolumetricLightmapDensityVolume settings that affect any part of a cell
Change 3797221 by Daniel.Wright
Reduced default SphericalHarmonicSmoothing based on RoboRecall tests. Now only active with strong direct lighting from static lights by default.
Change 3797411 by Brian.Karis
Disable ExpandGamut for old tone mapper.
Change 3797462 by Mark.Satterthwaite
More build warnings silenced after changing to the lowest possible deployment target OS for each library.
Change 3797585 by Mark.Satterthwaite
Range-based-For support in the NSArray wrapper.
Change 3797836 by Mark.Satterthwaite
Even more forward-declarations to avoid system headers poking through to the including code from mtlpp.
Change 3798027 by Mark.Satterthwaite
Fix handling of nil objects, on which no functions may be called, command-buffer retention and IMP declaration.
Change 3798154 by Mark.Satterthwaite
Fix some egregious memory leaks that rewriting to use mtlpp exposed before we carry on - don't want these slipping into 4.19.
Change 3800990 by Mark.Satterthwaite
Typedef all the completion-handler callback types in mtlpp to make future me's life easier.
Change 3801400 by Chris.Bunner
Improving automated test errors on failure to generate report data.
Change 3801726 by Mark.Satterthwaite
Correct some function availability and the command-buffer error status in mtlpp.
Change 3801808 by Chris.Bunner
Added DefaultScalability.ini to EngineTest that forces all quality levels to Engine default Epic for now to improve consistency.
Change 3801862 by Marcus.Wassmer
Update automated tests with color gamut change
Change 3802214 by Chris.Bunner
When running automated tests in and editor-locked PIE viewport, skip resizing as the editor can't handle this.
Added bindable delegate called when ScreenshotRequest is processed - Useful to allow screenshots to override and restore settings per capture.
#jira UE-53188
Change 3802243 by Chris.Bunner
Added button to automated test screenshot browser to add or replace all outstanding test reports if appropriate.
DeleteAllReports button is now only enabled whilst there are reports in the list.
Change 3802372 by Chris.Bunner
Updating more test screenshots.
Change 3803683 by Chris.Bunner
Adding more logging and multiple attempts to automated test report network save.
Added small wait on repeated operations that are known to fail.
Change 3803826 by Rolando.Caloca
DR - vk - Fix merge issue
Change 3804181 by Chris.Bunner
Tentative fix for CIS test failure.
Change 3804236 by Chris.Bunner
Additional logging for case where file write silently fails, report platform-specific error.
Change 3804303 by zachary.wilson
Cleaning up assets in QAGame saved with empty engine versions to resolve warnings seen when launching on
Change 3804410 by Chris.Bunner
Added additional logging when automated screenshot test fails due to size mismatch.
Mismatched bounds are colored red in the delta.
Change 3804455 by Mark.Satterthwaite
Fix a small number of persistent memory leaks on the Mac build that slowly consume more and more memory as you use the Editor - interacting with menu's was particularly egregious as each NSMenu would leak after you move away.
#jira NA
Change 3804667 by Chris.Bunner
Speculative CIS fixes.
Change 3806008 by Chris.Bunner
Partially reimplementing backed-out CL 3804181 to improve consistency of how automated screenshot test settings are applied/restored.
#tests CIS preflight job 8174412
Change 3806909 by Mark.Satterthwaite
Use the vertex-shader's in-out mask to ensure that we only validate legitmate vertex-streams in Metal's DrawIndexedPrimitive implementation.
#jira UE-53046
Change 3807059 by laz.matech
Checking in QAGame Rendering Map, QA-PhysicalLightingUnits, for testing Physical Light Units.
Wanted to get this in before copy up.
#Jira none
Change 3807726 by Chris.Bunner
Removed a check that we can't fix up. The check hits unbound buffers which it assumes means a failure but is actually due to m.v.fetch. We don't have the information available to know which are which removed from the input without reading from the shader.
#jira UE-53046
Change 3807800 by Guillaume.Abadie
Fixes some warning in shader headers.
Change 3807804 by Guillaume.Abadie
Back out changelist 3807800
Change 3807807 by Guillaume.Abadie
Relands shader header warnings.
Change 3808046 by Chris.Bunner
Dropping a new automated test error back to a warning as this may lead to genuine issues being ignored in the short term.
Change 3809579 by Chris.Bunner
Back out changelist 3774677.
#jira UE-53483
Change 3809620 by Chris.Bunner
Updating animated cloth test screenshot.
Change 3803629 by Chris.Bunner
Rebuilt CornellBox and DistanceField test maps, updated screenshots.
Change 3787045 by Guillaume.Abadie
Moves some global samplers to Common.ush
Change 3809756 by Chris.Bunner
Updating animated cloth test screenshot.
[CL 3809764 by Chris Bunner in Main branch]
2017-12-15 12:47:47 -05:00
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
2014-03-14 14:13:41 -04:00
{
2019-08-13 17:16:21 -04:00
return IsFeatureLevelSupported ( Parameters . Platform , ERHIFeatureLevel : : SM5 ) ;
2014-03-14 14:13:41 -04:00
}
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3809756)
#rb None
#lockdown Nick.Penwarden
============================
MAJOR FEATURES & CHANGES
============================
Change 3629223 by Rolando.Caloca
DR - Rollback //UE4/Dev-Rendering/Engine/Source/Runtime/VulkanRHI to changelist 3627847
Change 3629708 by Rolando.Caloca
DR - vk - Redo some changes from DevMobile
3601439
3604186
3606672
3617383
3617474
3617483
Change 3761370 by Arne.Schober
DR - Added CityHash to use with conatiners and stuff. It provides good performance and high quallity across multiple platforms.
Change 3761437 by Guillaume.Abadie
Optimises motion blur compute shader for consoles.
Change 3761483 by Guillaume.Abadie
Fixes D3D11 RHI lying to dynamic resolution heuristic with t.MaxFPS.
Change 3761995 by Mark.Satterthwaite
Add the Metal compiler path to the local .pch filename to avoid problems when Xcode moves.
Change 3761996 by Mark.Satterthwaite
Emit more details when a pixel shader is found to have no outputs at all which Metal doesn't permit. More likely this is a bug in the shader compiler not configuring the in-out mask correctly...
#jira UE-52292
Change 3761999 by Mark.Satterthwaite
No need to avoid tessellation for FMetalRHICommandContext::RHIEndDrawIndexedPrimitiveUP anymore - that was from back when the tessellation logic was replicated in each RHI*Draw* implementation.
#jira UE-51937
Change 3762181 by Joe.Graf
Changed MaxShaderJobBatchSize to 25 on Mac as it reduced shader compile time by 21%
Change 3762607 by Mark.Satterthwaite
Remove accidentally included changes from 3761995.
Change 3762612 by Mark.Satterthwaite
Enable the explicit sincos intrinsic for Metal to avoid instances of UE-52477 that can cause shaders to compile incorrectly through hlslcc.
#jira UE-52477
Change 3762772 by Michael.Lentine
Move RHI calls to render thread.
Change 3763021 by Richard.Wallis
Remove shader cache tool project and implementation.
#jira UE-51613
Change 3763082 by Guillaume.Abadie
More SceneTexture, SceneColor and SceneDepth automated tests
Change 3763111 by Richard.Wallis
Clone of CL 3763033 (Release-4.18):
Fix for crash upon launching packaged game on Mac with Share Material Shader Code enabled.
#jira UE-52121
Change 3763657 by Michael.Lentine
Invalidate ddc for skeletal mesh render data so that the duplicated vertex render structures are properly serialized.
Change 3763727 by Jian.Ru
Fix Player Collision view mode. It is caused by checking an uninitialized vertex buffer so the check always fail.
#jira UE-52052
Change 3763738 by Guillaume.Abadie
Implements SSR input post process material location.
Change 3764271 by Mark.Satterthwaite
Allow ControlPointPatch lists to flow through MetalRHI as it was setup to handle this transparently - the VSHS compute shader will convert them to triangles to draw. Report the same warning as in the pipeline creation stage as this hasn't been formally validated.
#jira UE-52454
Change 3764316 by Daniel.Wright
Added AVolumetricLightmapDensityVolume - gives local control over Volumetric Lightmap density. Dropping the top mip outside of the play area in Monolith saves 20Mb (35Mb original).
Volumetric Lightmap no longer refines around static translucent geometry - saves 5Mb in Monolith
Reworked brick culling by error mechanism. Now compares error to interpolated parent lighting instead of the brick average - prevents dropping constant value bricks which are near a wall and cause leaking due to parent interpolation after being culled.
Change 3764318 by Daniel.Wright
Missing file
Change 3764321 by Daniel.Wright
Shader compiling memory optimizations
* Editor memory: Sharing uniform buffer includes and GeneratedInstancedStereo.ush per FShaderType (was previously duplicated per FShader job)
* SCW input size: Sharing uniform buffer includes and SharedEnvironment per batch
* 7.6Gb of shader job inputs in memory -> .5Gb (13x less) when doing a full shader compile of Paragon Editor
* 13.8Gb written into worker input files -> 2.9Gb (4.7x less). Global shaders are never batched when sent to SCW so unoptimized by these changes.
Change 3764595 by Daniel.Wright
Added VolumetricLightmapDensityVolume asset icons
Change 3764701 by Michael.Lentine
Add duplicated vertices merging for meshmerge.
Change 3766002 by Guillaume.Abadie
Fixes a crash in translucency.
Change 3766007 by Guillaume.Abadie
Oups.... Fixes compilation failure.
Change 3766697 by Guillaume.Abadie
Giant refactor of global shader interface for upcoming native support of permutation.
CL generated by python script.
Change 3767205 by Chris.Bunner
Deferring FMaterial::RenderingThreadShaderMap update to render-thread rather than assumption commands have been flushed.
#jira UE-50652
Change 3767207 by Chris.Bunner
Clamp fetched texture coordinates to those available on the mesh.
Change 3767209 by Chris.Bunner
PR #4203: Early-outs in UMaterialInstance parameter setters (Contributed by stefanzimecki)
#jira UE-52193
Change 3767772 by Mark.Satterthwaite
MetalShaderFormat will no longer fallback to text shaders when you ask it to compile to bytecode but the bytecode compiler is not available (either locally or remotely) - this ensures that the DDC can't be poisoned by incorrectly configured clients. The Editor is already setup such that if the remote shader compiler is not configured & Xcode is not available locally the shader-compiler will be invoked to generate text shaders.
#jira UE-52554
Change 3768604 by Guillaume.Abadie
Polish up with new global shader function signature.
Change 3768993 by Guillaume.Abadie
Fixes r.Upscale.Panini cvars
Change 3769478 by Mark.Satterthwaite
Move the ue4_stdlib.metal & PCH into a temporary directory that exists for the lifetime of the SCW on the remote side as well as the local one and add this path as an include directory.
#jira UE-52587
Change 3769703 by Mark.Satterthwaite
For all Metal platforms >= Metal v1.2 transform mul(a,b) into fma(a,b,0) to prevent the Apple compiler reordering operations differently between the base & depth passes which results in variance in the position output.
For iOS disable fast-math when the vertex-shader uses World-Position-Offset because there are additional problems on the iOS shader compiler that result in position variance even with the above fix - WPO performance will suffer but I don't have any alternatives.
Remove the depth-offset hack from the depth-only vertex shader again.
#jira UES-5651
Change 3769763 by Mark.Satterthwaite
Handle swizzle's in the hlslcc fma identification pass so that we reduce the number of instructions and the platform compiler can't break the instructions up.
Change 3769849 by Mark.Satterthwaite
Fix CIS error.
Change 3770517 by Richard.Wallis
Fix for crash when creating a new media texture (AppleIntelHD5000GraphicsMTLDriver!SamplerStage::bindSamplerToTexture()). Missing texture resource for binding. Old InitDynamicRHI() code has been refactored out into seperate functions which leaves us on Mac with a NULL resource initially after creation which Metal doesn't like. This fix puts InitDynamicRHI down the default setup/clear path which inits default resources - I don't think we should use a global dummy in this instance as this is a render target.
#jira UE-51940
Change 3770688 by Uriel.Doyon
Fixed texture resolution returning 0 when running blueprint construction scripts at cook time.
Change 3771115 by Mark.Satterthwaite
Report errors from failed attempts to compile global shaders or we can't see why things fail on non-Windows platforms.
Change 3771263 by Mark.Satterthwaite
Change the way ManualVertexFetch is enabled on Metal platforms so that it is enabled when targeting Metal v1.2 and higher (macOS 10.12+/iOS 10+). This brings iOS in the Desktop Forward renderer back into line with the Mac.
#jira UERNDR-300
Change 3773472 by Guillaume.Abadie
Fixes a crash on PIE of SimpleComposure project.
Change 3773475 by Guillaume.Abadie
Fixes bug in editor viewport caused by SSR input changes.
Change 3774677 by Arne.Schober
DR - Deprecated SetLocal from the RHICmdlist
Fixed some unnecessary PSO collisions.
Change 3777037 by Mark.Satterthwaite
Remove incorrect change that caused a reference to "accurate::sincos" to appear in some Metal shaders rather than "precise::sincos".
Change 3777122 by Mark.Satterthwaite
Back out changelist 3777037 - I'm blind and wasn't seeing the real problem was a stale shader cache...
Change 3777196 by Mark.Satterthwaite
Fix text-shader compilation on iOS 10 - maybe iOS 9 too (untested!).
We need our own make_scalar type-trait template for ue4_stdlib.metal so that we still compile with older iOS runtime compilers and we can't use as_type to directly implement the packHalf2x16/unpackHalf2x16 intrinsics for these older runtime compilers either.
Change 3779098 by Rolando.Caloca
DR - vk - Fix query index
Change 3779275 by Mark.Satterthwaite
Silence the Metal runtime compiler warning caused by use of a deprecated enum value when running text shaders compiled for Metal v1.0/1.1 on a Metal v1.2+ OS.
#jira UE-52554
Change 3779427 by Rolando.Caloca
DR - vk - Fix for allocator contention
Change 3779608 by Uriel.Doyon
Fixed invalid access in the resave package commantlet when building texture streaming material data for materials enabling tesselation.
Change 3784496 by Mark.Satterthwaite
Temporarily disable USE_OBJECT_COMPOSITING_TILE_CULLING for Metal shader compilation only - other platforms are unaffected - as it isn't working properly for some reason. need to work out what's up but don't want Distance Fields to be completely snookered in the interim.
#jira UE-52952
Change 3784608 by Rolando.Caloca
DR - Copy 3784588
- Fix for drivers returning out of date swapchains during resizes
Change 3784734 by Mark.Satterthwaite
Real fix for UE-52952 - MetalShaderFormat wasn't propagating the full thread-group value.
#jira UE-52952
Change 3784741 by Mark.Satterthwaite
More Metal debugging commandline options "-metalfastmath" & "-metalnofastmath" to force fast-math on or off for all shaders, must be using runtime-compiled shaders (i.e. -metalshaderdebug or r.Shaders.Optimise=0) to take effect.
Change 3787103 by Guillaume.Abadie
Kills BuiltinSamplers UB
Change 3787207 by Guillaume.Abadie
Sorry, compile fix that were fine with local changes...
Change 3787396 by Marcus.Wassmer
PR #4271: UE-52901: Set VIS_Max meta to hidden (Contributed by projectgheist)
Change 3788028 by Peter.Sumanaseni
Working linear HDR exr output from sequencer
Change 3788536 by Mark.Satterthwaite
Track whether the Metal shader uses the discard_fragment function as when this is used but without any other outputs we know we need to bind at least one render-target or a depth-stencil surface but we don't know which. This lets us correctly error when we encounter a shader with no outputs at all which Metal doesn't permit.
#jira UE-52292
Change 3788538 by Mark.Satterthwaite
Let's try mitigating UE-46604 on Nvidia by retaining resource references in the command-buffer. This shouldn't be necessary and isn't typically on other vendors but we haven't been able to reproduce this reliably enough to get to the bottom of it.
#jira UE-46604
Change 3789083 by Guillaume.Abadie
Implements global shader permutations. Example in ScreenSpaceReflections.cpp.
Change 3789090 by Guillaume.Abadie
Fixes linux build.
Change 3789106 by Guillaume.Abadie
Fixes compilation failure in niagara plugin.
Change 3789274 by Guillaume.Abadie
Avoid hit proxies to clobber TAA's hitsory.
#jira UE-52968
Change 3789380 by Guillaume.Abadie
Back out changelist 3789083: global shader permutation because compilation failure in clang.
Change 3789648 by Guillaume.Abadie
Relands global shader permutation, with clang support.
Change 3789712 by Guillaume.Abadie
Fixes TestImage show flag with TAAU on.
#jira UE-53061
Change 3791593 by Guillaume.Abadie
Reinvalidates shaders with shader permutations.
Change 3791884 by Daniel.Wright
Added BP setter for LowerHemisphereColor
Change 3791886 by Daniel.Wright
Added LightmapType to PrimitiveComponent
* ForceVolumetric allows forcing static geometry to use Volumetric Lightmaps, which can be useful on instanced foliage where seams are prevalent. Lightmass internal caching still requires lightmap UVs and reasonable lightmap resolution.
* ForceSurface replaces bLightAsIfStatic
Improvements to Volumetric Lightmap quality needed for static geometry
* Stationary light shadowing is now dilated inside geometry
* Now doing two dilation passes since samples near geometry see inside due to ray start bias
* Refinement around geometry uses an expanded cell bounds when the geometry is going to use Volumetric Lightmaps, since cross-resolution stitching causes leaking
Lightmass debug primitives are now tied to a swarm task instead of global - allows debugging of Volumetric Lightmap tasks
Change 3792256 by Guillaume.Abadie
Fixes a bug where permutation was not actually serialised in FShader, so was ending up recompiling shader at every load.
Change 3792884 by Marcus.Wassmer
Copying //UE4/Partner-AMD to Dev-Rendering (//UE4/Dev-Rendering)
Change 3793200 by Marcus.Wassmer
Copying //UE4/Partner-IDV-SpeedTree to Dev-Rendering (//UE4/Dev-Rendering)
Speedtree 8 support
Change 3793206 by Brian.Karis
Added color grading control BlueCorrection to correct for artifacts with "electric" blues due to the ACEScg color space. Bright blue desaturates instead of going to violet.
Added color grading control ExpandGamut which expands bright saturated colors outside the sRGB gamut to fake wide gamut rendering.
ACES changes.
Change 3793344 by Marcus.Wassmer
Fix editortest compile
Change 3794285 by Guillaume.Abadie
Serializes PermutationId according to archive rendering version to avoid issues with old material that were serializing a shader map into UObject.
Change 3794307 by Guillaume.Abadie
Resaves uassets that were modified between 3789648 and 3794285
Change 3794627 by Mark.Satterthwaite
Implement two components for MTLPP, an IMP cache for Objective-C selector implementations & an interposition framework for those same selectors:
- imp_SelectorCache & friends provide the IMP caching for each of the Metal protocols which constitute most of the API, so far I've not covered the Metal classes used for the various descriptor/initializer types. Each type has its own IMPTable which caches the selector's implementation pointer and provides the mechanism to hook that implementation. As Objective-C is runtime dynamic this look up must be performed on the actual Class value returned by an object at runtime - you can't do this at compile time. Even things like NSString which appear compile-time static are really not as NSString is an alias for a class-cluster (NSString, NSMutableString, __NSInlineString and more).
- The interpose directory contains MTI* files which are the framework for interposing all the functions in Metal's runtime API - I deliberately omit the descriptor classes & read-only functions as there's no benefit to interposing them - which I can build off to create a trace tool or a superior validation layer. Right now this is Mac only as there'll be some problems to solve for iOS/tvOS due to difference in linking requirements - not insurmountable.
- Rebuild MTLPP's implementation of the C++ wrapper classes around the IMPTable's - this means we avoid all the objc_msgSend overhead for all the classes and functions whose implementations are cached. Right now the IMPTable is going to incur a look-up for all non-copy/move constructors which is suboptimal - ideally the Metal IMPTables would be cached in the Device object as they will be consistent within a single Device.
- Sort out the MTLPP availability logic - it now exports the availability warnings to the caller and internally just blithely assumes it may call the functions, the caller is responsible for ensuring that calls are made only on appropriate devices & OSes. This reduces MTLPP complexity and better fits how MetalRHI works.
- Fix a number of retain/release bugs that were lying dormant in MTLPP but exposed by the switch to IMPTables.
- Add tvOS support.
Next up, put this into MetalRHI and start fixing all the fallout.
Change 3794631 by Mark.Satterthwaite
Missed updating mtlpp's build.cs for TVOS.
Change 3794651 by Uriel.Doyon
UPointLightComponent::GetUnitsConversionFactor() now takes the cone angle as parameter. This allows to fix spotlight unit conversion when using lumens.
Change 3794720 by Guillaume.Abadie
Fixes a bug in Global{Bilinear,Trilinear}ClampedSampler that was actually doing a Point sampling.
Change 3794749 by Mark.Satterthwaite
Fix mtlpp.build.cs paths.
Change 3794856 by Mark.Satterthwaite
Fix some shadowing warnings.
Change 3795484 by Daniel.Wright
Implemented the Spherical Harmonic windowing algorithm from 'Stupid Spherical Harmonics (SH) Tricks'
New WorldSettings Lightmass property VolumetricLightmapSphericalHarmonicSmoothing controls the global amount of smoothing applied
Change 3795590 by Brian.Karis
Area light fixes
Fixed order of operations. This helps mixing of SourceRadius, SourceLength, and SoftSourceRadius.
Change 3796832 by Marcus.Wassmer
Correct shouldcache condition for new resolve shader
Change 3796884 by Marcus.Wassmer
Doing it right this time.
Change 3797196 by Mark.Satterthwaite
More updates to MTLPP to make things simpler and reduce the number of spurious Objective-C warnings that are emitted because of the way we are using the runtime.
Change 3797200 by Daniel.Wright
Lightmass now uses the highest density VolumetricLightmapDensityVolume settings that affect any part of a cell
Change 3797221 by Daniel.Wright
Reduced default SphericalHarmonicSmoothing based on RoboRecall tests. Now only active with strong direct lighting from static lights by default.
Change 3797411 by Brian.Karis
Disable ExpandGamut for old tone mapper.
Change 3797462 by Mark.Satterthwaite
More build warnings silenced after changing to the lowest possible deployment target OS for each library.
Change 3797585 by Mark.Satterthwaite
Range-based-For support in the NSArray wrapper.
Change 3797836 by Mark.Satterthwaite
Even more forward-declarations to avoid system headers poking through to the including code from mtlpp.
Change 3798027 by Mark.Satterthwaite
Fix handling of nil objects, on which no functions may be called, command-buffer retention and IMP declaration.
Change 3798154 by Mark.Satterthwaite
Fix some egregious memory leaks that rewriting to use mtlpp exposed before we carry on - don't want these slipping into 4.19.
Change 3800990 by Mark.Satterthwaite
Typedef all the completion-handler callback types in mtlpp to make future me's life easier.
Change 3801400 by Chris.Bunner
Improving automated test errors on failure to generate report data.
Change 3801726 by Mark.Satterthwaite
Correct some function availability and the command-buffer error status in mtlpp.
Change 3801808 by Chris.Bunner
Added DefaultScalability.ini to EngineTest that forces all quality levels to Engine default Epic for now to improve consistency.
Change 3801862 by Marcus.Wassmer
Update automated tests with color gamut change
Change 3802214 by Chris.Bunner
When running automated tests in and editor-locked PIE viewport, skip resizing as the editor can't handle this.
Added bindable delegate called when ScreenshotRequest is processed - Useful to allow screenshots to override and restore settings per capture.
#jira UE-53188
Change 3802243 by Chris.Bunner
Added button to automated test screenshot browser to add or replace all outstanding test reports if appropriate.
DeleteAllReports button is now only enabled whilst there are reports in the list.
Change 3802372 by Chris.Bunner
Updating more test screenshots.
Change 3803683 by Chris.Bunner
Adding more logging and multiple attempts to automated test report network save.
Added small wait on repeated operations that are known to fail.
Change 3803826 by Rolando.Caloca
DR - vk - Fix merge issue
Change 3804181 by Chris.Bunner
Tentative fix for CIS test failure.
Change 3804236 by Chris.Bunner
Additional logging for case where file write silently fails, report platform-specific error.
Change 3804303 by zachary.wilson
Cleaning up assets in QAGame saved with empty engine versions to resolve warnings seen when launching on
Change 3804410 by Chris.Bunner
Added additional logging when automated screenshot test fails due to size mismatch.
Mismatched bounds are colored red in the delta.
Change 3804455 by Mark.Satterthwaite
Fix a small number of persistent memory leaks on the Mac build that slowly consume more and more memory as you use the Editor - interacting with menu's was particularly egregious as each NSMenu would leak after you move away.
#jira NA
Change 3804667 by Chris.Bunner
Speculative CIS fixes.
Change 3806008 by Chris.Bunner
Partially reimplementing backed-out CL 3804181 to improve consistency of how automated screenshot test settings are applied/restored.
#tests CIS preflight job 8174412
Change 3806909 by Mark.Satterthwaite
Use the vertex-shader's in-out mask to ensure that we only validate legitmate vertex-streams in Metal's DrawIndexedPrimitive implementation.
#jira UE-53046
Change 3807059 by laz.matech
Checking in QAGame Rendering Map, QA-PhysicalLightingUnits, for testing Physical Light Units.
Wanted to get this in before copy up.
#Jira none
Change 3807726 by Chris.Bunner
Removed a check that we can't fix up. The check hits unbound buffers which it assumes means a failure but is actually due to m.v.fetch. We don't have the information available to know which are which removed from the input without reading from the shader.
#jira UE-53046
Change 3807800 by Guillaume.Abadie
Fixes some warning in shader headers.
Change 3807804 by Guillaume.Abadie
Back out changelist 3807800
Change 3807807 by Guillaume.Abadie
Relands shader header warnings.
Change 3808046 by Chris.Bunner
Dropping a new automated test error back to a warning as this may lead to genuine issues being ignored in the short term.
Change 3809579 by Chris.Bunner
Back out changelist 3774677.
#jira UE-53483
Change 3809620 by Chris.Bunner
Updating animated cloth test screenshot.
Change 3803629 by Chris.Bunner
Rebuilt CornellBox and DistanceField test maps, updated screenshots.
Change 3787045 by Guillaume.Abadie
Moves some global samplers to Common.ush
Change 3809756 by Chris.Bunner
Updating animated cloth test screenshot.
[CL 3809764 by Chris Bunner in Main branch]
2017-12-15 12:47:47 -05:00
static void ModifyCompilationEnvironment ( const FGlobalShaderPermutationParameters & Parameters , FShaderCompilerEnvironment & OutEnvironment )
2014-03-14 14:13:41 -04:00
{
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3809756)
#rb None
#lockdown Nick.Penwarden
============================
MAJOR FEATURES & CHANGES
============================
Change 3629223 by Rolando.Caloca
DR - Rollback //UE4/Dev-Rendering/Engine/Source/Runtime/VulkanRHI to changelist 3627847
Change 3629708 by Rolando.Caloca
DR - vk - Redo some changes from DevMobile
3601439
3604186
3606672
3617383
3617474
3617483
Change 3761370 by Arne.Schober
DR - Added CityHash to use with conatiners and stuff. It provides good performance and high quallity across multiple platforms.
Change 3761437 by Guillaume.Abadie
Optimises motion blur compute shader for consoles.
Change 3761483 by Guillaume.Abadie
Fixes D3D11 RHI lying to dynamic resolution heuristic with t.MaxFPS.
Change 3761995 by Mark.Satterthwaite
Add the Metal compiler path to the local .pch filename to avoid problems when Xcode moves.
Change 3761996 by Mark.Satterthwaite
Emit more details when a pixel shader is found to have no outputs at all which Metal doesn't permit. More likely this is a bug in the shader compiler not configuring the in-out mask correctly...
#jira UE-52292
Change 3761999 by Mark.Satterthwaite
No need to avoid tessellation for FMetalRHICommandContext::RHIEndDrawIndexedPrimitiveUP anymore - that was from back when the tessellation logic was replicated in each RHI*Draw* implementation.
#jira UE-51937
Change 3762181 by Joe.Graf
Changed MaxShaderJobBatchSize to 25 on Mac as it reduced shader compile time by 21%
Change 3762607 by Mark.Satterthwaite
Remove accidentally included changes from 3761995.
Change 3762612 by Mark.Satterthwaite
Enable the explicit sincos intrinsic for Metal to avoid instances of UE-52477 that can cause shaders to compile incorrectly through hlslcc.
#jira UE-52477
Change 3762772 by Michael.Lentine
Move RHI calls to render thread.
Change 3763021 by Richard.Wallis
Remove shader cache tool project and implementation.
#jira UE-51613
Change 3763082 by Guillaume.Abadie
More SceneTexture, SceneColor and SceneDepth automated tests
Change 3763111 by Richard.Wallis
Clone of CL 3763033 (Release-4.18):
Fix for crash upon launching packaged game on Mac with Share Material Shader Code enabled.
#jira UE-52121
Change 3763657 by Michael.Lentine
Invalidate ddc for skeletal mesh render data so that the duplicated vertex render structures are properly serialized.
Change 3763727 by Jian.Ru
Fix Player Collision view mode. It is caused by checking an uninitialized vertex buffer so the check always fail.
#jira UE-52052
Change 3763738 by Guillaume.Abadie
Implements SSR input post process material location.
Change 3764271 by Mark.Satterthwaite
Allow ControlPointPatch lists to flow through MetalRHI as it was setup to handle this transparently - the VSHS compute shader will convert them to triangles to draw. Report the same warning as in the pipeline creation stage as this hasn't been formally validated.
#jira UE-52454
Change 3764316 by Daniel.Wright
Added AVolumetricLightmapDensityVolume - gives local control over Volumetric Lightmap density. Dropping the top mip outside of the play area in Monolith saves 20Mb (35Mb original).
Volumetric Lightmap no longer refines around static translucent geometry - saves 5Mb in Monolith
Reworked brick culling by error mechanism. Now compares error to interpolated parent lighting instead of the brick average - prevents dropping constant value bricks which are near a wall and cause leaking due to parent interpolation after being culled.
Change 3764318 by Daniel.Wright
Missing file
Change 3764321 by Daniel.Wright
Shader compiling memory optimizations
* Editor memory: Sharing uniform buffer includes and GeneratedInstancedStereo.ush per FShaderType (was previously duplicated per FShader job)
* SCW input size: Sharing uniform buffer includes and SharedEnvironment per batch
* 7.6Gb of shader job inputs in memory -> .5Gb (13x less) when doing a full shader compile of Paragon Editor
* 13.8Gb written into worker input files -> 2.9Gb (4.7x less). Global shaders are never batched when sent to SCW so unoptimized by these changes.
Change 3764595 by Daniel.Wright
Added VolumetricLightmapDensityVolume asset icons
Change 3764701 by Michael.Lentine
Add duplicated vertices merging for meshmerge.
Change 3766002 by Guillaume.Abadie
Fixes a crash in translucency.
Change 3766007 by Guillaume.Abadie
Oups.... Fixes compilation failure.
Change 3766697 by Guillaume.Abadie
Giant refactor of global shader interface for upcoming native support of permutation.
CL generated by python script.
Change 3767205 by Chris.Bunner
Deferring FMaterial::RenderingThreadShaderMap update to render-thread rather than assumption commands have been flushed.
#jira UE-50652
Change 3767207 by Chris.Bunner
Clamp fetched texture coordinates to those available on the mesh.
Change 3767209 by Chris.Bunner
PR #4203: Early-outs in UMaterialInstance parameter setters (Contributed by stefanzimecki)
#jira UE-52193
Change 3767772 by Mark.Satterthwaite
MetalShaderFormat will no longer fallback to text shaders when you ask it to compile to bytecode but the bytecode compiler is not available (either locally or remotely) - this ensures that the DDC can't be poisoned by incorrectly configured clients. The Editor is already setup such that if the remote shader compiler is not configured & Xcode is not available locally the shader-compiler will be invoked to generate text shaders.
#jira UE-52554
Change 3768604 by Guillaume.Abadie
Polish up with new global shader function signature.
Change 3768993 by Guillaume.Abadie
Fixes r.Upscale.Panini cvars
Change 3769478 by Mark.Satterthwaite
Move the ue4_stdlib.metal & PCH into a temporary directory that exists for the lifetime of the SCW on the remote side as well as the local one and add this path as an include directory.
#jira UE-52587
Change 3769703 by Mark.Satterthwaite
For all Metal platforms >= Metal v1.2 transform mul(a,b) into fma(a,b,0) to prevent the Apple compiler reordering operations differently between the base & depth passes which results in variance in the position output.
For iOS disable fast-math when the vertex-shader uses World-Position-Offset because there are additional problems on the iOS shader compiler that result in position variance even with the above fix - WPO performance will suffer but I don't have any alternatives.
Remove the depth-offset hack from the depth-only vertex shader again.
#jira UES-5651
Change 3769763 by Mark.Satterthwaite
Handle swizzle's in the hlslcc fma identification pass so that we reduce the number of instructions and the platform compiler can't break the instructions up.
Change 3769849 by Mark.Satterthwaite
Fix CIS error.
Change 3770517 by Richard.Wallis
Fix for crash when creating a new media texture (AppleIntelHD5000GraphicsMTLDriver!SamplerStage::bindSamplerToTexture()). Missing texture resource for binding. Old InitDynamicRHI() code has been refactored out into seperate functions which leaves us on Mac with a NULL resource initially after creation which Metal doesn't like. This fix puts InitDynamicRHI down the default setup/clear path which inits default resources - I don't think we should use a global dummy in this instance as this is a render target.
#jira UE-51940
Change 3770688 by Uriel.Doyon
Fixed texture resolution returning 0 when running blueprint construction scripts at cook time.
Change 3771115 by Mark.Satterthwaite
Report errors from failed attempts to compile global shaders or we can't see why things fail on non-Windows platforms.
Change 3771263 by Mark.Satterthwaite
Change the way ManualVertexFetch is enabled on Metal platforms so that it is enabled when targeting Metal v1.2 and higher (macOS 10.12+/iOS 10+). This brings iOS in the Desktop Forward renderer back into line with the Mac.
#jira UERNDR-300
Change 3773472 by Guillaume.Abadie
Fixes a crash on PIE of SimpleComposure project.
Change 3773475 by Guillaume.Abadie
Fixes bug in editor viewport caused by SSR input changes.
Change 3774677 by Arne.Schober
DR - Deprecated SetLocal from the RHICmdlist
Fixed some unnecessary PSO collisions.
Change 3777037 by Mark.Satterthwaite
Remove incorrect change that caused a reference to "accurate::sincos" to appear in some Metal shaders rather than "precise::sincos".
Change 3777122 by Mark.Satterthwaite
Back out changelist 3777037 - I'm blind and wasn't seeing the real problem was a stale shader cache...
Change 3777196 by Mark.Satterthwaite
Fix text-shader compilation on iOS 10 - maybe iOS 9 too (untested!).
We need our own make_scalar type-trait template for ue4_stdlib.metal so that we still compile with older iOS runtime compilers and we can't use as_type to directly implement the packHalf2x16/unpackHalf2x16 intrinsics for these older runtime compilers either.
Change 3779098 by Rolando.Caloca
DR - vk - Fix query index
Change 3779275 by Mark.Satterthwaite
Silence the Metal runtime compiler warning caused by use of a deprecated enum value when running text shaders compiled for Metal v1.0/1.1 on a Metal v1.2+ OS.
#jira UE-52554
Change 3779427 by Rolando.Caloca
DR - vk - Fix for allocator contention
Change 3779608 by Uriel.Doyon
Fixed invalid access in the resave package commantlet when building texture streaming material data for materials enabling tesselation.
Change 3784496 by Mark.Satterthwaite
Temporarily disable USE_OBJECT_COMPOSITING_TILE_CULLING for Metal shader compilation only - other platforms are unaffected - as it isn't working properly for some reason. need to work out what's up but don't want Distance Fields to be completely snookered in the interim.
#jira UE-52952
Change 3784608 by Rolando.Caloca
DR - Copy 3784588
- Fix for drivers returning out of date swapchains during resizes
Change 3784734 by Mark.Satterthwaite
Real fix for UE-52952 - MetalShaderFormat wasn't propagating the full thread-group value.
#jira UE-52952
Change 3784741 by Mark.Satterthwaite
More Metal debugging commandline options "-metalfastmath" & "-metalnofastmath" to force fast-math on or off for all shaders, must be using runtime-compiled shaders (i.e. -metalshaderdebug or r.Shaders.Optimise=0) to take effect.
Change 3787103 by Guillaume.Abadie
Kills BuiltinSamplers UB
Change 3787207 by Guillaume.Abadie
Sorry, compile fix that were fine with local changes...
Change 3787396 by Marcus.Wassmer
PR #4271: UE-52901: Set VIS_Max meta to hidden (Contributed by projectgheist)
Change 3788028 by Peter.Sumanaseni
Working linear HDR exr output from sequencer
Change 3788536 by Mark.Satterthwaite
Track whether the Metal shader uses the discard_fragment function as when this is used but without any other outputs we know we need to bind at least one render-target or a depth-stencil surface but we don't know which. This lets us correctly error when we encounter a shader with no outputs at all which Metal doesn't permit.
#jira UE-52292
Change 3788538 by Mark.Satterthwaite
Let's try mitigating UE-46604 on Nvidia by retaining resource references in the command-buffer. This shouldn't be necessary and isn't typically on other vendors but we haven't been able to reproduce this reliably enough to get to the bottom of it.
#jira UE-46604
Change 3789083 by Guillaume.Abadie
Implements global shader permutations. Example in ScreenSpaceReflections.cpp.
Change 3789090 by Guillaume.Abadie
Fixes linux build.
Change 3789106 by Guillaume.Abadie
Fixes compilation failure in niagara plugin.
Change 3789274 by Guillaume.Abadie
Avoid hit proxies to clobber TAA's hitsory.
#jira UE-52968
Change 3789380 by Guillaume.Abadie
Back out changelist 3789083: global shader permutation because compilation failure in clang.
Change 3789648 by Guillaume.Abadie
Relands global shader permutation, with clang support.
Change 3789712 by Guillaume.Abadie
Fixes TestImage show flag with TAAU on.
#jira UE-53061
Change 3791593 by Guillaume.Abadie
Reinvalidates shaders with shader permutations.
Change 3791884 by Daniel.Wright
Added BP setter for LowerHemisphereColor
Change 3791886 by Daniel.Wright
Added LightmapType to PrimitiveComponent
* ForceVolumetric allows forcing static geometry to use Volumetric Lightmaps, which can be useful on instanced foliage where seams are prevalent. Lightmass internal caching still requires lightmap UVs and reasonable lightmap resolution.
* ForceSurface replaces bLightAsIfStatic
Improvements to Volumetric Lightmap quality needed for static geometry
* Stationary light shadowing is now dilated inside geometry
* Now doing two dilation passes since samples near geometry see inside due to ray start bias
* Refinement around geometry uses an expanded cell bounds when the geometry is going to use Volumetric Lightmaps, since cross-resolution stitching causes leaking
Lightmass debug primitives are now tied to a swarm task instead of global - allows debugging of Volumetric Lightmap tasks
Change 3792256 by Guillaume.Abadie
Fixes a bug where permutation was not actually serialised in FShader, so was ending up recompiling shader at every load.
Change 3792884 by Marcus.Wassmer
Copying //UE4/Partner-AMD to Dev-Rendering (//UE4/Dev-Rendering)
Change 3793200 by Marcus.Wassmer
Copying //UE4/Partner-IDV-SpeedTree to Dev-Rendering (//UE4/Dev-Rendering)
Speedtree 8 support
Change 3793206 by Brian.Karis
Added color grading control BlueCorrection to correct for artifacts with "electric" blues due to the ACEScg color space. Bright blue desaturates instead of going to violet.
Added color grading control ExpandGamut which expands bright saturated colors outside the sRGB gamut to fake wide gamut rendering.
ACES changes.
Change 3793344 by Marcus.Wassmer
Fix editortest compile
Change 3794285 by Guillaume.Abadie
Serializes PermutationId according to archive rendering version to avoid issues with old material that were serializing a shader map into UObject.
Change 3794307 by Guillaume.Abadie
Resaves uassets that were modified between 3789648 and 3794285
Change 3794627 by Mark.Satterthwaite
Implement two components for MTLPP, an IMP cache for Objective-C selector implementations & an interposition framework for those same selectors:
- imp_SelectorCache & friends provide the IMP caching for each of the Metal protocols which constitute most of the API, so far I've not covered the Metal classes used for the various descriptor/initializer types. Each type has its own IMPTable which caches the selector's implementation pointer and provides the mechanism to hook that implementation. As Objective-C is runtime dynamic this look up must be performed on the actual Class value returned by an object at runtime - you can't do this at compile time. Even things like NSString which appear compile-time static are really not as NSString is an alias for a class-cluster (NSString, NSMutableString, __NSInlineString and more).
- The interpose directory contains MTI* files which are the framework for interposing all the functions in Metal's runtime API - I deliberately omit the descriptor classes & read-only functions as there's no benefit to interposing them - which I can build off to create a trace tool or a superior validation layer. Right now this is Mac only as there'll be some problems to solve for iOS/tvOS due to difference in linking requirements - not insurmountable.
- Rebuild MTLPP's implementation of the C++ wrapper classes around the IMPTable's - this means we avoid all the objc_msgSend overhead for all the classes and functions whose implementations are cached. Right now the IMPTable is going to incur a look-up for all non-copy/move constructors which is suboptimal - ideally the Metal IMPTables would be cached in the Device object as they will be consistent within a single Device.
- Sort out the MTLPP availability logic - it now exports the availability warnings to the caller and internally just blithely assumes it may call the functions, the caller is responsible for ensuring that calls are made only on appropriate devices & OSes. This reduces MTLPP complexity and better fits how MetalRHI works.
- Fix a number of retain/release bugs that were lying dormant in MTLPP but exposed by the switch to IMPTables.
- Add tvOS support.
Next up, put this into MetalRHI and start fixing all the fallout.
Change 3794631 by Mark.Satterthwaite
Missed updating mtlpp's build.cs for TVOS.
Change 3794651 by Uriel.Doyon
UPointLightComponent::GetUnitsConversionFactor() now takes the cone angle as parameter. This allows to fix spotlight unit conversion when using lumens.
Change 3794720 by Guillaume.Abadie
Fixes a bug in Global{Bilinear,Trilinear}ClampedSampler that was actually doing a Point sampling.
Change 3794749 by Mark.Satterthwaite
Fix mtlpp.build.cs paths.
Change 3794856 by Mark.Satterthwaite
Fix some shadowing warnings.
Change 3795484 by Daniel.Wright
Implemented the Spherical Harmonic windowing algorithm from 'Stupid Spherical Harmonics (SH) Tricks'
New WorldSettings Lightmass property VolumetricLightmapSphericalHarmonicSmoothing controls the global amount of smoothing applied
Change 3795590 by Brian.Karis
Area light fixes
Fixed order of operations. This helps mixing of SourceRadius, SourceLength, and SoftSourceRadius.
Change 3796832 by Marcus.Wassmer
Correct shouldcache condition for new resolve shader
Change 3796884 by Marcus.Wassmer
Doing it right this time.
Change 3797196 by Mark.Satterthwaite
More updates to MTLPP to make things simpler and reduce the number of spurious Objective-C warnings that are emitted because of the way we are using the runtime.
Change 3797200 by Daniel.Wright
Lightmass now uses the highest density VolumetricLightmapDensityVolume settings that affect any part of a cell
Change 3797221 by Daniel.Wright
Reduced default SphericalHarmonicSmoothing based on RoboRecall tests. Now only active with strong direct lighting from static lights by default.
Change 3797411 by Brian.Karis
Disable ExpandGamut for old tone mapper.
Change 3797462 by Mark.Satterthwaite
More build warnings silenced after changing to the lowest possible deployment target OS for each library.
Change 3797585 by Mark.Satterthwaite
Range-based-For support in the NSArray wrapper.
Change 3797836 by Mark.Satterthwaite
Even more forward-declarations to avoid system headers poking through to the including code from mtlpp.
Change 3798027 by Mark.Satterthwaite
Fix handling of nil objects, on which no functions may be called, command-buffer retention and IMP declaration.
Change 3798154 by Mark.Satterthwaite
Fix some egregious memory leaks that rewriting to use mtlpp exposed before we carry on - don't want these slipping into 4.19.
Change 3800990 by Mark.Satterthwaite
Typedef all the completion-handler callback types in mtlpp to make future me's life easier.
Change 3801400 by Chris.Bunner
Improving automated test errors on failure to generate report data.
Change 3801726 by Mark.Satterthwaite
Correct some function availability and the command-buffer error status in mtlpp.
Change 3801808 by Chris.Bunner
Added DefaultScalability.ini to EngineTest that forces all quality levels to Engine default Epic for now to improve consistency.
Change 3801862 by Marcus.Wassmer
Update automated tests with color gamut change
Change 3802214 by Chris.Bunner
When running automated tests in and editor-locked PIE viewport, skip resizing as the editor can't handle this.
Added bindable delegate called when ScreenshotRequest is processed - Useful to allow screenshots to override and restore settings per capture.
#jira UE-53188
Change 3802243 by Chris.Bunner
Added button to automated test screenshot browser to add or replace all outstanding test reports if appropriate.
DeleteAllReports button is now only enabled whilst there are reports in the list.
Change 3802372 by Chris.Bunner
Updating more test screenshots.
Change 3803683 by Chris.Bunner
Adding more logging and multiple attempts to automated test report network save.
Added small wait on repeated operations that are known to fail.
Change 3803826 by Rolando.Caloca
DR - vk - Fix merge issue
Change 3804181 by Chris.Bunner
Tentative fix for CIS test failure.
Change 3804236 by Chris.Bunner
Additional logging for case where file write silently fails, report platform-specific error.
Change 3804303 by zachary.wilson
Cleaning up assets in QAGame saved with empty engine versions to resolve warnings seen when launching on
Change 3804410 by Chris.Bunner
Added additional logging when automated screenshot test fails due to size mismatch.
Mismatched bounds are colored red in the delta.
Change 3804455 by Mark.Satterthwaite
Fix a small number of persistent memory leaks on the Mac build that slowly consume more and more memory as you use the Editor - interacting with menu's was particularly egregious as each NSMenu would leak after you move away.
#jira NA
Change 3804667 by Chris.Bunner
Speculative CIS fixes.
Change 3806008 by Chris.Bunner
Partially reimplementing backed-out CL 3804181 to improve consistency of how automated screenshot test settings are applied/restored.
#tests CIS preflight job 8174412
Change 3806909 by Mark.Satterthwaite
Use the vertex-shader's in-out mask to ensure that we only validate legitmate vertex-streams in Metal's DrawIndexedPrimitive implementation.
#jira UE-53046
Change 3807059 by laz.matech
Checking in QAGame Rendering Map, QA-PhysicalLightingUnits, for testing Physical Light Units.
Wanted to get this in before copy up.
#Jira none
Change 3807726 by Chris.Bunner
Removed a check that we can't fix up. The check hits unbound buffers which it assumes means a failure but is actually due to m.v.fetch. We don't have the information available to know which are which removed from the input without reading from the shader.
#jira UE-53046
Change 3807800 by Guillaume.Abadie
Fixes some warning in shader headers.
Change 3807804 by Guillaume.Abadie
Back out changelist 3807800
Change 3807807 by Guillaume.Abadie
Relands shader header warnings.
Change 3808046 by Chris.Bunner
Dropping a new automated test error back to a warning as this may lead to genuine issues being ignored in the short term.
Change 3809579 by Chris.Bunner
Back out changelist 3774677.
#jira UE-53483
Change 3809620 by Chris.Bunner
Updating animated cloth test screenshot.
Change 3803629 by Chris.Bunner
Rebuilt CornellBox and DistanceField test maps, updated screenshots.
Change 3787045 by Guillaume.Abadie
Moves some global samplers to Common.ush
Change 3809756 by Chris.Bunner
Updating animated cloth test screenshot.
[CL 3809764 by Chris Bunner in Main branch]
2017-12-15 12:47:47 -05:00
FGlobalShader : : ModifyCompilationEnvironment ( Parameters , OutEnvironment ) ;
2015-07-29 16:42:44 -04:00
OutEnvironment . SetDefine ( TEXT ( " SUBSURFACE_RADIUS_SCALE " ) , SUBSURFACE_RADIUS_SCALE ) ;
OutEnvironment . SetDefine ( TEXT ( " SUBSURFACE_KERNEL_SIZE " ) , SUBSURFACE_KERNEL_SIZE ) ;
2014-03-14 14:13:41 -04:00
}
2019-06-11 18:27:07 -04:00
FSubsurfaceShader ( ) = default ;
FSubsurfaceShader ( const ShaderMetaType : : CompiledShaderInitializerType & Initializer )
2014-03-14 14:13:41 -04:00
: FGlobalShader ( Initializer )
2019-06-11 18:27:07 -04:00
{ }
} ;
2019-07-12 11:50:25 -04:00
// Encapsulates the post processing subsurface scattering common pixel shader.
2019-06-11 18:27:07 -04:00
class FSubsurfaceVisualizePS : public FSubsurfaceShader
{
public :
DECLARE_GLOBAL_SHADER ( FSubsurfaceVisualizePS ) ;
SHADER_USE_PARAMETER_STRUCT ( FSubsurfaceVisualizePS , FSubsurfaceShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2021-03-30 02:33:35 -04:00
SHADER_PARAMETER_RDG_UNIFORM_BUFFER ( FStrataGlobalUniformParameters , Strata )
2019-06-11 18:27:07 -04:00
SHADER_PARAMETER_STRUCT_INCLUDE ( FSubsurfaceParameters , Subsurface )
SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , SubsurfaceInput0 )
SHADER_PARAMETER_TEXTURE ( Texture2D , MiniFontTexture )
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler0 )
RENDER_TARGET_BINDING_SLOTS ( )
END_SHADER_PARAMETER_STRUCT ( )
} ;
IMPLEMENT_GLOBAL_SHADER ( FSubsurfaceVisualizePS , " /Engine/Private/PostProcessSubsurface.usf " , " VisualizePS " , SF_Pixel ) ;
2019-04-01 19:37:48 -04:00
// Encapsulates a simple copy pixel shader.
class FSubsurfaceViewportCopyPS : public FSubsurfaceShader
{
DECLARE_GLOBAL_SHADER ( FSubsurfaceViewportCopyPS ) ;
SHADER_USE_PARAMETER_STRUCT ( FSubsurfaceViewportCopyPS , FSubsurfaceShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2019-04-23 13:26:51 -04:00
SHADER_PARAMETER_RDG_TEXTURE ( Texture2D , SubsurfaceInput0_Texture )
2019-04-16 17:12:15 -04:00
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler0 )
2019-04-01 19:37:48 -04:00
RENDER_TARGET_BINDING_SLOTS ( )
END_SHADER_PARAMETER_STRUCT ( ) ;
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
{
2019-08-13 13:51:12 -04:00
return IsFeatureLevelSupported ( Parameters . Platform , ERHIFeatureLevel : : SM5 ) ;
2019-04-01 19:37:48 -04:00
}
} ;
IMPLEMENT_GLOBAL_SHADER ( FSubsurfaceViewportCopyPS , " /Engine/Private/PostProcessSubsurface.usf " , " SubsurfaceViewportCopyPS " , SF_Pixel ) ;
2019-08-13 17:16:21 -04:00
//-------------------------------------------------------------------------------------------
// Indirect dispatch class and functions
//-------------------------------------------------------------------------------------------
// Subsurface uniform buffer layout
BEGIN_GLOBAL_SHADER_PARAMETER_STRUCT ( FSubsurfaceUniformParameters , )
2019-08-19 13:27:06 -04:00
SHADER_PARAMETER ( uint32 , MaxGroupCount )
2021-10-29 12:53:33 -04:00
SHADER_PARAMETER ( uint32 , bRectPrimitive )
2019-08-13 17:16:21 -04:00
END_GLOBAL_SHADER_PARAMETER_STRUCT ( )
IMPLEMENT_GLOBAL_SHADER_PARAMETER_STRUCT ( FSubsurfaceUniformParameters , " SubsurfaceUniformParameters " ) ;
typedef TUniformBufferRef < FSubsurfaceUniformParameters > FSubsurfaceUniformRef ;
// Return a uniform buffer with values filled and with single frame lifetime
FSubsurfaceUniformRef CreateUniformBuffer ( FViewInfo const & View , int32 MaxGroupCount )
{
FSubsurfaceUniformParameters Parameters ;
Parameters . MaxGroupCount = MaxGroupCount ;
2021-10-29 12:53:33 -04:00
Parameters . bRectPrimitive = GRHISupportsRectTopology ;
2019-08-13 17:16:21 -04:00
return FSubsurfaceUniformRef : : CreateUniformBufferImmediate ( Parameters , UniformBuffer_SingleFrame ) ;
}
class FSubsurfaceInitValueBufferCS : public FSubsurfaceShader
2019-06-11 18:27:07 -04:00
{
public :
2019-08-13 17:16:21 -04:00
DECLARE_GLOBAL_SHADER ( FSubsurfaceInitValueBufferCS ) ;
SHADER_USE_PARAMETER_STRUCT ( FSubsurfaceInitValueBufferCS , FSubsurfaceShader ) ;
static void ModifyCompilationEnvironment ( const FGlobalShaderPermutationParameters & Parameters , FShaderCompilerEnvironment & OutEnvironment )
{
2020-12-04 15:46:10 -04:00
FSubsurfaceShader : : ModifyCompilationEnvironment ( Parameters , OutEnvironment ) ;
2019-08-13 17:16:21 -04:00
OutEnvironment . SetDefine ( TEXT ( " SUBSURFACE_BURLEY_COMPUTE " ) , 1 ) ;
}
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2021-10-29 12:53:33 -04:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWTileTypeCountBuffer )
2019-08-19 13:27:06 -04:00
END_SHADER_PARAMETER_STRUCT ( )
2019-08-13 17:16:21 -04:00
2019-08-19 13:27:06 -04:00
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
2019-08-13 17:16:21 -04:00
{
return IsFeatureLevelSupported ( Parameters . Platform , ERHIFeatureLevel : : SM5 ) ;
}
} ;
IMPLEMENT_GLOBAL_SHADER ( FSubsurfaceInitValueBufferCS , " /Engine/Private/PostProcessSubsurface.usf " , " InitValueBufferCS " , SF_Compute ) ;
2021-10-29 12:53:33 -04:00
class FFillMipsConditionBufferCS : public FSubsurfaceShader
{
public :
DECLARE_GLOBAL_SHADER ( FFillMipsConditionBufferCS ) ;
SHADER_USE_PARAMETER_STRUCT ( FFillMipsConditionBufferCS , FSubsurfaceShader ) ;
static void ModifyCompilationEnvironment ( const FGlobalShaderPermutationParameters & Parameters , FShaderCompilerEnvironment & OutEnvironment )
{
FSubsurfaceShader : : ModifyCompilationEnvironment ( Parameters , OutEnvironment ) ;
OutEnvironment . SetDefine ( TEXT ( " SUBSURFACE_BURLEY_COMPUTE " ) , 1 ) ;
}
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
SHADER_PARAMETER ( uint32 , MinGenerateMipsTileCount )
SHADER_PARAMETER ( uint32 , Offset )
SHADER_PARAMETER_RDG_BUFFER_SRV ( Buffer < uint > , TileTypeCountBuffer )
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWMipsConditionBuffer )
END_SHADER_PARAMETER_STRUCT ( )
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
{
return IsFeatureLevelSupported ( Parameters . Platform , ERHIFeatureLevel : : SM5 ) ;
}
} ;
IMPLEMENT_GLOBAL_SHADER ( FFillMipsConditionBufferCS , " /Engine/Private/PostProcessSubsurface.usf " , " FillMipsConditionBufferCS " , SF_Compute ) ;
2019-08-13 17:16:21 -04:00
class FSubsurfaceBuildIndirectDispatchArgsCS : public FSubsurfaceShader
{
public :
DECLARE_GLOBAL_SHADER ( FSubsurfaceBuildIndirectDispatchArgsCS ) ;
SHADER_USE_PARAMETER_STRUCT ( FSubsurfaceBuildIndirectDispatchArgsCS , FSubsurfaceShader )
2019-08-19 13:27:06 -04:00
static void ModifyCompilationEnvironment ( const FGlobalShaderPermutationParameters & Parameters , FShaderCompilerEnvironment & OutEnvironment )
2019-08-13 17:16:21 -04:00
{
2020-12-04 15:46:10 -04:00
FSubsurfaceShader : : ModifyCompilationEnvironment ( Parameters , OutEnvironment ) ;
2019-08-13 17:16:21 -04:00
OutEnvironment . SetDefine ( TEXT ( " SUBSURFACE_BURLEY_COMPUTE " ) , 1 ) ;
}
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
SHADER_PARAMETER_STRUCT_REF ( FSubsurfaceUniformParameters , SubsurfaceUniformParameters )
2019-09-03 19:19:28 -04:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWIndirectDispatchArgsBuffer )
2021-10-29 12:53:33 -04:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWIndirectDrawArgsBuffer )
SHADER_PARAMETER_RDG_BUFFER_SRV ( Buffer < uint > , TileTypeCountBuffer )
2019-08-19 13:27:06 -04:00
END_SHADER_PARAMETER_STRUCT ( )
2019-08-13 17:16:21 -04:00
2019-08-19 13:27:06 -04:00
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
2019-08-13 17:16:21 -04:00
{
return IsFeatureLevelSupported ( Parameters . Platform , ERHIFeatureLevel : : SM5 ) ;
}
} ;
IMPLEMENT_GLOBAL_SHADER ( FSubsurfaceBuildIndirectDispatchArgsCS , " /Engine/Private/PostProcessSubsurface.usf " , " BuildIndirectDispatchArgsCS " , SF_Compute ) ;
class FSubsurfaceIndirectDispatchSetupCS : public FSubsurfaceShader
{
public :
DECLARE_GLOBAL_SHADER ( FSubsurfaceIndirectDispatchSetupCS ) ;
SHADER_USE_PARAMETER_STRUCT ( FSubsurfaceIndirectDispatchSetupCS , FSubsurfaceShader )
2019-08-19 13:27:06 -04:00
static void ModifyCompilationEnvironment ( const FGlobalShaderPermutationParameters & Parameters , FShaderCompilerEnvironment & OutEnvironment )
2019-08-13 17:16:21 -04:00
{
2020-12-04 15:46:10 -04:00
FSubsurfaceShader : : ModifyCompilationEnvironment ( Parameters , OutEnvironment ) ;
2019-08-13 17:16:21 -04:00
OutEnvironment . SetDefine ( TEXT ( " SUBSURFACE_BURLEY_COMPUTE " ) , 1 ) ;
}
2019-06-11 18:27:07 -04:00
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2021-03-30 02:33:35 -04:00
SHADER_PARAMETER_RDG_UNIFORM_BUFFER ( FStrataGlobalUniformParameters , Strata )
2019-06-11 18:27:07 -04:00
SHADER_PARAMETER_STRUCT_INCLUDE ( FSubsurfaceParameters , Subsurface )
2019-10-01 13:03:04 -04:00
SHADER_PARAMETER_STRUCT ( FScreenPassTextureViewportParameters , Output )
2019-06-11 18:27:07 -04:00
SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , SubsurfaceInput0 )
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler0 )
2019-08-13 17:16:21 -04:00
SHADER_PARAMETER_RDG_TEXTURE_UAV ( RWTexture2D , SetupTexture )
2019-09-03 19:19:28 -04:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWSeparableGroupBuffer )
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWBurleyGroupBuffer )
2021-10-29 12:53:33 -04:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWAllGroupBuffer )
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWTileTypeCountBuffer )
2020-09-24 00:43:27 -04:00
SHADER_PARAMETER_RDG_TEXTURE_UAV ( RWTexture2D , ProfileIdTexture )
2019-08-13 17:16:21 -04:00
SHADER_PARAMETER_STRUCT_REF ( FSubsurfaceUniformParameters , SubsurfaceUniformParameters )
2019-06-11 18:27:07 -04:00
END_SHADER_PARAMETER_STRUCT ( )
class FDimensionHalfRes : SHADER_PERMUTATION_BOOL ( " SUBSURFACE_HALF_RES " ) ;
class FDimensionCheckerboard : SHADER_PERMUTATION_BOOL ( " SUBSURFACE_PROFILE_CHECKERBOARD " ) ;
2019-09-03 19:19:28 -04:00
class FRunningInSeparable : SHADER_PERMUTATION_BOOL ( " SUBSURFACE_FORCE_SEPARABLE " ) ;
2020-09-24 00:43:27 -04:00
class FDimensionEnableProfileIDCache : SHADER_PERMUTATION_BOOL ( " ENABLE_PROFILE_ID_CACHE " ) ;
using FPermutationDomain = TShaderPermutationDomain < FDimensionHalfRes , FDimensionCheckerboard , FRunningInSeparable , FDimensionEnableProfileIDCache > ;
2019-06-11 18:27:07 -04:00
} ;
2019-08-13 17:16:21 -04:00
IMPLEMENT_GLOBAL_SHADER ( FSubsurfaceIndirectDispatchSetupCS , " /Engine/Private/PostProcessSubsurface.usf " , " SetupIndirectCS " , SF_Compute ) ;
2019-06-11 18:27:07 -04:00
2019-08-13 17:16:21 -04:00
class FSubsurfaceIndirectDispatchCS : public FSubsurfaceShader
2019-06-11 18:27:07 -04:00
{
public :
2019-08-13 17:16:21 -04:00
DECLARE_GLOBAL_SHADER ( FSubsurfaceIndirectDispatchCS ) ;
SHADER_USE_PARAMETER_STRUCT ( FSubsurfaceIndirectDispatchCS , FSubsurfaceShader ) ;
static void ModifyCompilationEnvironment ( const FGlobalShaderPermutationParameters & Parameters , FShaderCompilerEnvironment & OutEnvironment )
{
2020-12-04 15:46:10 -04:00
FSubsurfaceShader : : ModifyCompilationEnvironment ( Parameters , OutEnvironment ) ;
2019-08-13 17:16:21 -04:00
OutEnvironment . SetDefine ( TEXT ( " SUBSURFACE_BURLEY_COMPUTE " ) , 1 ) ;
OutEnvironment . SetDefine ( TEXT ( " ENABLE_VELOCITY " ) , 1 ) ;
2021-10-29 12:53:33 -04:00
OutEnvironment . SetDefine ( TEXT ( " SUBSURFACE_GROUP_SIZE " ) , FSubsurfaceTiles : : TileSize ) ;
2019-08-13 17:16:21 -04:00
}
2019-06-11 18:27:07 -04:00
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2021-03-30 02:33:35 -04:00
SHADER_PARAMETER_RDG_UNIFORM_BUFFER ( FStrataGlobalUniformParameters , Strata )
2019-06-11 18:27:07 -04:00
SHADER_PARAMETER_STRUCT_INCLUDE ( FSubsurfaceParameters , Subsurface )
2019-10-01 13:03:04 -04:00
SHADER_PARAMETER_STRUCT ( FScreenPassTextureViewportParameters , Output )
2019-08-13 17:16:21 -04:00
SHADER_PARAMETER_RDG_TEXTURE_UAV ( RWTexture2D , SSSColorUAV )
SHADER_PARAMETER_RDG_TEXTURE_UAV ( RWTexture2D , HistoryUAV )
2019-09-03 19:19:28 -04:00
SHADER_PARAMETER_RDG_BUFFER_SRV ( Buffer < uint > , GroupBuffer )
2021-10-29 12:53:33 -04:00
SHADER_PARAMETER_RDG_BUFFER_SRV ( Buffer < uint > , TileTypeCountBuffer )
2021-03-17 06:03:08 -04:00
RDG_BUFFER_ACCESS ( IndirectDispatchArgsBuffer , ERHIAccess : : IndirectArgs )
2019-06-11 18:27:07 -04:00
SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , SubsurfaceInput0 )
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler0 )
2019-08-13 17:16:21 -04:00
SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , SubsurfaceInput1 ) // History
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler1 )
SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , SubsurfaceInput2 ) // Profile mask | Velocity
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler2 )
2021-08-23 15:22:35 -04:00
SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , SubsurfaceInput3 ) // Control Variates
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler3 )
2020-09-24 00:43:27 -04:00
SHADER_PARAMETER_RDG_TEXTURE_UAV ( RWTexture2D , ProfileIdTexture )
2019-06-11 18:27:07 -04:00
END_SHADER_PARAMETER_STRUCT ( )
// Direction of the 1D separable filter.
enum class EDirection : uint32
2014-03-14 14:13:41 -04:00
{
2019-06-11 18:27:07 -04:00
Horizontal ,
Vertical ,
MAX
} ;
2019-08-13 17:16:21 -04:00
enum class ESubsurfacePass : uint32
{
PassOne , // Burley sampling (or Horizontal) pass pass one
PassTwo , // Variance updating (or Vertical) pass pass two
MAX
} ;
2019-06-11 18:27:07 -04:00
// Controls the quality (number of samples) of the blur kernel.
enum class EQuality : uint32
{
Low ,
Medium ,
High ,
MAX
} ;
2020-09-24 00:43:27 -04:00
enum class EBilateralFilterKernelFunctionType : uint32
2019-06-11 18:27:07 -04:00
{
2020-09-24 00:43:27 -04:00
Depth ,
DepthAndNormal ,
2019-08-13 17:16:21 -04:00
MAX
} ;
enum class ESubsurfaceType : uint32
{
BURLEY ,
SEPARABLE ,
MAX
} ;
2020-07-06 18:58:26 -04:00
static const TCHAR * GetEventName ( EDirection Direction )
{
static const TCHAR * const kEventNames [ ] = {
TEXT ( " Horizontal " ) ,
TEXT ( " Vertical " ) ,
} ;
static_assert ( UE_ARRAY_COUNT ( kEventNames ) = = int32 ( EDirection : : MAX ) , " Fix me " ) ;
return kEventNames [ int32 ( Direction ) ] ;
}
static const TCHAR * GetEventName ( ESubsurfacePass SubsurfacePass )
{
static const TCHAR * const kEventNames [ ] = {
TEXT ( " PassOne " ) ,
TEXT ( " PassTwo " ) ,
} ;
static_assert ( UE_ARRAY_COUNT ( kEventNames ) = = int32 ( ESubsurfacePass : : MAX ) , " Fix me " ) ;
return kEventNames [ int32 ( SubsurfacePass ) ] ;
}
static const TCHAR * GetEventName ( EQuality Quality )
{
static const TCHAR * const kEventNames [ ] = {
TEXT ( " Low " ) ,
TEXT ( " Medium " ) ,
TEXT ( " High " ) ,
} ;
static_assert ( UE_ARRAY_COUNT ( kEventNames ) = = int32 ( EQuality : : MAX ) , " Fix me " ) ;
return kEventNames [ int32 ( Quality ) ] ;
}
static const TCHAR * GetEventName ( ESubsurfaceType SubsurfaceType )
{
static const TCHAR * const kEventNames [ ] = {
TEXT ( " Burley " ) ,
TEXT ( " Separable " ) ,
} ;
static_assert ( UE_ARRAY_COUNT ( kEventNames ) = = int32 ( ESubsurfaceType : : MAX ) , " Fix me " ) ;
return kEventNames [ int32 ( SubsurfaceType ) ] ;
}
2019-08-13 17:16:21 -04:00
class FSubsurfacePassFunction : SHADER_PERMUTATION_ENUM_CLASS ( " SUBSURFACE_PASS " , ESubsurfacePass ) ;
class FDimensionQuality : SHADER_PERMUTATION_ENUM_CLASS ( " SUBSURFACE_QUALITY " , EQuality ) ;
2020-09-24 00:43:27 -04:00
class FBilateralFilterKernelFunctionType : SHADER_PERMUTATION_ENUM_CLASS ( " BILATERAL_FILTER_KERNEL_FUNCTION_TYPE " , EBilateralFilterKernelFunctionType ) ;
2019-08-13 17:16:21 -04:00
class FSubsurfaceType : SHADER_PERMUTATION_ENUM_CLASS ( " SUBSURFACE_TYPE " , ESubsurfaceType ) ;
class FDimensionHalfRes : SHADER_PERMUTATION_BOOL ( " SUBSURFACE_HALF_RES " ) ;
2019-09-03 19:19:28 -04:00
class FRunningInSeparable : SHADER_PERMUTATION_BOOL ( " SUBSURFACE_FORCE_SEPARABLE " ) ;
2020-09-24 00:43:27 -04:00
class FDimensionEnableProfileIDCache : SHADER_PERMUTATION_BOOL ( " ENABLE_PROFILE_ID_CACHE " ) ;
using FPermutationDomain = TShaderPermutationDomain < FSubsurfacePassFunction , FDimensionQuality ,
FBilateralFilterKernelFunctionType , FSubsurfaceType , FDimensionHalfRes , FRunningInSeparable , FDimensionEnableProfileIDCache > ;
2019-08-13 17:16:21 -04:00
2019-09-03 19:19:28 -04:00
// Returns the sampler state based on the requested SSS filter CVar setting and half resolution setting.
static FRHISamplerState * GetSamplerState ( bool bHalfRes )
2019-08-13 17:16:21 -04:00
{
if ( GetSSSFilter ( ) )
2019-09-03 19:19:28 -04:00
{ // Trilinear is used for mipmap sampling in full resolution
if ( bHalfRes )
{
return TStaticSamplerState < SF_Bilinear , AM_Border , AM_Border , AM_Border > : : GetRHI ( ) ; //SF_Bilinear
}
else
{
return TStaticSamplerState < SF_Trilinear , AM_Border , AM_Border , AM_Border > : : GetRHI ( ) ; //SF_Bilinear
}
2019-06-11 18:27:07 -04:00
}
else
{
return TStaticSamplerState < SF_Point , AM_Border , AM_Border , AM_Border > : : GetRHI ( ) ;
}
2014-03-14 14:13:41 -04:00
}
2019-06-11 18:27:07 -04:00
// Returns the SSS quality level requested by the SSS SampleSet CVar setting.
static EQuality GetQuality ( )
2014-03-14 14:13:41 -04:00
{
2019-08-13 17:16:21 -04:00
return static_cast < FSubsurfaceIndirectDispatchCS : : EQuality > (
2019-06-11 18:27:07 -04:00
FMath : : Clamp (
2019-08-13 17:16:21 -04:00
GetSSSSampleSet ( ) ,
static_cast < int32 > ( FSubsurfaceIndirectDispatchCS : : EQuality : : Low ) ,
static_cast < int32 > ( FSubsurfaceIndirectDispatchCS : : EQuality : : High ) ) ) ;
}
2020-09-24 00:43:27 -04:00
static EBilateralFilterKernelFunctionType GetBilateralFilterKernelFunctionType ( )
2019-08-13 17:16:21 -04:00
{
2020-09-24 00:43:27 -04:00
return static_cast < FSubsurfaceIndirectDispatchCS : : EBilateralFilterKernelFunctionType > (
FMath : : Clamp (
GetSSSBurleyBilateralFilterKernelFunctionType ( ) ,
static_cast < int32 > ( FSubsurfaceIndirectDispatchCS : : EBilateralFilterKernelFunctionType : : Depth ) ,
static_cast < int32 > ( FSubsurfaceIndirectDispatchCS : : EBilateralFilterKernelFunctionType : : DepthAndNormal ) ) ) ;
2014-03-14 14:13:41 -04:00
}
2021-10-29 12:53:33 -04:00
static FSubsurfaceTiles : : ETileType ToSubsurfaceTileType ( ESubsurfaceType Type )
{
FSubsurfaceTiles : : ETileType TileType = FSubsurfaceTiles : : ETileType : : AFIS ;
switch ( Type )
{
case ESubsurfaceType : : BURLEY : TileType = FSubsurfaceTiles : : ETileType : : AFIS ; break ;
case ESubsurfaceType : : SEPARABLE : TileType = FSubsurfaceTiles : : ETileType : : SEPARABLE ; break ;
}
return TileType ;
}
2014-03-14 14:13:41 -04:00
} ;
2019-08-13 17:16:21 -04:00
IMPLEMENT_GLOBAL_SHADER ( FSubsurfaceIndirectDispatchCS , " /Engine/Private/PostProcessSubsurface.usf " , " MainIndirectDispatchCS " , SF_Compute ) ;
// resolve textures that is not SRV
// Encapsulates a simple copy pixel shader.
class FSubsurfaceSRVResolvePS : public FSubsurfaceShader
{
DECLARE_GLOBAL_SHADER ( FSubsurfaceSRVResolvePS ) ;
SHADER_USE_PARAMETER_STRUCT ( FSubsurfaceSRVResolvePS , FSubsurfaceShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
SHADER_PARAMETER_RDG_TEXTURE ( Texture2D , SubsurfaceInput0_Texture )
2021-10-29 12:53:33 -04:00
RDG_BUFFER_ACCESS ( IndirectDispatchArgsBuffer , ERHIAccess : : IndirectArgs )
2019-08-13 17:16:21 -04:00
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler0 )
RENDER_TARGET_BINDING_SLOTS ( )
2019-08-19 13:27:06 -04:00
END_SHADER_PARAMETER_STRUCT ( ) ;
2019-08-13 17:16:21 -04:00
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
{
return IsFeatureLevelSupported ( Parameters . Platform , ERHIFeatureLevel : : SM5 ) ;
}
} ;
IMPLEMENT_GLOBAL_SHADER ( FSubsurfaceSRVResolvePS , " /Engine/Private/PostProcessSubsurface.usf " , " SubsurfaceViewportCopyPS " , SF_Pixel ) ;
2019-10-01 13:03:04 -04:00
FRDGTextureRef CreateBlackUAVTexture ( FRDGBuilder & GraphBuilder , FRDGTextureDesc SRVDesc , const TCHAR * Name , const FViewInfo & View ,
2019-08-13 17:16:21 -04:00
const FScreenPassTextureViewport & SceneViewport )
{
2019-08-19 13:27:06 -04:00
# ifdef USE_CUSTOM_CLEAR_UAV
2020-09-24 00:43:27 -04:00
SRVDesc . Flags | = TexCreate_ShaderResource | TexCreate_UAV ;
2019-08-13 17:16:21 -04:00
FRDGTextureRef SRVTextureOutput = GraphBuilder . CreateTexture ( SRVDesc , Name ) ;
FSubsurfaceSRVResolvePS : : FParameters * PassParameters = GraphBuilder . AllocParameters < FSubsurfaceSRVResolvePS : : FParameters > ( ) ;
PassParameters - > RenderTargets [ 0 ] = FRenderTargetBinding ( SRVTextureOutput , ERenderTargetLoadAction : : ENoAction ) ;
PassParameters - > SubsurfaceInput0_Texture = GraphBuilder . RegisterExternalTexture ( GSystemTextures . BlackDummy ) ;
PassParameters - > SubsurfaceSampler0 = TStaticSamplerState < SF_Point , AM_Clamp , AM_Clamp , AM_Clamp > : : GetRHI ( ) ;
TShaderMapRef < FSubsurfaceSRVResolvePS > PixelShader ( View . ShaderMap ) ;
2021-11-18 14:37:34 -05:00
AddDrawScreenPass ( GraphBuilder , RDG_EVENT_NAME ( " SSS::ClearUAV " ) , View , SceneViewport , SceneViewport , PixelShader , PassParameters ) ;
2019-08-13 17:16:21 -04:00
# else
FRDGTextureRef SRVTextureOutput = GraphBuilder . CreateTexture ( SRVDesc , Name ) ;
FRDGTextureUAVDesc UAVClearDesc ( SRVTextureOutput , 0 ) ;
2021-11-18 14:37:34 -05:00
ClearUAV ( GraphBuilder , FRDGEventName ( TEXT ( " SSS::ClearUAV " ) ) , GraphBuilder . CreateUAV ( UAVClearDesc ) , FLinearColor : : Black ) ;
2019-08-13 17:16:21 -04:00
# endif
return SRVTextureOutput ;
}
2021-10-29 12:53:33 -04:00
// create a black UAV only when CondtionBuffer[Offset] > 0.
FRDGTextureRef CreateBlackUAVTexture ( FRDGBuilder & GraphBuilder , FRDGTextureDesc SRVDesc , const TCHAR * TextureName , FRDGEventName & & PassName ,
const FScreenPassTextureViewport & SceneViewport , FRDGBufferRef ConditionBuffer , uint32 Offset )
{
SRVDesc . Flags | = TexCreate_ShaderResource | TexCreate_UAV ;
FRDGTextureRef TextureOutput = GraphBuilder . CreateTexture ( SRVDesc , TextureName ) ;
AddConditionalClearBlackUAVPass (
GraphBuilder ,
Forward < FRDGEventName > ( PassName ) ,
TextureOutput ,
SceneViewport ,
ConditionBuffer ,
Offset ) ;
return TextureOutput ;
}
2019-08-13 17:16:21 -04:00
// Helper function to use external textures for the current GraphBuilder.
// When the texture is null, we use BlackDummy.
FRDGTextureRef RegisterExternalRenderTarget ( FRDGBuilder & GraphBuilder , TRefCountPtr < IPooledRenderTarget > * PtrExternalTexture , FIntPoint CurentViewExtent , const TCHAR * Name )
{
FRDGTextureRef RegisteredTexture = NULL ;
if ( ! PtrExternalTexture | | ! ( * PtrExternalTexture ) )
{
RegisteredTexture = GraphBuilder . RegisterExternalTexture ( GSystemTextures . BlackDummy , Name ) ;
}
else
{
if ( CurentViewExtent ! = ( * PtrExternalTexture ) - > GetDesc ( ) . Extent )
{
RegisteredTexture = GraphBuilder . RegisterExternalTexture ( GSystemTextures . BlackDummy , Name ) ;
}
else
{
RegisteredTexture = GraphBuilder . RegisterExternalTexture ( * PtrExternalTexture , Name ) ;
}
}
return RegisteredTexture ;
}
2014-03-14 14:13:41 -04:00
2019-06-11 18:27:07 -04:00
// Encapsulates the post processing subsurface recombine pixel shader.
class FSubsurfaceRecombinePS : public FSubsurfaceShader
2014-03-14 14:13:41 -04:00
{
2019-06-11 18:27:07 -04:00
DECLARE_GLOBAL_SHADER ( FSubsurfaceRecombinePS ) ;
SHADER_USE_PARAMETER_STRUCT ( FSubsurfaceRecombinePS , FSubsurfaceShader ) ;
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3357411)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3244756 on 2017/01/03 by Marcus.Wassmer
Copying //Tasks/UE4/Dev-Niagara@3244743 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3248667 on 2017/01/05 by Olaf.Piesche
Resaving default asset because of engine verison issue; maybe unnecessary, but resaving niagara engine content to be sure
#jira UE-40160
Change 3249324 on 2017/01/06 by Marcus.Wassmer
Resave with an actual version to stop cook warning
Change 3249611 on 2017/01/06 by Marcus.Wassmer
Just remove warning-causing niagara data for now.
Change 3308052 on 2017/02/16 by Rolando.Caloca
DR - Check for Vulkan SDK, and only use it if it's newer or the same as the headers we distribute
Change 3308109 on 2017/02/16 by Rolando.Caloca
DR - Upgrade glslang to 1.0.39.1
Change 3308111 on 2017/02/16 by Rolando.Caloca
DR - Update Vulkan distribution to 1.0.39.1
Change 3308153 on 2017/02/16 by Rolando.Caloca
DR - Updated glslang libs
Change 3308842 on 2017/02/17 by Rolando.Caloca
DR - Fixed copy/paste
Change 3310007 on 2017/02/17 by Chris.Bunner
Back out CL 3221219 - causing MIC generation issues and superseded by CL 3273971.
#jira UE-37792
Change 3310154 on 2017/02/17 by Chris.Bunner
Assert when attempting to add a custom material attribute already in the base attributes list.
Change 3310155 on 2017/02/17 by Chris.Bunner
PR #3231: Validate material index before accessing (Contributed by projectgheist)
#jira UE-41774, UE-41788
Change 3310162 on 2017/02/17 by Chris.Bunner
PR #3252: Added MobileMaterialInterface to UsedMaterials (Contributed by projectgheist)
#jira UE-41823, UE-41950
Change 3310176 on 2017/02/17 by Chris.Bunner
Merging CL 3233886: AMD HDR support (requires r.AMDSupportsHDRDisplayOutput=1 in ini).
Update to AGS 5.0.5.
Partial code tidy up.
Change 3310187 on 2017/02/17 by Chris.Bunner
Preserve constant expressions rather than always casting after translating a material attribute. Losing the notion of constant means we can't correctly detect used properties and falsely enable e.g. PDO. Happened because of the incorrect component masks in BreakMaterialNodes which then had to be downcast to the correct type which is done as an inline fragment rather than swizzle expression.
#jira UE-41594
Change 3310215 on 2017/02/17 by Chris.Bunner
Prevent SpeedTree node compiling for skeletal meshes (not supported as uses more UV sets than available).
More descriptive error for missing Cubemap UV input on TextureSample material node .
#jira UE-33098
Change 3310838 on 2017/02/18 by Joe.Graf
Moved some private functions to public for a licensee
#CodeReview: matt.kuhlenschmidt
#rb: n/a
Change 3311876 on 2017/02/20 by Rolando.Caloca
DR - Expose skin cache cvar r.SkinCache.AccumulationBufferSizeInKB
#jira UE-42014
Change 3314139 on 2017/02/21 by Rolando.Caloca
DR - Minor cleanup pass
- Remove FVulkanPendingState
- Renamed some classes for clarity
- Hoist pending UAVs for flush out to pending compute state
Change 3314642 on 2017/02/21 by Rolando.Caloca
DR - Some more renaming
Change 3315431 on 2017/02/21 by Ben.Salem
Properly set default values for test time out and tick. We now will default to ticking once per second, and tracking the macro stats of GPU/Render/Game thread time.
#tests Ran showdown demo several times
Change 3316710 on 2017/02/22 by Rolando.Caloca
DR - hlslcc - Fix refract intrinsic
Change 3316718 on 2017/02/22 by Rolando.Caloca
DR - hlslcc - Built libs to pick up change from 3316710 - refract fix
Change 3316820 on 2017/02/22 by Benjamin.Hyder
updating Tm-TrigNodes map
Change 3317192 on 2017/02/22 by Benjamin.Hyder
Updating QA-Decals map
Change 3317528 on 2017/02/22 by Benjamin.Hyder
Updating QA-Decals map
Change 3317639 on 2017/02/22 by Benjamin.Hyder
Updating Decal on Complex Mesh example in QA-Decals
Change 3317764 on 2017/02/22 by Benjamin.Hyder
Final updates to QA-Decals
Change 3318319 on 2017/02/22 by Rolando.Caloca
DR - minor reorg/rename
Change 3318379 on 2017/02/22 by Rolando.Caloca
DR - more cleanup
Change 3321181 on 2017/02/24 by Rolando.Caloca
DR - Fix GL bug
Change 3321247 on 2017/02/24 by Rolando.Caloca
DR - Fix misc bugs
Change 3321898 on 2017/02/24 by Chris.Bunner
Only issue clear TLV dispatch if required.
#jira UERNDR-193
Change 3321904 on 2017/02/24 by Chris.Bunner
Added comment for potential future optimization.
Change 3322013 on 2017/02/24 by Uriel.Doyon
Fixed separate translucency being affected by Gaussian DOF
#jira UE-40489
Change 3322517 on 2017/02/24 by Uriel.Doyon
Fixed issue with InvestigateTexture command removing budget limit.
Fixed StreamingBounds show flag not working. It nows shows the streaming bound for the currently selected textures.
#jira UE-40485
Change 3323470 on 2017/02/27 by Chad.Garyet
Removing DDC job from dev-rendering
Change 3323479 on 2017/02/27 by Chad.Garyet
Removing RDU agent type
Change 3323519 on 2017/02/27 by Chad.Garyet
removing NCL/LHR/SEA agent types to clean up space
Change 3323639 on 2017/02/27 by Benjamin.Hyder
More updates to QA-Decals
Change 3324207 on 2017/02/27 by Uriel.Doyon
Fixed typo ScaleTexturesByGlobalMyBias -> ScaleTexturesByGlobalMipBias
Removed bad merge in FStreamingTextureLevelContext::GetBuildDataIndexRef
Change 3324396 on 2017/02/27 by Uriel.Doyon
Fixed an issue with the Streaming Bounds show flag interferring with the static level data initialization
#jira UE-40485
Change 3325227 on 2017/02/28 by Chris.Bunner
Fix-up AMD AGS libs.
Change 3325566 on 2017/02/28 by Uriel.Doyon
Fixed possible out-of-bound access in GetUsedTexture() when passing ERHIFeatureLevel::Num
Change 3326009 on 2017/02/28 by Uriel.Doyon
Better fix for 3325566, as the previous fix would ignore the material instance overrides.
Change 3327058 on 2017/03/01 by Benjamin.Hyder
Preparing TM_Shadermodels map for automation
Change 3328222 on 2017/03/01 by Chris.Bunner
Prevent decals from drawing in separate translucency pass. Whilst user control and material relevance were already removed, if the flag was checked before being disabled (by swapping to decal domain) this was still being read in the render loop, now explicitly ignores decals.
#jira UE-42449, UE-42446
Change 3329848 on 2017/03/02 by Uriel.Doyon
Added some extra logs to help track UE-42168
Change 3329977 on 2017/03/02 by Rolando.Caloca
DR - Fix bad clear value
Change 3330008 on 2017/03/02 by Benjamin.Hyder
More preparations for QA-Decals automation
Change 3330754 on 2017/03/02 by Daniel.Wright
Prominent comment explaining reflection env async compute usage and why it's not overlapped with anything
Change 3331451 on 2017/03/03 by Marc.Olano
Manually unroll simplex noise loop to avoid PSO bug on AMD/Metal
Change 3331839 on 2017/03/03 by Rolando.Caloca
DR - hlslcc - add missing file to project
Change 3332247 on 2017/03/03 by Rolando.Caloca
DR - Fix for integrated intel
PR #3305
#jira UE-42393
Change 3332259 on 2017/03/03 by Rolando.Caloca
DR - Fix bad index into pixel formats
PR #3237
#jira UE-41855
Change 3332305 on 2017/03/03 by Rolando.Caloca
DR - OpenGL SRV for index buffers
PR #3271
#jira UE-32618
Change 3332313 on 2017/03/03 by Rolando.Caloca
DR - Fix for integrated intel (properly)
PR #3305
#jira UE-42393
Change 3332317 on 2017/03/03 by Rolando.Caloca
DR - OpenGL SRV for index buffers (properly)
PR #3271
#jira UE-32618
Change 3332368 on 2017/03/03 by Rolando.Caloca
DR - Minor fixes so -sm4 and -sm5 can be used on windows with OpenGL/Vulkan
Change 3333690 on 2017/03/06 by Daniel.Wright
[Copy] Changing movable skylight properties no longer affects static draw lists
Change 3333693 on 2017/03/06 by Daniel.Wright
[Copy] Added 'r.AOListMeshDistanceFields' which dumps out mesh distance fields sorted by memory size, useful for directing content optimizations
Change 3333705 on 2017/03/06 by Daniel.Wright
[Copy] Mesh distance fields are now 8 bit fixed point by default, but can be changed back to 16 bit floating piont with a project setting.
* 8 bit uses half memory but introduces error for thin surfaces or large meshes.
Change 3333721 on 2017/03/06 by David.Hill
DecalProxy:
Copy float FadeScreenSize to FDeferredDecalProxy for use in the render thread. This avoids pointer chasing to the UDecalComponent (game thread component).
Change 3333772 on 2017/03/06 by Daniel.Wright
[Copy] Scene motion blur data is only updated for the main renderer frames. Fixes scene captures and planar reflections breaking object motion blur.
Change 3333790 on 2017/03/06 by Daniel.Wright
[Copy] Mesh distance field generation uses Embree, for a 2.5x speedup
* Can switch back to old kDOP generation with 'r.DistanceFieldBuild.UseEmbree 0' for debugging
Change 3333822 on 2017/03/06 by Daniel.Wright
[Copy] Moved mesh distance field code into MeshDistanceFieldUtilities.cpp
* Moved FMeshUtilities to its own header so the 8k line MeshUtilites.cpp file can be further split up
Change 3333827 on 2017/03/06 by Daniel.Wright
[Copy] Range compress 8bit distance fields - gets one extra bit of precision on average
Change 3333828 on 2017/03/06 by Daniel.Wright
[Copy] Raised High ShadowQuality to 2048 as 1024 for CSM is way too low
Change 3333831 on 2017/03/06 by Daniel.Wright
Non-editor compile fix
Change 3333836 on 2017/03/06 by Daniel.Wright
[Copy] Workaround for gobal distance field volume textures being bloated by 4x on PS4 due to the recommended tiling modes. They now use a 2d tiling mode which avoids the bloat, saving 96Mb.
Change 3333843 on 2017/03/06 by Daniel.Wright
[Copy] Added OcclusionExponent to skylight component
* Useful for brightening up indoors without losing contact shadows as MinOcclusion does
Change 3333845 on 2017/03/06 by Daniel.Wright
[Copy] Capsule shadow BP functions
Change 3333850 on 2017/03/06 by Daniel.Wright
[Copy] Added OcclusionCombineMode to skylight component
Change 3333854 on 2017/03/06 by Daniel.Wright
[Copy] Gnm properly registers clears as GPU work so those events show up in profilegpu
Change 3333857 on 2017/03/06 by Daniel.Wright
[Copy] Clear light attenuation for local lights with a quad covering their screen extents
* Clearing the entire light attenuation buffer costs .1ms on PS4. This optimization lowers the minimum cost of a shadow casting light from .15ms -> .03ms.
* Shadowed lights in Fortnite with 25 lights 3.7ms -> 1.42ms on PS4
Change 3333860 on 2017/03/06 by Daniel.Wright
[Copy] Flush deferred deletes when reallocating distance field atlas to reduce peak memory
Change 3333861 on 2017/03/06 by Daniel.Wright
[Copy] Disable all distance field features on Intel cards as HD 4000 hangs in the RHICreateTexture3D call to allocate the large atlas
Change 3333869 on 2017/03/06 by Daniel.Wright
[Copy] Volumetric Fog using a volume texture mapped to the camera frustum
* Volumetric fog can be enabled on an Exponential Height Fog component with additional controls
* Lights have a VolumetricScatteringIntensity
* New cvars r.VolumetricFog, r.VolumetricFog.GridPixelSize, r.VolumetricFog.GridSizeZ, r.VolumetricFog.DepthDistributionScale
* Lighting features supported:
* Directional light with CSM and a light function
* Point / spot lights without shadows / light functions / IES profiles
* Skylight with occlusion from distance fields
* Analytical height fog covers the view range past where the volumetric fog ends
* Temporal reprojection is used on the volumetric fog scattering and extinction to achieve stability
* Translucency integrates properly into volumetric fog
* Height fog StartDistance is not supported by volumetric fog and should be set to 0.
Change 3333894 on 2017/03/06 by Daniel.Wright
[Copy] Initialize GDummyVolumetricFogGlobalDataUniformBuffer outside of parallel rendering
Change 3333902 on 2017/03/06 by Daniel.Wright
[Copy] Better handling of volumetric fog enabled with distance of 0
Change 3333903 on 2017/03/06 by Daniel.Wright
[Copy] Fixed volumetric fog trying to render light functions for a point light
Change 3333908 on 2017/03/06 by Daniel.Wright
[Copy] Volumetric materials
* Added new material domain Volume, which can output Scattering, Absorption and Emissive. All properties are in world space densities.
* Particle systems using the Volume domain are voxelized based on their ParticlePosition and ParticleRadius
* Volumetric fog integration is now energy conservative - scattering is integrated against transmission over the depth of each slice.
* Added bOverrideLightColorsWithFogInscatteringColors to exponential height fog, which can be enabled to make Volumetric Fog match Height fog more closely
Change 3334134 on 2017/03/06 by Daniel.Wright
[Copy from Michael Trepka] Added Embree 2.14.0 and changed MeshUtilities to use it as this solves issues with Embree leaking TLS keys. UnrealLightmass is still using older Embree 2.7.0 until we can find time to properly test it with the new version. Also, invalidated distance field DDC to force it to rebuild with updated Embree.
Change 3334420 on 2017/03/06 by Daniel.Wright
Fixed RTDF shadows
Change 3335467 on 2017/03/07 by Benjamin.Hyder
Initial submission of QA-Decals map to EngineTest
Change 3335556 on 2017/03/07 by Daniel.Wright
Changed mesh distance field default format back to R16f
Change 3338020 on 2017/03/08 by Daniel.Wright
Disable volumetric fog in vertex shaders for feature levels which don't support it
Change 3339394 on 2017/03/09 by Chris.Bunner
Correctly handle material texture translation error edge case.
#jira UE-42579, UE-42670
Change 3339992 on 2017/03/09 by Daniel.Wright
Only compile volumetric fog shaders on supporting platforms
Change 3341858 on 2017/03/10 by Arne.Schober
Copying //UE4/Dev-Rendering-PSO to Dev-Rendering (//UE4/Dev-Rendering)
#RB Rolando.Caloca, Marcus.Wassmer, Daniel.Wright, Nick.Penwarden, Mark.Satterthwaite
Change 3342004 on 2017/03/10 by Arne.Schober
Copying //UE4/Dev-Rendering-PSO to Dev-Rendering (//UE4/Dev-Rendering)
Fix unity build
#RB Marcus.Wassmer
Change 3343307 on 2017/03/13 by Marcus.Wassmer
Update showflags when we are guaranteed it will happen in all possible ways to spawn the scenecapture. (drag into editor, PIE, -game, etc)
Change 3343732 on 2017/03/13 by Rolando.Caloca
DR - Vulkan compute pipeline & refactor
Change 3344846 on 2017/03/14 by Rolando.Caloca
DR - Android compile fixes
Change 3344883 on 2017/03/14 by Rolando.Caloca
DR - Add missing stencil load/store to PSO initializer
Change 3344985 on 2017/03/14 by Rolando.Caloca
DR - Made load/store actions uint8
Change 3345141 on 2017/03/14 by Rolando.Caloca
DR - vk - Rework render pass hash
Change 3345304 on 2017/03/14 by Benjamin.Hyder
Updating TM-Distancefields map to include TemplateFloor mesh
Change 3345387 on 2017/03/14 by Rolando.Caloca
DR - Add _RenderThread calls for Create*Shader so RHIs can choose not to stall when creating
Change 3345388 on 2017/03/14 by Rolando.Caloca
DR - Do not stall when creating shaders on Vulkan
Change 3345722 on 2017/03/14 by Chris.Bunner
PR #3357: MinimalAPI add to many material expressions (Contributed by DeanoC)
#jira UE-42752
Change 3345723 on 2017/03/14 by Chris.Bunner
Reduce log verbosity causing spamming during landscape editing.
#jira UE-42714
Change 3345725 on 2017/03/14 by Chris.Bunner
[Duplicate 3341860] Fixed material translation error with multiple connections from custom interpolator nodes.
Change 3345726 on 2017/03/14 by Chris.Bunner
Typo fixes.
Change 3345732 on 2017/03/14 by Rolando.Caloca
DR - Decouple vertex declaration off BSS
Change 3345746 on 2017/03/14 by Chris.Bunner
Added sign() intrinsic material graph node and delisted material function workaround.
Change 3346042 on 2017/03/14 by Chris.Bunner
Implement missing size query interface for FRenderTargetResources.
#jira UE-41672
Change 3346387 on 2017/03/14 by Daniel.Wright
[Copy] Added VolumetricScatteringIntensity to particle lights
Change 3346389 on 2017/03/14 by Daniel.Wright
[Copy] Clamp Volumetric material attributes to fp16 range to avoid INFs
Disable volumetric fog when the fog show flag is disabled
Change 3346392 on 2017/03/14 by Daniel.Wright
[Copy] Fixed skylight being much too bright on volumetric fog
Change 3346406 on 2017/03/14 by Daniel.Wright
[Copy] CSM resolution is now controlled by r.Shadow.MaxCSMResolution.
* Changed HighPC to use 1024 MaxShadowResolution (max for all non-CSM shadows), saves 60Mb in Fortnite
Change 3346412 on 2017/03/14 by Daniel.Wright
[Copy] TexCreate_ReduceMemoryWithTilingMode for translucency lighting 3d textures, saves 13Mb
Change 3346414 on 2017/03/14 by Daniel.Wright
[Copy] TexCreate_ReduceMemoryWithTilingMode for volumetric fog 3d textures, saves 13Mb
Change 3346415 on 2017/03/14 by Daniel.Wright
[Copy] Missing file from cl 3338451
Change 3346421 on 2017/03/14 by Daniel.Wright
[Copy] Fixed NaNs in volumetric fog due to rendering when height fog is disabled
* Volumetric fog converts NaNs to black now so they don't spread
Change 3346422 on 2017/03/14 by Daniel.Wright
[Copy] Fixed NaN in volumetric fog with low density values
Change 3346423 on 2017/03/14 by Daniel.Wright
[Copy] Changed default VolumetricFogScatteringDistribution to .2
Change 3346430 on 2017/03/14 by Daniel.Wright
[Copy] New translucent material option to compute fog per pixel instead of the default per vertex
Change 3346432 on 2017/03/14 by Daniel.Wright
[Copy] Moved Volumetric Fog parameters to view uniform buffer for translucency pass
Fixed lifetimes of temporary Volumetric Fog render targets
Change 3346526 on 2017/03/14 by Daniel.Wright
[Copy] Volumetric Fog supports point and spot light shadows
* These lights are injected separately so that per-light resources can be bound (shadow depth map, static shadow depth map)
* Forward lighting of local lights can be forced with 'r.VolumetricFog.InjectShadowedLightsSeparately 0'
* Shadowed lights come at a cost: 2.9ms for volumetric fog on 970 -> 4.2ms with shadowing
Change 3347053 on 2017/03/15 by Rolando.Caloca
DR - android compile fix
Change 3347384 on 2017/03/15 by Rolando.Caloca
DR - Fix merge issue
Change 3347643 on 2017/03/15 by Marcus.Wassmer
Fix some bugs with the 'disable stationary skylight ffor the project' feature.
Fixes lighting in Persona on Paragon.
Change 3347979 on 2017/03/15 by Rolando.Caloca
DR - Allow to automatically apply cached rendertargets to PSO initializer
Change 3348024 on 2017/03/15 by Rolando.Caloca
DR - Remove NullPS on Vulkan to avoid deadlock
Change 3348303 on 2017/03/15 by Rolando.Caloca
DR - Fix for debugging SCW with material SRT
Change 3348357 on 2017/03/15 by Marcus.Wassmer
Fix stencildither and a stencilref bug that was probably breaking decals sometimes.
Change 3348549 on 2017/03/15 by Marcus.Wassmer
Hopefully fix static analysis for potential nullptr access.
Change 3348614 on 2017/03/15 by Marcus.Wassmer
Duplicate some switch changes to fix crash on launch.
Change 3349369 on 2017/03/16 by Gil.Gribb
Fixed botched merge
Change 3349947 on 2017/03/16 by Rolando.Caloca
DR - Fix for mismatched primitive type
Change 3349956 on 2017/03/16 by Benjamin.Hyder
initial updates to TM-DistanceFields map
Change 3350151 on 2017/03/16 by Rolando.Caloca
DR - Fix UT compile issue
Change 3350155 on 2017/03/16 by Rolando.Caloca
DR - Catch mismatched primitive type on PSOs on D3D11
Change 3350192 on 2017/03/16 by Daniel.Wright
Fix for point light shadow depths rendering with wrong cull mode due to PSO refactor
Change 3350736 on 2017/03/16 by Daniel.Wright
Fixed formatting from merge
Change 3350881 on 2017/03/16 by Rolando.Caloca
DR - Fix texture arrays as UAVs on Metal
Change 3350927 on 2017/03/16 by Rolando.Caloca
DR - Fix warning
Change 3350935 on 2017/03/16 by Daniel.Wright
Fix for materials with non-Surface domains being skipped in mesh passes
Change 3351583 on 2017/03/17 by Marcus.Wassmer
Fix clang platforms
Change 3351917 on 2017/03/17 by Marcus.Wassmer
Fix linux compile
Change 3351973 on 2017/03/17 by Marcus.Wassmer
Fix mismatched rendertargetformat
Change 3352038 on 2017/03/17 by Daniel.Wright
Enabled GetAndOrCreateGraphicsPipelineState ensures in Development for testing
Change 3352110 on 2017/03/17 by Marcus.Wassmer
Fix missing RT PSO apply
Change 3352695 on 2017/03/17 by Arne.Schober
DR - Remove PSO Rendertarget check in DX12 Resolve with Shader.
#RB Rolando.Caloca
Change 3352960 on 2017/03/17 by Arne.Schober
DR - Fix some things that slipped trough the PSO merge
#RB none
Change 3353150 on 2017/03/18 by Rolando.Caloca
DR - compile fix
Change 3353205 on 2017/03/18 by Arne.Schober
DR - Fix Incremental Compile and PS4 runtime error where CMASK is not allowed for ThickTile Mode
#RB none
Change 3353207 on 2017/03/18 by Arne.Schober
DR - Fix Confusion
#RB none
Change 3355183 on 2017/03/20 by Nick.Bullard
Fixed up Content orginzation for Decals automation tests in EngineTest
Change 3355627 on 2017/03/20 by Arne.Schober
DR - [UE-43094] - removed ensure in comporiton graph as control of the clear color cannot be gurantueed.
Change 3356342 on 2017/03/21 by Marcus.Wassmer
Fix clang errors
Change 3356591 on 2017/03/21 by Arne.Schober
DR - Fix ensure message
#RB none
Change 3356873 on 2017/03/21 by Arne.Schober
DR - Fix comparission of undefined values in RendertargetApply Check
Change 3357261 on 2017/03/21 by Marcus.Wassmer
Fix LinuxEditor compile
Change 3357294 on 2017/03/21 by Marcus.Wassmer
Add missing SSE functions
Change 3357351 on 2017/03/21 by Frank.Fella
Fix win32 and linux compiler errors
Change 3357370 on 2017/03/21 by Arne.Schober
DR - disable ensure in test builds
#RB Marcus.Wassmer
[CL 3357449 by Marcus Wassmer in Main branch]
2017-03-21 17:46:52 -04:00
2019-06-11 18:27:07 -04:00
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2021-03-30 02:33:35 -04:00
SHADER_PARAMETER_RDG_UNIFORM_BUFFER ( FStrataGlobalUniformParameters , Strata )
2019-06-11 18:27:07 -04:00
SHADER_PARAMETER_STRUCT_INCLUDE ( FSubsurfaceParameters , Subsurface )
2021-10-29 12:53:33 -04:00
SHADER_PARAMETER_STRUCT_INCLUDE ( FSubsurfaceTilePassVS : : FParameters , TileParameters )
2019-06-11 18:27:07 -04:00
SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , SubsurfaceInput0 )
SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , SubsurfaceInput1 )
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler0 )
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler1 )
RENDER_TARGET_BINDING_SLOTS ( )
2021-02-18 09:38:14 -04:00
END_SHADER_PARAMETER_STRUCT ( ) ;
2014-03-14 14:13:41 -04:00
2019-06-11 18:27:07 -04:00
// Controls the quality of lighting reconstruction.
enum class EQuality : uint32
{
Low ,
High ,
MAX
} ;
2014-03-14 14:13:41 -04:00
2020-07-06 18:58:26 -04:00
static const TCHAR * GetEventName ( EQuality Quality )
{
static const TCHAR * const kEventNames [ ] = {
TEXT ( " Low " ) ,
TEXT ( " High " ) ,
} ;
static_assert ( UE_ARRAY_COUNT ( kEventNames ) = = int32 ( EQuality : : MAX ) , " Fix me " ) ;
return kEventNames [ int32 ( Quality ) ] ;
}
2019-06-11 18:27:07 -04:00
class FDimensionMode : SHADER_PERMUTATION_ENUM_CLASS ( " SUBSURFACE_RECOMBINE_MODE " , ESubsurfaceMode ) ;
class FDimensionQuality : SHADER_PERMUTATION_ENUM_CLASS ( " SUBSURFACE_RECOMBINE_QUALITY " , EQuality ) ;
class FDimensionCheckerboard : SHADER_PERMUTATION_BOOL ( " SUBSURFACE_PROFILE_CHECKERBOARD " ) ;
2019-09-03 19:19:28 -04:00
class FDimensionHalfRes : SHADER_PERMUTATION_BOOL ( " SUBSURFACE_HALF_RES " ) ;
class FRunningInSeparable : SHADER_PERMUTATION_BOOL ( " SUBSURFACE_FORCE_SEPARABLE " ) ;
using FPermutationDomain = TShaderPermutationDomain < FDimensionMode , FDimensionQuality , FDimensionCheckerboard , FDimensionHalfRes , FRunningInSeparable > ;
2014-03-14 14:13:41 -04:00
2021-10-29 12:53:33 -04:00
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
{
return GetMaxSupportedFeatureLevel ( Parameters . Platform ) > = ERHIFeatureLevel : : SM5 ;
}
2019-06-11 18:27:07 -04:00
// Returns the Recombine quality level requested by the SSS Quality CVar setting.
static EQuality GetQuality ( const FViewInfo & View )
{
2019-08-13 17:16:21 -04:00
const uint32 QualityCVar = GetSSSQuality ( ) ;
2019-06-11 18:27:07 -04:00
2021-02-09 06:30:16 -04:00
EMainTAAPassConfig MainTAAConfig = ITemporalUpscaler : : GetMainTAAPassConfig ( View ) ;
2019-06-11 18:27:07 -04:00
2021-02-09 06:30:16 -04:00
// Low quality is really bad with modern temporal upscalers.
2021-04-26 14:05:52 -04:00
bool bAllowLowQuality = MainTAAConfig = = EMainTAAPassConfig : : Disabled | | MainTAAConfig = = EMainTAAPassConfig : : TAA ;
2021-02-09 06:30:16 -04:00
if ( ! bAllowLowQuality )
{
return EQuality : : High ;
}
// Quality is forced to high when the CVar is set to 'auto' and TAA is NOT enabled.
2021-04-26 14:05:52 -04:00
// TAA improves quality through temporal filtering and clamping box, making it less necessary to use
2021-02-09 06:30:16 -04:00
// high quality mode.
if ( QualityCVar = = - 1 )
{
2021-04-26 14:05:52 -04:00
if ( MainTAAConfig = = EMainTAAPassConfig : : TAA )
2021-02-09 06:30:16 -04:00
{
return EQuality : : Low ;
}
else
{
return EQuality : : High ;
}
}
if ( QualityCVar = = 1 )
2019-06-11 18:27:07 -04:00
{
return EQuality : : High ;
}
else
{
return EQuality : : Low ;
}
}
} ;
IMPLEMENT_GLOBAL_SHADER ( FSubsurfaceRecombinePS , " /Engine/Private/PostProcessSubsurface.usf " , " SubsurfaceRecombinePS " , SF_Pixel ) ;
2021-10-29 12:53:33 -04:00
// copy write back additively to the scene color texture
class FSubsurfaceRecombineCopyPS : public FSubsurfaceShader
{
DECLARE_GLOBAL_SHADER ( FSubsurfaceRecombineCopyPS ) ;
SHADER_USE_PARAMETER_STRUCT ( FSubsurfaceRecombineCopyPS , FSubsurfaceShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
SHADER_PARAMETER_RDG_UNIFORM_BUFFER ( FStrataGlobalUniformParameters , Strata )
SHADER_PARAMETER_STRUCT_INCLUDE ( FSubsurfaceParameters , Subsurface )
SHADER_PARAMETER_STRUCT_INCLUDE ( FSubsurfaceTilePassVS : : FParameters , TileParameters )
SHADER_PARAMETER_STRUCT ( FSubsurfaceInput , SubsurfaceInput0 )
SHADER_PARAMETER_SAMPLER ( SamplerState , SubsurfaceSampler0 )
RENDER_TARGET_BINDING_SLOTS ( )
END_SHADER_PARAMETER_STRUCT ( ) ;
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
{
return IsFeatureLevelSupported ( Parameters . Platform , ERHIFeatureLevel : : SM5 ) ;
}
} ;
IMPLEMENT_GLOBAL_SHADER ( FSubsurfaceRecombineCopyPS , " /Engine/Private/PostProcessSubsurface.usf " , " SubsurfaceRecombineCopyPS " , SF_Pixel ) ;
2020-09-24 00:43:27 -04:00
void AddSubsurfaceViewPass (
2019-06-11 18:27:07 -04:00
FRDGBuilder & GraphBuilder ,
2019-10-01 13:03:04 -04:00
const FViewInfo & View ,
2020-11-20 14:48:45 -04:00
const FSceneTextures & SceneTextures ,
2020-09-24 00:43:27 -04:00
FRDGTextureRef SceneColorTextureOutput ,
ERenderTargetLoadAction SceneColorTextureLoadAction )
2019-06-11 18:27:07 -04:00
{
2020-11-20 14:48:45 -04:00
FRDGTextureRef SceneColorTexture = SceneTextures . Color . Target ;
const FScreenPassTextureViewport SceneViewport ( SceneColorTexture , View . ViewRect ) ;
2020-09-24 00:43:27 -04:00
check ( SceneColorTextureOutput ) ;
2019-06-11 18:27:07 -04:00
const FSceneViewFamily * ViewFamily = View . Family ;
2020-09-24 00:43:27 -04:00
const FRDGTextureDesc & SceneColorTextureDesc = SceneColorTexture - > Desc ;
2019-06-11 18:27:07 -04:00
const ESubsurfaceMode SubsurfaceMode = GetSubsurfaceModeForView ( View ) ;
const bool bHalfRes = ( SubsurfaceMode = = ESubsurfaceMode : : HalfRes ) ;
2020-09-24 00:43:27 -04:00
const bool bCheckerboard = IsSubsurfaceCheckerboardFormat ( SceneColorTextureDesc . Format ) ;
2019-06-11 18:27:07 -04:00
const uint32 ScaleFactor = bHalfRes ? 2 : 1 ;
2019-09-03 19:19:28 -04:00
2020-10-29 13:38:15 -04:00
//We run in separable mode under two conditions: 1) Run Burley fallback mode. 2) when the screen is in half resolution.
const bool bForceRunningInSeparable = CVarSSSBurleyQuality . GetValueOnRenderThread ( ) = = 0 | | bHalfRes ;
2019-06-11 18:27:07 -04:00
2020-09-24 00:43:27 -04:00
const bool bUseProfileIdCache = ! bForceRunningInSeparable & & IsProfileIdCacheEnabled ( ) ;
2021-10-29 12:53:33 -04:00
const int32 MinGenerateMipsTileCount = FMath : : Max ( 0 , CVarSSSMipmapsMinTileCount . GetValueOnRenderThread ( ) ) ;
2019-06-11 18:27:07 -04:00
/**
* All subsurface passes within the screen - space subsurface effect can operate at half or full resolution ,
* depending on the subsurface mode . The values are precomputed and shared among all Subsurface textures .
*/
2020-09-24 00:43:27 -04:00
const FScreenPassTextureViewport SubsurfaceViewport = GetDownscaledViewport ( SceneViewport , ScaleFactor ) ;
2019-06-11 18:27:07 -04:00
2020-09-24 00:43:27 -04:00
const FRDGTextureDesc SceneColorTextureDescriptor = FRDGTextureDesc : : Create2D (
2019-08-16 18:09:11 -04:00
SceneViewport . Extent ,
PF_FloatRGBA ,
FClearValueBinding ( ) ,
2020-09-24 00:43:27 -04:00
TexCreate_RenderTargetable | TexCreate_ShaderResource | TexCreate_UAV ) ;
2019-08-16 18:09:11 -04:00
2020-09-24 00:43:27 -04:00
const FRDGTextureDesc SubsurfaceTextureDescriptor = FRDGTextureDesc : : Create2D (
2019-06-11 18:27:07 -04:00
SubsurfaceViewport . Extent ,
PF_FloatRGBA ,
FClearValueBinding ( ) ,
2020-09-24 00:43:27 -04:00
TexCreate_RenderTargetable | TexCreate_ShaderResource | TexCreate_UAV ) ;
const FRDGTextureDesc ProfileIdTextureDescriptor = FRDGTextureDesc : : Create2D (
SubsurfaceViewport . Extent ,
PF_R8_UINT ,
FClearValueBinding ( ) ,
TexCreate_RenderTargetable | TexCreate_ShaderResource | TexCreate_UAV ) ;
2019-08-13 17:16:21 -04:00
2020-03-05 13:48:38 -05:00
// Create texture desc with 6 mips if possible, otherwise clamp number of mips to match the viewport resolution
2020-09-24 00:43:27 -04:00
const FRDGTextureDesc SubsurfaceTextureWith6MipsDescriptor = FRDGTextureDesc : : Create2D (
2019-08-13 17:16:21 -04:00
SubsurfaceViewport . Extent ,
PF_FloatRGBA ,
FClearValueBinding ( ) ,
TexCreate_RenderTargetable | TexCreate_ShaderResource | TexCreate_UAV ,
2020-03-05 13:48:38 -05:00
FMath : : Min ( 6u , 1 + FMath : : FloorLog2 ( ( uint32 ) SubsurfaceViewport . Extent . GetMin ( ) ) ) ) ;
2019-08-13 17:16:21 -04:00
2020-11-20 14:48:45 -04:00
const FRDGSystemTextures & SystemTextures = FRDGSystemTextures : : Get ( GraphBuilder ) ;
const FSubsurfaceParameters SubsurfaceCommonParameters = GetSubsurfaceCommonParameters ( GraphBuilder , View , SceneTextures . UniformBuffer ) ;
2019-06-11 18:27:07 -04:00
const FScreenPassTextureViewportParameters SubsurfaceViewportParameters = GetScreenPassTextureViewportParameters ( SubsurfaceViewport ) ;
const FScreenPassTextureViewportParameters SceneViewportParameters = GetScreenPassTextureViewportParameters ( SceneViewport ) ;
2022-03-15 03:11:08 -04:00
const bool bReadSeparatedSubSurfaceSceneColor = Strata : : IsStrataOpaqueMaterialRoughRefractionEnabled ( ) ;
const bool bWriteSeparatedOpaqueRoughRefractionSceneColor = Strata : : IsStrataOpaqueMaterialRoughRefractionEnabled ( ) ;
2022-04-02 14:31:01 -04:00
FRDGTextureRef SeparatedSubSurfaceSceneColor = View . StrataViewData . SceneData - > SeparatedSubSurfaceSceneColor ;
FRDGTextureRef SeparatedOpaqueRoughRefractionSceneColor = View . StrataViewData . SceneData - > SeparatedOpaqueRoughRefractionSceneColor ;
2022-03-15 03:11:08 -04:00
2020-09-24 00:43:27 -04:00
FRDGTextureRef SetupTexture = SceneColorTexture ;
2019-08-13 17:16:21 -04:00
FRDGTextureRef SubsurfaceSubpassOneTex = nullptr ;
FRDGTextureRef SubsurfaceSubpassTwoTex = nullptr ;
2020-09-24 00:43:27 -04:00
FRDGTextureRef ProfileIdTexture = nullptr ;
2019-06-11 18:27:07 -04:00
FRHISamplerState * PointClampSampler = TStaticSamplerState < SF_Point , AM_Clamp , AM_Clamp , AM_Clamp > : : GetRHI ( ) ;
FRHISamplerState * BilinearBorderSampler = TStaticSamplerState < SF_Bilinear , AM_Border , AM_Border , AM_Border > : : GetRHI ( ) ;
2019-08-13 17:16:21 -04:00
//History texture
FSceneViewState * ViewState = ( FSceneViewState * ) View . State ;
TRefCountPtr < IPooledRenderTarget > * QualityHistoryState = ViewState ? & ViewState - > SubsurfaceScatteringQualityHistoryRT : NULL ;
//allocate/reallocate the quality history texture.
2021-10-29 12:53:33 -04:00
FRDGTextureRef QualityHistoryTexture = RegisterExternalRenderTarget ( GraphBuilder , QualityHistoryState , SceneColorTextureDescriptor . Extent , TEXT ( " Subsurface.QualityHistoryTexture " ) ) ;
2019-08-13 17:16:21 -04:00
FRDGTextureRef NewQualityHistoryTexture = nullptr ;
2021-08-23 15:22:35 -04:00
RDG_GPU_STAT_SCOPE ( GraphBuilder , SubsurfaceScattering ) ;
2021-10-29 12:53:33 -04:00
FSubsurfaceTiles Tiles ;
2019-06-11 18:27:07 -04:00
/**
* When in bypass mode , the setup and convolution passes are skipped , but lighting
* reconstruction is still performed in the recombine pass .
*/
if ( SubsurfaceMode ! = ESubsurfaceMode : : Bypass )
{
2019-09-03 19:19:28 -04:00
// Support mipmaps in full resolution only.
2021-10-29 12:53:33 -04:00
SetupTexture = GraphBuilder . CreateTexture ( bForceRunningInSeparable ? SubsurfaceTextureDescriptor : SubsurfaceTextureWith6MipsDescriptor , TEXT ( " Subsurface.SetupTexture " ) ) ;
2019-06-11 18:27:07 -04:00
2020-09-24 00:43:27 -04:00
// profile cache to accelerate sampling
if ( bUseProfileIdCache )
{
2021-10-29 12:53:33 -04:00
// This path was designed to get used when r.SSS.Burley.EnableProfileIdCache is true.
ProfileIdTexture = GraphBuilder . CreateTexture ( ProfileIdTextureDescriptor , TEXT ( " Subsurface.ProfileIdTexture " ) ) ;
2020-09-24 00:43:27 -04:00
}
else
{
2020-11-20 14:48:45 -04:00
ProfileIdTexture = SystemTextures . Black ;
2020-09-24 00:43:27 -04:00
}
2020-11-20 14:48:45 -04:00
FRDGTextureRef VelocityTexture = GetIfProduced ( SceneTextures . Velocity , SystemTextures . Black ) ;
2019-08-13 17:16:21 -04:00
2021-10-29 12:53:33 -04:00
// Initialize tile buffers.
2019-06-11 18:27:07 -04:00
{
2021-10-29 12:53:33 -04:00
check ( FSubsurfaceTiles : : TilePerThread_GroupSize = = 64 ) ; // If this value change, we need to update the shaders using
check ( FSubsurfaceTiles : : TileSize = = 8 ) ; // only size supported for now
Tiles . TileDimension = FIntPoint : : DivideAndRoundUp ( SubsurfaceViewport . Extent , FSubsurfaceTiles : : TileSize ) ;
Tiles . TileCount = Tiles . TileDimension . X * Tiles . TileDimension . Y ;
Tiles . bRectPrimitive = GRHISupportsRectTopology ;
Tiles . TileTypeCountBuffer = GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateBufferDesc ( sizeof ( uint32 ) , FSubsurfaceTiles : : TileTypeCount ) , TEXT ( " Subsurface.TileCountBuffer " ) ) ;
Tiles . TileIndirectDispatchBuffer =
GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateIndirectDesc < FRHIDispatchIndirectParameters > ( FSubsurfaceTiles : : TileTypeCount ) , TEXT ( " Subsurface.TileIndirectDispatchBuffer " ) ) ;
Tiles . TileIndirectDrawBuffer =
GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateIndirectDesc < FRHIDrawIndirectParameters > ( FSubsurfaceTiles : : TileTypeCount ) , TEXT ( " Subsurface.TileIndirectDrawBuffer " ) ) ;
Tiles . TileDataBuffer [ ToIndex ( FSubsurfaceTiles : : ETileType : : All ) ] =
GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateBufferDesc ( sizeof ( uint32 ) , 2 * Tiles . TileCount ) , TEXT ( " Subsurface.TileDataBuffer(All) " ) ) ;
Tiles . TileDataBuffer [ ToIndex ( FSubsurfaceTiles : : ETileType : : AFIS ) ] =
GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateBufferDesc ( sizeof ( uint32 ) , 2 * Tiles . TileCount ) , TEXT ( " Subsurface.TileDataBuffer(AFIS) " ) ) ;
Tiles . TileDataBuffer [ ToIndex ( FSubsurfaceTiles : : ETileType : : SEPARABLE ) ] =
GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateBufferDesc ( sizeof ( uint32 ) , 2 * Tiles . TileCount ) , TEXT ( " Subsurface.TileDataBuffer(SEPARABLE) " ) ) ;
for ( uint32 BufferIt = 0 ; BufferIt < FSubsurfaceTiles : : TileTypeCount ; + + BufferIt )
2019-09-03 19:19:28 -04:00
{
2021-10-29 12:53:33 -04:00
if ( Tiles . TileDataBuffer [ BufferIt ] )
{
Tiles . TileDataSRV [ BufferIt ] = GraphBuilder . CreateSRV ( Tiles . TileDataBuffer [ BufferIt ] , PF_R32_UINT ) ;
}
2019-09-03 19:19:28 -04:00
}
2019-06-11 18:27:07 -04:00
}
2019-08-13 17:16:21 -04:00
// Initialize the group counters
2019-06-11 18:27:07 -04:00
{
2019-08-13 17:16:21 -04:00
typedef FSubsurfaceInitValueBufferCS SHADER ;
TShaderMapRef < SHADER > ComputeShader ( View . ShaderMap ) ;
SHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < SHADER : : FParameters > ( ) ;
2021-10-29 12:53:33 -04:00
PassParameters - > RWTileTypeCountBuffer = GraphBuilder . CreateUAV ( Tiles . TileTypeCountBuffer , EPixelFormat : : PF_R32_UINT ) ;
2021-11-18 14:37:34 -05:00
FComputeShaderUtils : : AddPass ( GraphBuilder , RDG_EVENT_NAME ( " SSS::InitGroupCounter " ) , ComputeShader , PassParameters , FIntVector ( 1 , 1 , 1 ) ) ;
2019-08-13 17:16:21 -04:00
}
2019-06-11 18:27:07 -04:00
2021-10-29 12:53:33 -04:00
FSubsurfaceUniformRef UniformBuffer = CreateUniformBuffer ( View , Tiles . TileCount ) ;
// Call the indirect setup (with tile classification)
2019-06-11 18:27:07 -04:00
{
2019-08-13 17:16:21 -04:00
FRDGTextureUAVDesc SetupTextureOutDesc ( SetupTexture , 0 ) ;
2019-06-11 18:27:07 -04:00
2019-08-13 17:16:21 -04:00
typedef FSubsurfaceIndirectDispatchSetupCS SHADER ;
SHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < SHADER : : FParameters > ( ) ;
2019-06-11 18:27:07 -04:00
PassParameters - > Subsurface = SubsurfaceCommonParameters ;
2019-10-01 13:03:04 -04:00
PassParameters - > Output = SubsurfaceViewportParameters ;
2022-03-15 03:11:08 -04:00
PassParameters - > SubsurfaceInput0 = GetSubsurfaceInput ( bReadSeparatedSubSurfaceSceneColor ? SeparatedSubSurfaceSceneColor : SceneColorTexture , SceneViewportParameters ) ;
2019-08-13 17:16:21 -04:00
PassParameters - > SubsurfaceSampler0 = PointClampSampler ;
PassParameters - > SetupTexture = GraphBuilder . CreateUAV ( SetupTextureOutDesc ) ;
2020-09-24 00:43:27 -04:00
if ( bUseProfileIdCache )
{
PassParameters - > ProfileIdTexture = GraphBuilder . CreateUAV ( FRDGTextureUAVDesc ( ProfileIdTexture ) ) ;
}
2021-10-29 12:53:33 -04:00
PassParameters - > RWBurleyGroupBuffer = GraphBuilder . CreateUAV ( Tiles . TileDataBuffer [ ToIndex ( FSubsurfaceTiles : : ETileType : : AFIS ) ] , EPixelFormat : : PF_R32_UINT ) ;
PassParameters - > RWSeparableGroupBuffer = GraphBuilder . CreateUAV ( Tiles . TileDataBuffer [ ToIndex ( FSubsurfaceTiles : : ETileType : : SEPARABLE ) ] , EPixelFormat : : PF_R32_UINT ) ;
PassParameters - > RWAllGroupBuffer = GraphBuilder . CreateUAV ( Tiles . TileDataBuffer [ ToIndex ( FSubsurfaceTiles : : ETileType : : All ) ] , EPixelFormat : : PF_R32_UINT ) ;
PassParameters - > RWTileTypeCountBuffer = GraphBuilder . CreateUAV ( Tiles . TileTypeCountBuffer , EPixelFormat : : PF_R32_UINT ) ;
2019-08-13 17:16:21 -04:00
PassParameters - > SubsurfaceUniformParameters = UniformBuffer ;
2022-04-01 08:35:55 -04:00
PassParameters - > Strata = Strata : : BindStrataGlobalUniformParameters ( View ) ;
2019-06-11 18:27:07 -04:00
2019-08-13 17:16:21 -04:00
SHADER : : FPermutationDomain ComputeShaderPermutationVector ;
ComputeShaderPermutationVector . Set < SHADER : : FDimensionHalfRes > ( bHalfRes ) ;
ComputeShaderPermutationVector . Set < SHADER : : FDimensionCheckerboard > ( bCheckerboard ) ;
2019-09-03 19:19:28 -04:00
ComputeShaderPermutationVector . Set < SHADER : : FRunningInSeparable > ( bForceRunningInSeparable ) ;
2020-09-24 00:43:27 -04:00
ComputeShaderPermutationVector . Set < SHADER : : FDimensionEnableProfileIDCache > ( bUseProfileIdCache ) ;
2019-08-13 17:16:21 -04:00
TShaderMapRef < SHADER > ComputeShader ( View . ShaderMap , ComputeShaderPermutationVector ) ;
2019-06-11 18:27:07 -04:00
2020-07-06 18:58:26 -04:00
FComputeShaderUtils : : AddPass (
GraphBuilder ,
2021-11-18 14:37:34 -05:00
RDG_EVENT_NAME ( " SSS::Setup(%s%s%s) %dx%d " ,
2020-07-06 18:58:26 -04:00
ComputeShaderPermutationVector . Get < SHADER : : FDimensionHalfRes > ( ) ? TEXT ( " HalfRes " ) : TEXT ( " " ) ,
ComputeShaderPermutationVector . Get < SHADER : : FDimensionCheckerboard > ( ) ? TEXT ( " Checkerboard " ) : TEXT ( " " ) ,
ComputeShaderPermutationVector . Get < SHADER : : FRunningInSeparable > ( ) ? TEXT ( " RunningInSeparable " ) : TEXT ( " " ) ,
SubsurfaceViewport . Extent . X ,
SubsurfaceViewport . Extent . Y ) ,
ComputeShader ,
PassParameters ,
2021-10-29 12:53:33 -04:00
FComputeShaderUtils : : GetGroupCount ( SubsurfaceViewport . Extent , FSubsurfaceTiles : : TileSize ) ) ;
2019-08-13 17:16:21 -04:00
}
2021-10-29 12:53:33 -04:00
// Setup the indirect dispatch & draw arguments.
2019-08-13 17:16:21 -04:00
{
typedef FSubsurfaceBuildIndirectDispatchArgsCS ARGSETUPSHADER ;
ARGSETUPSHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < ARGSETUPSHADER : : FParameters > ( ) ;
PassParameters - > SubsurfaceUniformParameters = UniformBuffer ;
2021-10-29 12:53:33 -04:00
PassParameters - > RWIndirectDispatchArgsBuffer = GraphBuilder . CreateUAV ( Tiles . TileIndirectDispatchBuffer , EPixelFormat : : PF_R32_UINT ) ;
PassParameters - > RWIndirectDrawArgsBuffer = GraphBuilder . CreateUAV ( Tiles . TileIndirectDrawBuffer , EPixelFormat : : PF_R32_UINT ) ;
PassParameters - > TileTypeCountBuffer = GraphBuilder . CreateSRV ( Tiles . TileTypeCountBuffer , EPixelFormat : : PF_R32_UINT ) ;
2019-08-13 17:16:21 -04:00
TShaderMapRef < ARGSETUPSHADER > ComputeShader ( View . ShaderMap ) ;
2021-11-18 14:37:34 -05:00
FComputeShaderUtils : : AddPass ( GraphBuilder , FRDGEventName ( TEXT ( " SSS::BuildIndirectArgs(Dispatch & Draw) " ) ) , ComputeShader , PassParameters , FIntVector ( 1 , 1 , 1 ) ) ;
2021-10-29 12:53:33 -04:00
}
// In half resolution, only Separable is used. We do not need this mipmap.
if ( ! bForceRunningInSeparable )
{
FRDGBufferRef MipsConditionBuffer = GraphBuilder . CreateBuffer (
FRDGBufferDesc : : CreateBufferDesc ( sizeof ( uint32 ) , FSubsurfaceTiles : : TileTypeCount ) , TEXT ( " Subsurface.MipsConditionBuffer " ) ) ;
const int32 Offset = ToIndex ( FSubsurfaceTiles : : ETileType : : AFIS ) ;
{
typedef FFillMipsConditionBufferCS SHADER ;
TShaderMapRef < SHADER > ComputeShader ( View . ShaderMap ) ;
SHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < SHADER : : FParameters > ( ) ;
PassParameters - > MinGenerateMipsTileCount = MinGenerateMipsTileCount ;
PassParameters - > Offset = Offset ;
PassParameters - > TileTypeCountBuffer = GraphBuilder . CreateSRV ( Tiles . TileTypeCountBuffer , EPixelFormat : : PF_R32_UINT ) ;
PassParameters - > RWMipsConditionBuffer = GraphBuilder . CreateUAV ( MipsConditionBuffer , EPixelFormat : : PF_R32_UINT ) ;
2021-11-18 14:37:34 -05:00
FComputeShaderUtils : : AddPass ( GraphBuilder , RDG_EVENT_NAME ( " SSS::FillMipsConditionBufferCS " ) , ComputeShader , PassParameters , FIntVector ( 1 , 1 , 1 ) ) ;
2021-10-29 12:53:33 -04:00
}
// Generate mipmap for the diffuse scene color and depth, use bilinear filter conditionally
FGenerateMips : : ExecuteCompute ( GraphBuilder , SetupTexture , BilinearBorderSampler , MipsConditionBuffer , Offset ) ;
}
// Allocate auxiliary buffers
{
// Pre-allocate black UAV if we have separable tiles.
SubsurfaceSubpassOneTex = CreateBlackUAVTexture (
GraphBuilder ,
SubsurfaceTextureDescriptor ,
TEXT ( " Subsurface.SubpassOneTex " ) ,
2021-11-18 14:37:34 -05:00
RDG_EVENT_NAME ( " SSS::ClearUAV(%s, %s.TileCount > 0) " , TEXT ( " Subsurface.SubpassOneTex " ) , ToString ( FSubsurfaceTiles : : ETileType : : SEPARABLE ) ) ,
2021-10-29 12:53:33 -04:00
SubsurfaceViewport ,
Tiles . TileTypeCountBuffer ,
ToIndex ( FSubsurfaceTiles : : ETileType : : SEPARABLE ) ) ;
2022-03-01 15:08:05 -05:00
// Pre-allocate black UAV for the second buffer if the separable tiles are rendered in half resolution.
if ( bHalfRes )
{
SubsurfaceSubpassTwoTex = CreateBlackUAVTexture (
GraphBuilder ,
SubsurfaceTextureDescriptor ,
TEXT ( " Subsurface.SubpassTwoTex " ) ,
RDG_EVENT_NAME ( " SSS::ClearUAV(%s, %s.TileCount > 0) " , TEXT ( " Subsurface.SubpassTwoTex " ) , ToString ( FSubsurfaceTiles : : ETileType : : SEPARABLE ) ) ,
SubsurfaceViewport ,
Tiles . TileTypeCountBuffer ,
ToIndex ( FSubsurfaceTiles : : ETileType : : SEPARABLE ) ) ;
}
else
{
SubsurfaceSubpassTwoTex = GraphBuilder . CreateTexture ( SubsurfaceTextureDescriptor , TEXT ( " Subsurface.SubpassTwoTex " ) ) ;
}
2021-10-29 12:53:33 -04:00
if ( ! bForceRunningInSeparable )
{
NewQualityHistoryTexture = GraphBuilder . CreateTexture ( SubsurfaceTextureDescriptor , TEXT ( " Subsurface.QualityHistoryState " ) ) ;
2019-08-13 17:16:21 -04:00
}
}
// Major pass to combine Burley and Separable
{
2021-10-29 12:53:33 -04:00
typedef FSubsurfaceIndirectDispatchCS SHADER ;
FRHISamplerState * SubsurfaceSamplerState = SHADER : : GetSamplerState ( bHalfRes ) ;
2019-08-13 17:16:21 -04:00
struct FSubsurfacePassInfo
{
FSubsurfacePassInfo ( const TCHAR * InName , FRDGTextureRef InInput , FRDGTextureRef InOutput ,
SHADER : : ESubsurfaceType InSurfaceType , SHADER : : ESubsurfacePass InSurfacePass )
: Name ( InName ) , Input ( InInput ) , Output ( InOutput ) , SurfaceType ( InSurfaceType ) , SubsurfacePass ( InSurfacePass )
{ }
const TCHAR * Name ;
FRDGTextureRef Input ;
FRDGTextureRef Output ;
SHADER : : ESubsurfaceType SurfaceType ;
SHADER : : ESubsurfacePass SubsurfacePass ;
} ;
const int NumOfSubsurfacePass = 4 ;
const FSubsurfacePassInfo SubsurfacePassInfos [ NumOfSubsurfacePass ] =
{
2021-11-18 14:37:34 -05:00
{ TEXT ( " SSS::PassOne_Burley " ) , SetupTexture , SubsurfaceSubpassOneTex , SHADER : : ESubsurfaceType : : BURLEY , SHADER : : ESubsurfacePass : : PassOne } , //Burley main pass
{ TEXT ( " SSS::PassTwo_SepHon " ) , SetupTexture , SubsurfaceSubpassOneTex , SHADER : : ESubsurfaceType : : SEPARABLE , SHADER : : ESubsurfacePass : : PassOne } , //Separable horizontal
{ TEXT ( " SSS::PassThree_SepVer " ) , SubsurfaceSubpassOneTex , SubsurfaceSubpassTwoTex , SHADER : : ESubsurfaceType : : SEPARABLE , SHADER : : ESubsurfacePass : : PassTwo } , //Separable Vertical
{ TEXT ( " SSS::PassFour_BVar " ) , SubsurfaceSubpassOneTex , SubsurfaceSubpassTwoTex , SHADER : : ESubsurfaceType : : BURLEY , SHADER : : ESubsurfacePass : : PassTwo } //Burley Variance
2019-08-13 17:16:21 -04:00
} ;
2021-10-29 12:53:33 -04:00
const FRDGBufferSRVRef SubsurfaceBufferUsage [ ] = { Tiles . GetTileBufferSRV ( FSubsurfaceTiles : : ETileType : : AFIS ) , Tiles . GetTileBufferSRV ( FSubsurfaceTiles : : ETileType : : SEPARABLE ) } ;
2019-08-13 17:16:21 -04:00
//Dispatch the two phase for both SSS
for ( int PassIndex = 0 ; PassIndex < NumOfSubsurfacePass ; + + PassIndex )
{
const FSubsurfacePassInfo & PassInfo = SubsurfacePassInfos [ PassIndex ] ;
const SHADER : : ESubsurfaceType SubsurfaceType = PassInfo . SurfaceType ;
const auto SubsurfacePassFunction = PassInfo . SubsurfacePass ;
const int SubsurfaceTypeIndex = static_cast < int > ( SubsurfaceType ) ;
FRDGTextureRef TextureInput = PassInfo . Input ;
FRDGTextureRef TextureOutput = PassInfo . Output ;
FRDGTextureUAVDesc SSSColorUAVDesc ( TextureOutput , 0 ) ;
FRDGTextureSRVDesc InputSRVDesc = FRDGTextureSRVDesc : : Create ( TextureInput ) ;
SHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < SHADER : : FParameters > ( ) ;
PassParameters - > Subsurface = SubsurfaceCommonParameters ;
2019-10-01 13:03:04 -04:00
PassParameters - > Output = SubsurfaceViewportParameters ;
2019-08-13 17:16:21 -04:00
PassParameters - > SSSColorUAV = GraphBuilder . CreateUAV ( SSSColorUAVDesc ) ;
PassParameters - > SubsurfaceInput0 = GetSubsurfaceInput ( TextureInput , SubsurfaceViewportParameters ) ;
PassParameters - > SubsurfaceSampler0 = SubsurfaceSamplerState ;
2021-10-29 12:53:33 -04:00
PassParameters - > GroupBuffer = SubsurfaceBufferUsage [ SubsurfaceTypeIndex ] ;
PassParameters - > TileTypeCountBuffer = GraphBuilder . CreateSRV ( Tiles . TileTypeCountBuffer , EPixelFormat : : PF_R32_UINT ) ;
PassParameters - > IndirectDispatchArgsBuffer = Tiles . TileIndirectDispatchBuffer ;
2022-04-01 08:35:55 -04:00
PassParameters - > Strata = Strata : : BindStrataGlobalUniformParameters ( View ) ;
2019-08-13 17:16:21 -04:00
if ( SubsurfacePassFunction = = SHADER : : ESubsurfacePass : : PassOne & & SubsurfaceType = = SHADER : : ESubsurfaceType : : BURLEY )
{
PassParameters - > SubsurfaceInput1 = GetSubsurfaceInput ( QualityHistoryTexture , SubsurfaceViewportParameters ) ;
PassParameters - > SubsurfaceSampler1 = PointClampSampler ;
2021-10-29 12:53:33 -04:00
PassParameters - > SubsurfaceInput2 = GetSubsurfaceInput ( VelocityTexture , SubsurfaceViewportParameters ) ;
PassParameters - > SubsurfaceSampler2 = PointClampSampler ;
2019-08-13 17:16:21 -04:00
}
if ( SubsurfacePassFunction = = SHADER : : ESubsurfacePass : : PassTwo & & SubsurfaceType = = SHADER : : ESubsurfaceType : : BURLEY )
{
2019-09-03 19:19:28 -04:00
// we do not write to history in separable mode.
if ( ! bForceRunningInSeparable )
{
PassParameters - > HistoryUAV = GraphBuilder . CreateUAV ( FRDGTextureUAVDesc ( NewQualityHistoryTexture , 0 ) ) ;
2021-08-23 15:22:35 -04:00
PassParameters - > SubsurfaceInput3 = GetSubsurfaceInput ( SetupTexture , SubsurfaceViewportParameters ) ;
PassParameters - > SubsurfaceSampler3 = TStaticSamplerState < SF_Bilinear , AM_Border , AM_Border , AM_Border > : : GetRHI ( ) ;
2019-09-03 19:19:28 -04:00
}
2019-08-13 17:16:21 -04:00
PassParameters - > SubsurfaceInput1 = GetSubsurfaceInput ( QualityHistoryTexture , SubsurfaceViewportParameters ) ;
PassParameters - > SubsurfaceSampler1 = PointClampSampler ;
PassParameters - > SubsurfaceInput2 = GetSubsurfaceInput ( VelocityTexture , SubsurfaceViewportParameters ) ;
PassParameters - > SubsurfaceSampler2 = PointClampSampler ;
}
2020-09-24 00:43:27 -04:00
if ( bUseProfileIdCache )
{
PassParameters - > ProfileIdTexture = GraphBuilder . CreateUAV ( FRDGTextureUAVDesc ( ProfileIdTexture ) ) ;
}
2019-08-13 17:16:21 -04:00
SHADER : : FPermutationDomain ComputeShaderPermutationVector ;
ComputeShaderPermutationVector . Set < SHADER : : FSubsurfacePassFunction > ( SubsurfacePassFunction ) ;
ComputeShaderPermutationVector . Set < SHADER : : FDimensionQuality > ( SHADER : : GetQuality ( ) ) ;
2020-09-24 00:43:27 -04:00
ComputeShaderPermutationVector . Set < SHADER : : FBilateralFilterKernelFunctionType > ( SHADER : : GetBilateralFilterKernelFunctionType ( ) ) ;
2019-08-13 17:16:21 -04:00
ComputeShaderPermutationVector . Set < SHADER : : FSubsurfaceType > ( SubsurfaceType ) ;
ComputeShaderPermutationVector . Set < SHADER : : FDimensionHalfRes > ( bHalfRes ) ;
2019-09-03 19:19:28 -04:00
ComputeShaderPermutationVector . Set < SHADER : : FRunningInSeparable > ( bForceRunningInSeparable ) ;
2020-09-24 00:43:27 -04:00
ComputeShaderPermutationVector . Set < SHADER : : FDimensionEnableProfileIDCache > ( bUseProfileIdCache ) ;
2019-08-13 17:16:21 -04:00
TShaderMapRef < SHADER > ComputeShader ( View . ShaderMap , ComputeShaderPermutationVector ) ;
2020-07-06 18:58:26 -04:00
FComputeShaderUtils : : AddPass (
GraphBuilder ,
2020-09-24 00:43:27 -04:00
RDG_EVENT_NAME ( " %s(%s %s %s %s%s) " ,
2020-07-06 18:58:26 -04:00
PassInfo . Name ,
SHADER : : GetEventName ( ComputeShaderPermutationVector . Get < SHADER : : FSubsurfacePassFunction > ( ) ) ,
SHADER : : GetEventName ( ComputeShaderPermutationVector . Get < SHADER : : FDimensionQuality > ( ) ) ,
SHADER : : GetEventName ( ComputeShaderPermutationVector . Get < SHADER : : FSubsurfaceType > ( ) ) ,
ComputeShaderPermutationVector . Get < SHADER : : FDimensionHalfRes > ( ) ? TEXT ( " HalfRes " ) : TEXT ( " " ) ,
ComputeShaderPermutationVector . Get < SHADER : : FRunningInSeparable > ( ) ? TEXT ( " RunningInSeparable " ) : TEXT ( " " ) ) ,
ComputeShader ,
PassParameters ,
2021-10-29 12:53:33 -04:00
PassParameters - > IndirectDispatchArgsBuffer , Tiles . GetIndirectDispatchArgOffset ( SHADER : : ToSubsurfaceTileType ( SubsurfaceType ) ) ) ;
2019-08-13 17:16:21 -04:00
}
2019-06-11 18:27:07 -04:00
}
}
2021-11-17 10:05:03 -05:00
// Recombines scattering result with scene color, and updates only SSS region using specialized vertex shader.
2019-06-11 18:27:07 -04:00
{
2021-10-29 12:53:33 -04:00
FRDGTextureRef SubsurfaceIntermediateTexture = GraphBuilder . CreateTexture ( SceneColorTextureDesc , TEXT ( " Subsurface.Recombines " ) ) ;
2019-06-11 18:27:07 -04:00
2021-11-17 10:05:03 -05:00
// When bypassing subsurface scattering, we use the directly full screen pass instead of building the tile
// and apply the tile based copy
const bool bShouldFallbackToFullScreenPass = SubsurfaceMode = = ESubsurfaceMode : : Bypass ;
FRHIDepthStencilState * DepthStencilState = TStaticDepthStencilState < false , CF_Always > : : GetRHI ( ) ;
// Recombine into intermediate textures before copying back.
2019-06-11 18:27:07 -04:00
{
2021-10-29 12:53:33 -04:00
FSubsurfaceTiles : : ETileType TileType = FSubsurfaceTiles : : ETileType : : All ;
FSubsurfaceRecombinePS : : FParameters * PassParameters = GraphBuilder . AllocParameters < FSubsurfaceRecombinePS : : FParameters > ( ) ;
PassParameters - > Subsurface = SubsurfaceCommonParameters ;
2021-11-17 10:05:03 -05:00
if ( SubsurfaceMode ! = ESubsurfaceMode : : Bypass )
{
2022-01-28 10:14:49 -05:00
PassParameters - > TileParameters = GetSubsurfaceTileParameters ( SubsurfaceViewport , Tiles , TileType ) ;
2021-11-17 10:05:03 -05:00
}
2021-10-29 12:53:33 -04:00
PassParameters - > RenderTargets [ 0 ] = FRenderTargetBinding ( SubsurfaceIntermediateTexture , SceneColorTextureLoadAction ) ;
2022-03-15 03:11:08 -04:00
PassParameters - > SubsurfaceInput0 = GetSubsurfaceInput ( bReadSeparatedSubSurfaceSceneColor ? SeparatedSubSurfaceSceneColor : SceneColorTexture , SceneViewportParameters ) ;
2021-10-29 12:53:33 -04:00
PassParameters - > SubsurfaceSampler0 = BilinearBorderSampler ;
2022-04-01 08:35:55 -04:00
PassParameters - > Strata = Strata : : BindStrataGlobalUniformParameters ( View ) ;
2021-10-29 12:53:33 -04:00
// Scattering output target is only used when scattering is enabled.
2021-11-17 10:05:03 -05:00
if ( SubsurfaceMode ! = ESubsurfaceMode : : Bypass )
{
PassParameters - > SubsurfaceInput1 = GetSubsurfaceInput ( SubsurfaceSubpassTwoTex , SubsurfaceViewportParameters ) ;
PassParameters - > SubsurfaceSampler1 = BilinearBorderSampler ;
}
2021-10-29 12:53:33 -04:00
const FSubsurfaceRecombinePS : : EQuality RecombineQuality = FSubsurfaceRecombinePS : : GetQuality ( View ) ;
FSubsurfaceRecombinePS : : FPermutationDomain PixelShaderPermutationVector ;
PixelShaderPermutationVector . Set < FSubsurfaceRecombinePS : : FDimensionMode > ( SubsurfaceMode ) ;
PixelShaderPermutationVector . Set < FSubsurfaceRecombinePS : : FDimensionQuality > ( RecombineQuality ) ;
PixelShaderPermutationVector . Set < FSubsurfaceRecombinePS : : FDimensionCheckerboard > ( bCheckerboard ) ;
PixelShaderPermutationVector . Set < FSubsurfaceRecombinePS : : FDimensionHalfRes > ( bHalfRes ) ;
PixelShaderPermutationVector . Set < FSubsurfaceRecombinePS : : FRunningInSeparable > ( bForceRunningInSeparable ) ;
TShaderMapRef < FSubsurfaceRecombinePS > PixelShader ( View . ShaderMap , PixelShaderPermutationVector ) ;
TShaderMapRef < FSubsurfaceTilePassVS > VertexShader ( View . ShaderMap ) ;
2021-11-17 10:05:03 -05:00
FRHIBlendState * BlendState = TStaticBlendState < CW_RGBA , BO_Add , BF_One , BF_Zero , BO_Add , BF_One , BF_Zero > : : GetRHI ( ) ;
2021-10-29 12:53:33 -04:00
/**
2021-11-17 10:05:03 -05:00
* See the related comment above in the prepare pass . The scene viewport is used as both the target and
* texture viewport in order to ensure that the correct pixel is sampled for checkerboard rendering .
*/
2021-10-29 12:53:33 -04:00
AddSubsurfaceTiledScreenPass (
GraphBuilder ,
2021-11-18 14:37:34 -05:00
RDG_EVENT_NAME ( " SSS::Recombine(%s %s%s%s%s%s) %dx%d " ,
2021-10-29 12:53:33 -04:00
GetEventName ( PixelShaderPermutationVector . Get < FSubsurfaceRecombinePS : : FDimensionMode > ( ) ) ,
FSubsurfaceRecombinePS : : GetEventName ( PixelShaderPermutationVector . Get < FSubsurfaceRecombinePS : : FDimensionQuality > ( ) ) ,
PixelShaderPermutationVector . Get < FSubsurfaceRecombinePS : : FDimensionCheckerboard > ( ) ? TEXT ( " Checkerboard " ) : TEXT ( " " ) ,
PixelShaderPermutationVector . Get < FSubsurfaceRecombinePS : : FDimensionHalfRes > ( ) ? TEXT ( " HalfRes " ) : TEXT ( " " ) ,
PixelShaderPermutationVector . Get < FSubsurfaceRecombinePS : : FRunningInSeparable > ( ) ? TEXT ( " RunningInSeparable " ) : TEXT ( " " ) ,
2021-11-17 10:05:03 -05:00
! bShouldFallbackToFullScreenPass ? TEXT ( " Tiled " ) : TEXT ( " " ) ,
2021-10-29 12:53:33 -04:00
View . ViewRect . Width ( ) ,
View . ViewRect . Height ( ) ) ,
View ,
PassParameters ,
VertexShader ,
PixelShader ,
2021-11-17 10:05:03 -05:00
BlendState ,
DepthStencilState ,
2021-10-29 12:53:33 -04:00
SceneViewport ,
2021-11-17 10:05:03 -05:00
TileType ,
bShouldFallbackToFullScreenPass ) ;
2019-06-11 18:27:07 -04:00
}
2021-10-29 12:53:33 -04:00
//Write back to the SceneColor texture
{
FSubsurfaceTiles : : ETileType TileType = FSubsurfaceTiles : : ETileType : : All ;
2019-06-11 18:27:07 -04:00
2021-10-29 12:53:33 -04:00
FSubsurfaceRecombineCopyPS : : FParameters * PassParameters = GraphBuilder . AllocParameters < FSubsurfaceRecombineCopyPS : : FParameters > ( ) ;
PassParameters - > Subsurface = SubsurfaceCommonParameters ;
2021-11-17 10:05:03 -05:00
if ( SubsurfaceMode ! = ESubsurfaceMode : : Bypass )
{
2022-01-28 10:14:49 -05:00
PassParameters - > TileParameters = GetSubsurfaceTileParameters ( SubsurfaceViewport , Tiles , TileType ) ;
2021-11-17 10:05:03 -05:00
}
2022-03-15 03:11:08 -04:00
PassParameters - > RenderTargets [ 0 ] = bWriteSeparatedOpaqueRoughRefractionSceneColor ?
FRenderTargetBinding ( SeparatedOpaqueRoughRefractionSceneColor , ERenderTargetLoadAction : : ELoad ) :
FRenderTargetBinding ( SceneColorTexture , SceneColorTextureLoadAction ) ;
2021-10-29 12:53:33 -04:00
PassParameters - > SubsurfaceInput0 = GetSubsurfaceInput ( SubsurfaceIntermediateTexture , SceneViewportParameters ) ;
PassParameters - > SubsurfaceSampler0 = PointClampSampler ;
2022-04-01 08:35:55 -04:00
PassParameters - > Strata = Strata : : BindStrataGlobalUniformParameters ( View ) ;
2019-09-03 19:19:28 -04:00
2021-11-17 10:05:03 -05:00
TShaderMapRef < FSubsurfaceRecombineCopyPS > PixelShader ( View . ShaderMap ) ;
2021-10-29 12:53:33 -04:00
TShaderMapRef < FSubsurfaceTilePassVS > VertexShader ( View . ShaderMap ) ;
2022-03-15 03:11:08 -04:00
2022-01-12 13:41:35 -05:00
FRHIBlendState * BlendState = TStaticBlendState < CW_RGBA , BO_Add , BF_One , BF_Zero , BO_Add , BF_One , BF_Zero > : : GetRHI ( ) ;
2022-03-15 03:11:08 -04:00
if ( bWriteSeparatedOpaqueRoughRefractionSceneColor )
{
BlendState = TStaticBlendState < CW_RGBA , BO_Add , BF_One , BF_One , BO_Add , BF_One , BF_One > : : GetRHI ( ) ;
}
2021-11-17 10:05:03 -05:00
2021-10-29 12:53:33 -04:00
AddSubsurfaceTiledScreenPass (
GraphBuilder ,
2021-11-18 14:37:34 -05:00
RDG_EVENT_NAME ( " SSS::CopyToSceneColor%s %dx%d " ,
2021-11-17 10:05:03 -05:00
! bShouldFallbackToFullScreenPass ? TEXT ( " ( Tiled) " ) : TEXT ( " " ) ,
2021-10-29 12:53:33 -04:00
View . ViewRect . Width ( ) ,
View . ViewRect . Height ( ) ) ,
2021-11-17 10:05:03 -05:00
View ,
PassParameters ,
VertexShader ,
2021-10-29 12:53:33 -04:00
PixelShader ,
2021-11-17 10:05:03 -05:00
BlendState ,
DepthStencilState ,
SceneViewport ,
TileType ,
bShouldFallbackToFullScreenPass ) ;
2021-10-29 12:53:33 -04:00
}
2019-06-11 18:27:07 -04:00
}
2019-08-16 18:09:11 -04:00
2019-09-03 19:19:28 -04:00
if ( SubsurfaceMode ! = ESubsurfaceMode : : Bypass & & QualityHistoryState & & ! bForceRunningInSeparable )
2019-08-16 18:09:11 -04:00
{
2020-07-06 18:58:26 -04:00
GraphBuilder . QueueTextureExtraction ( NewQualityHistoryTexture , QualityHistoryState ) ;
2019-08-16 18:09:11 -04:00
}
2014-03-14 14:13:41 -04:00
}
2020-09-24 00:43:27 -04:00
FRDGTextureRef AddSubsurfacePass (
2019-06-11 18:27:07 -04:00
FRDGBuilder & GraphBuilder ,
2020-09-24 00:43:27 -04:00
TArrayView < const FViewInfo > Views ,
const uint32 ViewMask ,
2020-11-20 14:48:45 -04:00
const FSceneTextures & SceneTextures ,
2020-09-24 00:43:27 -04:00
FRDGTextureRef SceneColorTextureOutput )
2019-06-11 18:27:07 -04:00
{
const uint32 ViewCount = Views . Num ( ) ;
const uint32 ViewMaskAll = ( 1 < < ViewCount ) - 1 ;
2020-09-24 00:43:27 -04:00
check ( ViewMask ) ;
2019-06-11 18:27:07 -04:00
2020-11-20 14:48:45 -04:00
FRDGTextureRef SceneColorTexture = SceneTextures . Color . Target ;
2021-10-29 12:53:33 -04:00
ERenderTargetLoadAction SceneColorTextureLoadAction = ERenderTargetLoadAction : : ELoad ;
2019-06-11 18:27:07 -04:00
for ( uint32 ViewIndex = 0 ; ViewIndex < ViewCount ; + + ViewIndex )
{
const uint32 ViewBit = 1 < < ViewIndex ;
const bool bIsSubsurfaceView = ( ViewMask & ViewBit ) ! = 0 ;
if ( bIsSubsurfaceView )
{
RDG_EVENT_SCOPE ( GraphBuilder , " SubsurfaceScattering(ViewId=%d) " , ViewIndex ) ;
const FViewInfo & View = Views [ ViewIndex ] ;
2020-11-20 14:48:45 -04:00
AddSubsurfaceViewPass ( GraphBuilder , View , SceneTextures , SceneColorTextureOutput , SceneColorTextureLoadAction ) ;
2020-09-24 00:43:27 -04:00
SceneColorTextureLoadAction = ERenderTargetLoadAction : : ELoad ;
2019-06-11 18:27:07 -04:00
}
}
2020-09-24 00:43:27 -04:00
return SceneColorTextureOutput ;
2019-06-11 18:27:07 -04:00
}
2019-10-01 13:03:04 -04:00
FScreenPassTexture AddVisualizeSubsurfacePass ( FRDGBuilder & GraphBuilder , const FViewInfo & View , const FVisualizeSubsurfaceInputs & Inputs )
2019-06-11 18:27:07 -04:00
{
2019-10-01 13:03:04 -04:00
check ( Inputs . SceneColor . IsValid ( ) ) ;
2019-06-11 18:27:07 -04:00
2019-10-01 13:03:04 -04:00
FScreenPassRenderTarget Output = Inputs . OverrideOutput ;
if ( ! Output . IsValid ( ) )
{
Output = FScreenPassRenderTarget : : CreateFromInput ( GraphBuilder , Inputs . SceneColor , View . GetOverwriteLoadAction ( ) , TEXT ( " VisualizeSubsurface " ) ) ;
}
const FScreenPassTextureViewport InputViewport ( Inputs . SceneColor ) ;
2019-06-11 18:27:07 -04:00
FSubsurfaceVisualizePS : : FParameters * PassParameters = GraphBuilder . AllocParameters < FSubsurfaceVisualizePS : : FParameters > ( ) ;
2020-09-24 00:43:27 -04:00
PassParameters - > Subsurface = GetSubsurfaceCommonParameters ( GraphBuilder , View , Inputs . SceneTextures ) ;
2019-10-01 13:03:04 -04:00
PassParameters - > RenderTargets [ 0 ] = Output . GetRenderTargetBinding ( ) ;
PassParameters - > SubsurfaceInput0 . Texture = Inputs . SceneColor . Texture ;
PassParameters - > SubsurfaceInput0 . Viewport = GetScreenPassTextureViewportParameters ( InputViewport ) ;
2019-06-11 18:27:07 -04:00
PassParameters - > SubsurfaceSampler0 = TStaticSamplerState < SF_Point , AM_Clamp , AM_Clamp , AM_Clamp > : : GetRHI ( ) ;
PassParameters - > MiniFontTexture = GetMiniFontTexture ( ) ;
2022-04-01 08:35:55 -04:00
PassParameters - > Strata = Strata : : BindStrataGlobalUniformParameters ( View ) ;
2019-06-11 18:27:07 -04:00
TShaderMapRef < FSubsurfaceVisualizePS > PixelShader ( View . ShaderMap ) ;
2019-10-01 13:03:04 -04:00
RDG_EVENT_SCOPE ( GraphBuilder , " VisualizeSubsurface " ) ;
2021-11-18 14:37:34 -05:00
AddDrawScreenPass ( GraphBuilder , RDG_EVENT_NAME ( " SSS::Visualizer " ) , View , FScreenPassTextureViewport ( Output ) , InputViewport , PixelShader , PassParameters ) ;
2019-10-01 13:03:04 -04:00
Output . LoadAction = ERenderTargetLoadAction : : ELoad ;
2021-11-18 14:37:34 -05:00
AddDrawCanvasPass ( GraphBuilder , RDG_EVENT_NAME ( " SSS::Text " ) , View , Output , [ ] ( FCanvas & Canvas )
2019-06-11 18:27:07 -04:00
{
2019-10-01 13:03:04 -04:00
float X = 30 ;
float Y = 28 ;
const float YStep = 14 ;
2019-06-11 18:27:07 -04:00
2019-10-01 13:03:04 -04:00
FString Line = FString : : Printf ( TEXT ( " Visualize Screen Space Subsurface Scattering " ) ) ;
Canvas . DrawShadowedString ( X , Y + = YStep , * Line , GetStatsFont ( ) , FLinearColor ( 1 , 1 , 1 ) ) ;
Y + = YStep ;
uint32 Index = 0 ;
while ( GSubsurfaceProfileTextureObject . GetEntryString ( Index + + , Line ) )
2019-06-11 18:27:07 -04:00
{
Canvas . DrawShadowedString ( X , Y + = YStep , * Line , GetStatsFont ( ) , FLinearColor ( 1 , 1 , 1 ) ) ;
}
} ) ;
2019-10-01 13:03:04 -04:00
return MoveTemp ( Output ) ;
2019-06-11 18:27:07 -04:00
}
2020-11-18 15:16:23 -04:00
void AddSubsurfacePass (
2020-09-24 00:43:27 -04:00
FRDGBuilder & GraphBuilder ,
2020-11-20 14:48:45 -04:00
FSceneTextures & SceneTextures ,
2020-11-18 15:16:23 -04:00
TArrayView < const FViewInfo > Views )
2019-06-11 18:27:07 -04:00
{
2020-09-24 00:43:27 -04:00
const uint32 ViewMask = GetSubsurfaceRequiredViewMask ( Views ) ;
2019-06-11 18:27:07 -04:00
2020-09-24 00:43:27 -04:00
if ( ! ViewMask )
{
2020-11-18 15:16:23 -04:00
return ;
2020-09-24 00:43:27 -04:00
}
2019-06-11 18:27:07 -04:00
2020-11-18 15:16:23 -04:00
checkf ( ! SceneTextures . Color . IsSeparate ( ) , TEXT ( " Subsurface rendering requires the deferred renderer. " ) ) ;
2019-06-11 18:27:07 -04:00
2021-10-29 12:53:33 -04:00
AddSubsurfacePass ( GraphBuilder , Views , ViewMask , SceneTextures , SceneTextures . Color . Target ) ;
SceneTextures . Color . Resolve = SceneTextures . Color . Target ;
2020-09-24 00:43:27 -04:00
}