Files
UnrealEngineUWP/Engine/Source/Runtime/Renderer/Private/DistanceFieldShadowing.cpp

1174 lines
54 KiB
C++
Raw Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
DistanceFieldShadowing.cpp
=============================================================================*/
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 "CoreMinimal.h"
#include "Stats/Stats.h"
#include "HAL/IConsoleManager.h"
#include "RHI.h"
#include "ShaderParameters.h"
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 "RenderResource.h"
#include "RendererInterface.h"
#include "Shader.h"
#include "StaticBoundShaderState.h"
#include "SceneUtils.h"
#include "RHIStaticStates.h"
#include "PostProcess/SceneRenderTargets.h"
#include "LightSceneInfo.h"
#include "GlobalShader.h"
#include "SceneRenderTargetParameters.h"
#include "ShadowRendering.h"
#include "DeferredShadingRenderer.h"
#include "PostProcess/PostProcessing.h"
#include "PostProcess/SceneFilterRendering.h"
#include "DistanceFieldLightingShared.h"
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3274304) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3250856 on 2017/01/09 by Daniel.Wright Only showing instruction count for 'Base pass shader' now Change 3250943 on 2017/01/09 by Rolando.Caloca DR - Async Compute PSO creation Change 3251036 on 2017/01/09 by Rolando.Caloca DR - Add r.AsyncPipelineCompile - Dispatch on any thread - Wait for completion event Change 3251058 on 2017/01/09 by Ben.Woodhouse Fix for PSO creation D3D error with NumRenderTargets. Add code to compute the correct number of valid rendertargets to prevent an issue during PSO creation when NumRenderTargets is >0, but none of the formats are valid (all formats are DXGI_UNKNOWN) #jira UE-40332 Change 3251141 on 2017/01/09 by Ben.Woodhouse Duplicated from Fortnite CL 3243458: D3D12 memory optimization - The d3d12 buddy suballocator is very wasteful for allocations above 4KB, but the vast majority of allocations are smaller . In the default buffer allocator this was causing 149MB of waste in 340MB of allocations. Moving the max allocation size threshold down to 4KB from 512KB saved 100MB of memory wastage memory. On PC, buffers are 64KB aligned, so we need the threshold to be higher to avoid additional wastage. Add PIX memory tracking instrumentation for buddy allocators so we can track the memory properly in PIX Change 3251142 on 2017/01/09 by Ben.Woodhouse Duplicated from Fortnite 3243496 memory optimisation: use NULL-terminated ansi strings instead of unicode FStrings for symbols, saving 118MB. Previously the strings were loaded from disk as ansi and then converted to FStrings (slowly), before finally being converted them back to ansi strings before being used. In addition to reducing memory overhead, this change reduces complexity and improves startup time. Change 3252323 on 2017/01/10 by Rolando.Caloca DR - Gfx async PSO creation prep Change 3252474 on 2017/01/10 by Daniel.Wright Added 'Compile Unreal Lightmass' to error message Change 3252589 on 2017/01/10 by Daniel.Wright Back out bulk data for distance fields from cl 3241990 which causes distance fields to be corrupt in Fortnite Change 3252790 on 2017/01/10 by Daniel.Wright Added InscatteringColorCubemapAngle to exponential height fog Change 3252843 on 2017/01/10 by Uriel.Doyon Propper fix for UE-40211, where texture streaming bound defrag and async tasks could interact in coherent ways. The bound defrag is now done outside of the async work logic. Change 3252866 on 2017/01/10 by Mark.Satterthwaite Fix Metal shader pipeline hash collisions caused by deferring MTLFunction construction until PrepareToDraw so that we may use Function-Constants to specialise the shader source without generating additional permutations. This is required to generate proper tessellation shaders which are specialised against the index-buffer usage & type (none, uint16, uint32). While we're here amend the hash functions to make better use of the existing hash functions to improve the distribution and hopefully reduce the possibility of collisions in future. #jira UE-40357 Change 3254511 on 2017/01/11 by Rolando.Caloca DR - PSO stats Change 3255958 on 2017/01/12 by Mark.Satterthwaite Reimplement RQT_AbsoluteTime for Metal - pretty sure I did this before, but somehow it got lost. When a RQT_AbsoluteTime is inserted into the command-stream, insert a command-buffer completion handler to record the time of completion & submit the command-buffer immediately. This breaks command-buffers so is noticeably slower and if inserted in a pass that can't be restarted will fail but is currently the only option available. This is sufficient to support the GPUBenchmark used by Scalability. To make this more efficient I've refactored the FMetalCommandBufferFence implementation so that we use a single shared-ptr object containing the command-buffer and a dispatch semaphore, rather than allocating one for each query. The semaphore allows for timed-waits where previously we'd block until completion, unlike the other APIs that report failure after a fixed interval (2s for RQT_AbsoluteTime, otherwise 0.5s). Sadly not all drivers support this abuse of the Metal API, so replace the GL-based workaround for not having time queries with one that just guesses based on RHI device details. Radars will be filed. #jira UE-40554 Change 3256329 on 2017/01/12 by Olaf.Piesche #jira UE-38615 Assert shouldn't be necessary; in fact, it causes a crash when exporting emitters, since in that case we're changing the template at runtime. Change 3256371 on 2017/01/12 by Uriel.Doyon Reenabled texture streaming bound defrag as the fix is in CL 3252843 Change 3257032 on 2017/01/13 by Daniel.Wright Added fastClamp to fastmath.usf Change 3257111 on 2017/01/13 by Daniel.Wright Disabled bAffectDistanceFieldLighting on DefaultPawn, fixes VisualizeMeshDistanceFields in game Change 3257112 on 2017/01/13 by Daniel.Wright DFAO optimizations * Changed the culling algorithm to produce a list of intersecting screen tiles for each object, instead of the other way around. Each tile / object intersection gets its own cone tracing thread group so wavefronts are much smaller and scheduled better. 3.63ms -> 3.48ms (.15ms) * Replace slow instructions in inner loop with fast approximations (exp2 -> sqr + 1, rcpFast, lengthFast) 3.25ms -> 3.09ms (.16ms) * Moved transform from world to local space out of the inner loop (sample position constructed from local space position + direction) 3.09ms -> 3.04ms * Compute shader for ClearUAV 3.04ms -> 2.62ms (.42ms) Change 3257113 on 2017/01/13 by Daniel.Wright Better distance field memory stats Change 3257326 on 2017/01/13 by Uriel.Doyon Workaround to support cases where several textures have the same lighting GUID. Change 3257448 on 2017/01/13 by Daniel.Wright Removed legacy features Distance Field Specular Occlusion, Distance Field Surface Cache AO, PreCullTriangles Change 3257616 on 2017/01/13 by Daniel.Wright Distance field mesh visualization now uses a cone containing the entire tile to cull objects with, making the results stable Change 3257657 on 2017/01/13 by Daniel.Wright Mesh distance fields are stored zlib compressed in memory until needed for uploading to GPU * 81Mb of backing memory -> 32Mb in GPUPerfTest, atlas upload time 29ms -> 893ms Change 3258063 on 2017/01/14 by Rolando.Caloca DR - vk - Refactor descriptor set reuse in prep for more changes Change 3258715 on 2017/01/16 by Daniel.Wright Added VisualizeGlobalDistanceField show flag Change 3258827 on 2017/01/16 by Daniel.Wright Global distance field update regions are clipped against others to reduce redundant updates. Change 3258959 on 2017/01/16 by Benjamin.Hyder Updating Planar Reflection example material in TM-Shadermodels Change 3259270 on 2017/01/16 by Daniel.Wright [Copy] 'r.MSAACount 1' now produces no MSAA or TAA. 'r.MSAACount 0' can be used to toggle TAA on for comparisons. Change 3259652 on 2017/01/16 by Uriel.Doyon Better support for static primitive becoming dynamic. Change 3260107 on 2017/01/17 by Ben.Woodhouse Fix FMonitoredProcess to prevent infinite loop in -nothreading mode #jira UE-40717 Change 3260594 on 2017/01/17 by Daniel.Wright Added a new global distance field (4x 128^3 clipmaps) which caches mostly static primitives (Mobility set to Static or Stationary) * The full global distance field inherits from the mostly static cache, so when a Movable primitive is modified, only other movable primitives in the vicinity need to be re-composited into the global distance field * Global distance field update cost with one large rotating object went from 2.5ms -> .2ms on 970GTX and 4.6ms -> .3ms. Worst case full volume update is mostly the same. * Adds 12Mb for the new volume textures Change 3260956 on 2017/01/17 by Daniel.Wright Structured buffers for DF object data * Full global distance field clipmap composite 3.0ms -> 2.0ms due to scalarized loads Change 3261296 on 2017/01/17 by Daniel.Wright Exposed MaxObjectsPerTile with 'r.AOMaxObjectsPerCullTile' and lowered the default from 512 to 256, saves 17Mb of object tile culling data structures Removed unnecessary UAV transitions preventing object and global cone tracing from overlapping, saves ~.1ms Change 3262036 on 2017/01/18 by Ben.Salem V0 of Perf monitor plugin for easily consumable stat csvs. With plugin enabled, enter PerformanceMonitor help into the console to get usage details. Change 3262056 on 2017/01/18 by Chris.Bunner Remove inverse tonemapping when rendering HDR output. #jira UE-40728 Change 3262661 on 2017/01/18 by Rolando.Caloca DR - Add missing SetStencilRef() and SetBlendFactor() on most RHIs - Fix hash for PSOs Change 3263674 on 2017/01/19 by Chris.Bunner PR #3144: Improved error messages (Contributed by DarkSlot) #jira UE-40835 Change 3264150 on 2017/01/19 by Ben.Woodhouse Add support for single threaded in FMonitoredProcess. Deprecated IsRunning() in favour of a new Update() method because polling IsRunning is not compatible with -nothreading mode #jira UE-40841 Change 3264153 on 2017/01/19 by Ben.Woodhouse Integrate latest changes from MS-DX12 CLs 3231395-3262526 - Added WinPixEventRuntime.tps - Includes PIX support, various optimizations (saved 1.3ms in testbed scene) CL 3262343: Fix depth testing on translucency not working correctly after cl 3231395. This change reapplies the D3D12RHI changes from CL 3231395 because those changes were lost when integrating from //Dev-Rendering/ but also includes the depth fixes: - Fix depth state not being in DEPTH_READ for use as depth read. The issue was HasDepthBits and HasStencilBits wern't intended for SRV formats and always returned false in the SRV case. CL 3231395: Update D3D12 RHI: - Fix deferred MSAA path in RHI - Add Pix3.h support - Cleanup SetName usage and remove it from shipping builds. - Fix fence reuse bug. We were signaling MAX UINT (-1) and then waiting for 0, which was always signaled. This change also removes the fence value reset code, there is no need to reset a fence to a previous value. - Use FPlatformAtomics::InterlockedIncrement instead of InterlockedIncrement64 - Use InterlockedIncrement() instead of _InterlockedIncrement() and use the FPlatformAtomics:: version. - Fix possible readback heap being evicted while in use. GetQueryData happens on the render thread and isn't tied to a command list so we should always have readback heaps resident. Change 3264251 on 2017/01/19 by Mark.Satterthwaite Modify some asserts in MetalRHI - technically using a store-action of ENoAction on Stencil buffers should make it invalid to restart a render-pass but on Mac it will work because ENoAction won't invalidate anything written. In future we need to use deferred store-actions in Metal so that we can "restart" passes while enforcing correct Load/Store actions. #jira UE-40803 Change 3264642 on 2017/01/19 by Daniel.Wright Raised GMaxShadowDepthBufferSizeX to max texture resolution on most platforms, was previously 4096. Change 3265330 on 2017/01/20 by Ben.Salem Stop performance plugin from building in Win32. #tests recompiled and preflighted Change 3265678 on 2017/01/20 by Marcus.Wassmer Fix bad declaration. #3055 Change 3266656 on 2017/01/20 by Mark.Satterthwaite Changes to the FShaderCache to restore it and extend it to optionally report on shader de-duplication when generating a binary shader cache (Console Variable: r.BinaryShaderCacheLogging). Duplicate & amend CL #3266053 from Trepka: Fixed issues with shader cache not working properly with Mac Metal (but it still requires -norhithread to work at all). Enabled the shader cache by default if RHI thread is disabled. Amend & integrate RCO's CL #3197085. Change 3267741 on 2017/01/23 by Rolando.Caloca DR - Detect duplicated shader and pipeline types Change 3268600 on 2017/01/23 by Uriel.Doyon Added missing r.Streaming.MaxEffectiveScreenSize config to base texture scability settings. Integrated CL 3227368 from Orion stream Enabled r.Streaming.UsePerTextureBias by default as this has been tested in Orion for several months. Fixed issue with the InvestigateTexture command which could return invalid reference depending on the timing, Added th MaxEffectiveScreenSize settings in the investigate texture command. Change 3269512 on 2017/01/24 by Richard.Wallis Fix for shader binary cache uncompress data size during internal shader log. Change 3271237 on 2017/01/25 by Ben.Woodhouse D3D12 updateTexture2D crash fix #jira UE-41059 Change 3271564 on 2017/01/25 by Olaf.Piesche #jira UE-40980 #udn 325525 Fix uniform buffers for mesh particles; these should really be on the mesh collector, so allocating them as a one frame resource is safe Change 3271594 on 2017/01/25 by Ben.Woodhouse ESRAM support stage 1: Implemented noncontiguous ESRAM page allocator replacing XgMemoryLayout API. The allocator allocates non-contiguous ranges of pages and maps them onto a contiguous virtual address range. Unlike the previous implementation, this allocator frees pages for reuse when resources are destroyed Note: issues with deferred deallocation may prevent reuse in many cases - that will be addressed in the next stage Support for the old allocator is still available (for now) via the define NEW_ESRAM_ALLOCATOR #fyi rolando.caloca Change 3272616 on 2017/01/25 by Rolando.Caloca DR - Update shader version Change 3273138 on 2017/01/26 by Ben.Woodhouse Fix merge issue with MonitoredProcess.cpp (this arose from an integration made as an edit in dev-rendering, which confused perforce when the change was subsequently integrated from main) [CL 3274498 by Rolando Caloca in Main branch]
2017-01-26 19:20:49 -05:00
#include "DistanceFieldAmbientOcclusion.h"
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
#include "PipelineStateCache.h"
#include "ClearQuad.h"
#include "Strata/Strata.h"
#include "PixelShaderUtils.h"
int32 GDistanceFieldShadowing = 1;
FAutoConsoleVariableRef CVarDistanceFieldShadowing(
TEXT("r.DistanceFieldShadowing"),
GDistanceFieldShadowing,
TEXT("Whether the distance field shadowing feature is allowed."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GDFShadowQuality = 3;
FAutoConsoleVariableRef CVarDFShadowQuality(
TEXT("r.DFShadowQuality"),
GDFShadowQuality,
TEXT("Defines the distance field shadow method which allows to adjust for quality or performance.\n")
TEXT(" 0:off, 1:low (20 steps, no SSS), 2:medium (32 steps, no SSS), 3:high (64 steps, SSS, default)"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GFullResolutionDFShadowing = 0;
FAutoConsoleVariableRef CVarFullResolutionDFShadowing(
TEXT("r.DFFullResolution"),
GFullResolutionDFShadowing,
TEXT("1 = full resolution distance field shadowing, 0 = half resolution with bilateral upsample."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GShadowScatterTileCulling = 1;
FAutoConsoleVariableRef CVarShadowScatterTileCulling(
TEXT("r.DFShadowScatterTileCulling"),
GShadowScatterTileCulling,
TEXT("Whether to use the rasterizer to scatter objects onto the tile grid for culling."),
ECVF_RenderThreadSafe
);
float GShadowCullTileWorldSize = 200.0f;
FAutoConsoleVariableRef CVarShadowCullTileWorldSize(
TEXT("r.DFShadowCullTileWorldSize"),
GShadowCullTileWorldSize,
TEXT("World space size of a tile used for culling for directional lights."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GTwoSidedMeshDistanceBias = 4;
FAutoConsoleVariableRef CVarTwoSidedMeshDistanceBias(
TEXT("r.DFTwoSidedMeshDistanceBias"),
GTwoSidedMeshDistanceBias,
TEXT("World space amount to expand distance field representations of two sided meshes. This is useful to get tree shadows to match up with standard shadow mapping."),
Copying //UE4/Dev-Rendering to Dev-Main (//UE4/Dev-Main) (Source: //UE4/Dev-Rendering @ 2943238) #lockdown nick.penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 2932679 on 2016/04/04 by Martin.Mittring remove hack/cvar that is not longer needed as we fixed the bug #rb:Bob.Tellez #code_review:Bob.Tellez Change 2932681 on 2016/04/04 by Martin.Mittring fixed cvars in consolevariables.ini can affect engine even if marked with cheat (no longer load consolevariables.ini in shipping and test), unified 3 code path, added testcase, cvars with cheat in ini file other than consolevariables.ini now trigger ensure, =on/off/true/false/.. works in all ini files, added enure if non scalability setting are used in ScalabilityIni (get now ignored) #rb:David.Hill #code_review:Marcus.Wassmer, Michael.Noland Change 2932719 on 2016/04/04 by Marcus.Wassmer Merge 3 band SH back to DevRendering #rb Daniel.Wright Change 2932760 on 2016/04/04 by Zabir.Hoque Migrating high resolution cubemaps for skylight and reflection probes. #rb: Daniel.Wright Change 2933121 on 2016/04/05 by Rolando.Caloca DR - vk - Fix free blocks not getting joined - Fix compile issue Change 2933122 on 2016/04/05 by Rolando.Caloca DR - Do not shorten dumped shaders path Change 2933126 on 2016/04/05 by Rolando.Caloca DR - vk - Index Buffers using new resource management Change 2933127 on 2016/04/05 by Rolando.Caloca DR - vk - Extract multibuffer off index buffer Change 2933131 on 2016/04/05 by Rolando.Caloca DR - vk - Transition to vb's using mutlibuffer Change 2933136 on 2016/04/05 by Rolando.Caloca DR - vk - Change staging buffers to use resource allocation system - Fix free block not getting joined - Remove define Change 2933140 on 2016/04/05 by Rolando.Caloca DR - vk - 'static' textures now use resource mgmt - Release free pages back to the OS - Remove ensure Change 2933152 on 2016/04/05 by Rolando.Caloca DR - vk - Fix aliasing granularity - Fix renderpass end/copy buffer ensure Change 2933155 on 2016/04/05 by Rolando.Caloca DR - SCW - Fix for -directcompile to directly load file for preprocessor Change 2933158 on 2016/04/05 by Rolando.Caloca DR - hlslcc - Error on Metal if trying to R & W on RWTextures - Fix indices on RW reads to be unsigned #codereview Mark.Satterthwaite, Michael.Trepka Change 2933169 on 2016/04/05 by Rolando.Caloca DR - vk - Move header to public to match changes on DevMobile Change 2933173 on 2016/04/05 by David.Hill Deferred decal rendering with negative scale #rb:Matrin.Mittring #jira:UE-27389 Change 2933273 on 2016/04/05 by Rolando.Caloca DR - vk - Fix renderdoc markers Change 2933274 on 2016/04/05 by Rolando.Caloca DR - Support for -AttachDebugger Change 2933316 on 2016/04/05 by Rolando.Caloca DR - vk - Compile fix whene enabling define Change 2933334 on 2016/04/05 by Rolando.Caloca DR - Compile fix #codereview Martin.Mittring Change 2933805 on 2016/04/05 by Brian.Karis Temporal AA dynamic antighosting. Fixed DOF Change 2933811 on 2016/04/05 by Brian.Karis Fixed area light NaNs. Improvements to area lights. Horizen handling for wrap around. Change 2933812 on 2016/04/05 by Brian.Karis Fixed fresnel on SSS skin. Change 2933813 on 2016/04/05 by Brian.Karis Tessellation fix Change 2933816 on 2016/04/05 by Brian.Karis Improved forward shading support [CL 2943241 by Gil Gribb in Main branch]
2016-04-13 21:24:38 -04:00
ECVF_RenderThreadSafe
);
int32 GAverageObjectsPerShadowCullTile = 128;
FAutoConsoleVariableRef CVarAverageObjectsPerShadowCullTile(
TEXT("r.DFShadowAverageObjectsPerCullTile"),
GAverageObjectsPerShadowCullTile,
TEXT("Determines how much memory should be allocated in distance field object culling data structures. Too much = memory waste, too little = flickering due to buffer overflow."),
ECVF_RenderThreadSafe | ECVF_ReadOnly
);
int32 GDFShadowAsyncCompute = 0;
static FAutoConsoleVariableRef CVarDFShadowAsyncCompute(
TEXT("r.DFShadowAsyncCompute"),
GDFShadowAsyncCompute,
TEXT("Whether render distance field shadows using async compute if possible"),
ECVF_RenderThreadSafe);
static int32 GHeightFieldShadowing = 0;
FAutoConsoleVariableRef CVarHeightFieldShadowing(
TEXT("r.HeightFieldShadowing"),
GHeightFieldShadowing,
TEXT("Whether the height field shadowing feature is allowed."),
ECVF_Scalability | ECVF_RenderThreadSafe);
int32 GHFShadowQuality = 2;
FAutoConsoleVariableRef CVarHFShadowQuality(
TEXT("r.HFShadowQuality"),
GHFShadowQuality,
TEXT("Defines the height field shadow method which allows to adjust for quality or performance.\n")
TEXT(" 0:off, 1:low (8 steps), 2:medium (16 steps, default), 3:high (32 steps, hole aware)"),
ECVF_Scalability | ECVF_RenderThreadSafe);
static float GMinDirectionalLightAngleForRTHF = 27.f;
static FAutoConsoleVariableRef CVarMinDirectionalLightAngleForRTHF(
TEXT("r.Shadow.MinDirectionalLightAngleForRTHF"),
GMinDirectionalLightAngleForRTHF,
TEXT(""),
ECVF_RenderThreadSafe);
int32 GAverageHeightFieldObjectsPerShadowCullTile = 16;
FAutoConsoleVariableRef CVarAverageHeightFieldObjectsPerShadowCullTile(
TEXT("r.HFShadowAverageObjectsPerCullTile"),
GAverageHeightFieldObjectsPerShadowCullTile,
TEXT("Determines how much memory should be allocated in height field object culling data structures. Too much = memory waste, too little = flickering due to buffer overflow."),
ECVF_RenderThreadSafe | ECVF_ReadOnly);
int32 GDFShadowCompactCulledObjects = 1;
static FAutoConsoleVariableRef CVarCompactCulledObjects(
TEXT("r.DFShadowCompactCulledObjects"),
GDFShadowCompactCulledObjects,
TEXT("Whether to compact culled object indices when using scattered tile culling. ")
TEXT("Note that each tile can only hold up to r.DFShadowAverageObjectsPerCullTile number of objects when compaction is not used."),
ECVF_RenderThreadSafe);
int32 const GDistanceFieldShadowTileSizeX = 8;
int32 const GDistanceFieldShadowTileSizeY = 8;
int32 GetDFShadowDownsampleFactor()
{
return GFullResolutionDFShadowing ? 1 : GAODownsampleFactor;
}
UE5_MAIN: Multi-view-family scene renderer refactor, part 2. Move FSceneTextures singleton out of RDG blackboard and FSceneTexturesConfig global variable singleton, into FViewFamilyInfo. This is necessary to allow multiple view families to render in a single render graph and a single scene renderer call. * Existing calls to CreateSceneTextureShaderParameters and similar functions use "GetSceneTexturesChecked", which allows for the possibility that they are reached in a code path where scene textures haven't been initialized, and nullptr is returned instead of asserting. The shader parameter setup functions then fill in dummy defaults for that case. The goal was to precisely match the original behavior, which queried the RDG blackboard, and gracefully handled null if scene textures weren't there. This definitely appears to occur in FNiagaraGpuComputeDispatch::ProcessPendingTicksFlush, which can be called with a dummy scene with no scene textures. In the future, I may change this so dummy defaults are filled in for FSceneTextures at construction time, so the structure is never in an uninitialized state, but I would like to set up a test case for the Niagara code path before doing that, and the checks aren't harmful in the meantime. * I marked as deprecated global functions which query values from FSceneTexturesConfig, but they'll still work with the caveat that if you use multi-view-family rendering, the results will be indeterminate (whatever view family rendered last). There was only one case outside the scene renderer that accessed the globals (depth clear value), which I removed, noting that there is nowhere in the code where we modify the depth clear value from its global default. I would like to permanently deprecate or remove these at some point. Display Cluster is the only code that's currently using the multi-view-family code path, and as a new (still incomplete) feature, third party code can't be using it, and won't be affected. #jira NONE #rb chris.kulla zach.bethel mihnea.balta #preflight 6261aca76119a1a496bd2644 [CL 19873983 by jason hoerner in ue5-main branch]
2022-04-22 17:33:02 -04:00
FIntPoint GetBufferSizeForDFShadows(const FViewInfo& View)
{
UE5_MAIN: Multi-view-family scene renderer refactor, part 2. Move FSceneTextures singleton out of RDG blackboard and FSceneTexturesConfig global variable singleton, into FViewFamilyInfo. This is necessary to allow multiple view families to render in a single render graph and a single scene renderer call. * Existing calls to CreateSceneTextureShaderParameters and similar functions use "GetSceneTexturesChecked", which allows for the possibility that they are reached in a code path where scene textures haven't been initialized, and nullptr is returned instead of asserting. The shader parameter setup functions then fill in dummy defaults for that case. The goal was to precisely match the original behavior, which queried the RDG blackboard, and gracefully handled null if scene textures weren't there. This definitely appears to occur in FNiagaraGpuComputeDispatch::ProcessPendingTicksFlush, which can be called with a dummy scene with no scene textures. In the future, I may change this so dummy defaults are filled in for FSceneTextures at construction time, so the structure is never in an uninitialized state, but I would like to set up a test case for the Niagara code path before doing that, and the checks aren't harmful in the meantime. * I marked as deprecated global functions which query values from FSceneTexturesConfig, but they'll still work with the caveat that if you use multi-view-family rendering, the results will be indeterminate (whatever view family rendered last). There was only one case outside the scene renderer that accessed the globals (depth clear value), which I removed, noting that there is nowhere in the code where we modify the depth clear value from its global default. I would like to permanently deprecate or remove these at some point. Display Cluster is the only code that's currently using the multi-view-family code path, and as a new (still incomplete) feature, third party code can't be using it, and won't be affected. #jira NONE #rb chris.kulla zach.bethel mihnea.balta #preflight 6261aca76119a1a496bd2644 [CL 19873983 by jason hoerner in ue5-main branch]
2022-04-22 17:33:02 -04:00
return FIntPoint::DivideAndRoundDown(View.GetSceneTexturesConfig().Extent, GetDFShadowDownsampleFactor());
}
class FCullObjectsForShadowCS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER(FCullObjectsForShadowCS);
SHADER_USE_PARAMETER_STRUCT(FCullObjectsForShadowCS, FGlobalShader);
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
SHADER_PARAMETER_RDG_UNIFORM_BUFFER(FStrataGlobalUniformParameters, Strata)
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldObjectBufferParameters, ObjectBufferParameters)
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldCulledObjectBufferParameters, CulledObjectBufferParameters)
SHADER_PARAMETER(uint32, ObjectBoundingGeometryIndexCount)
SHADER_PARAMETER(FMatrix44f, TranslatedWorldToShadow)
SHADER_PARAMETER(uint32, NumShadowHullPlanes)
SHADER_PARAMETER(uint32, bDrawNaniteMeshes)
SHADER_PARAMETER(FVector4f, ShadowBoundingSphere)
SHADER_PARAMETER_ARRAY(FVector4f,ShadowConvexHull,[12])
END_SHADER_PARAMETER_STRUCT()
class FPrimitiveType : SHADER_PERMUTATION_INT("DISTANCEFIELD_PRIMITIVE_TYPE", 2);
using FPermutationDomain = TShaderPermutationDomain<FPrimitiveType>;
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)
{
return DoesPlatformSupportDistanceFieldShadowing(Parameters.Platform);
}
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)
{
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);
OutEnvironment.SetDefine(TEXT("UPDATEOBJECTS_THREADGROUP_SIZE"), UpdateObjectsGroupSize);
}
};
IMPLEMENT_GLOBAL_SHADER(FCullObjectsForShadowCS, "/Engine/Private/DistanceFieldShadowing.usf", "CullObjectsForShadowCS", SF_Compute);
class FShadowObjectCullVS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER(FShadowObjectCullVS);
SHADER_USE_PARAMETER_STRUCT(FShadowObjectCullVS, FGlobalShader);
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldObjectBufferParameters, ObjectBufferParameters)
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldCulledObjectBufferParameters, CulledObjectBufferParameters)
SHADER_PARAMETER(FMatrix44f, TranslatedWorldToShadow)
SHADER_PARAMETER(float, MinExpandRadius)
END_SHADER_PARAMETER_STRUCT()
class FPrimitiveType : SHADER_PERMUTATION_INT("DISTANCEFIELD_PRIMITIVE_TYPE", 2);
using FPermutationDomain = TShaderPermutationDomain<FPrimitiveType>;
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)
{
return DoesPlatformSupportDistanceFieldShadowing(Parameters.Platform);
}
};
IMPLEMENT_GLOBAL_SHADER(FShadowObjectCullVS, "/Engine/Private/DistanceFieldShadowing.usf", "ShadowObjectCullVS", SF_Vertex);
class FShadowObjectCullPS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER(FShadowObjectCullPS);
SHADER_USE_PARAMETER_STRUCT(FShadowObjectCullPS, FGlobalShader);
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldObjectBufferParameters, ObjectBufferParameters)
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldCulledObjectBufferParameters, CulledObjectBufferParameters)
SHADER_PARAMETER_STRUCT_INCLUDE(FLightTileIntersectionParameters, LightTileIntersectionParameters)
SHADER_PARAMETER(FMatrix44f, TranslatedWorldToShadow)
SHADER_PARAMETER(float, ObjectExpandScale)
END_SHADER_PARAMETER_STRUCT()
class FPrimitiveType : SHADER_PERMUTATION_INT("DISTANCEFIELD_PRIMITIVE_TYPE", 2);
class FCountingPass : SHADER_PERMUTATION_BOOL("SCATTER_CULLING_COUNT_PASS");
class FCompactCulledObjects : SHADER_PERMUTATION_BOOL("COMPACT_CULLED_SHADOW_OBJECTS");
using FPermutationDomain = TShaderPermutationDomain<FPrimitiveType, FCountingPass, FCompactCulledObjects>;
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)
{
const FPermutationDomain PermutationVector(Parameters.PermutationId);
if (!PermutationVector.Get<FCompactCulledObjects>() && PermutationVector.Get<FCountingPass>())
{
// We don't need a counting pass if we don't compact culled objects
return false;
}
return DoesPlatformSupportDistanceFieldShadowing(Parameters.Platform);
}
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)
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3249742) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3232283 on 2016/12/13 by Ben.Woodhouse D3D12 - downgrade root signature size warning to a log following a discussion with Microsoft. There's not much we can actually do about it, and it's not relevant to all hardware #jira UE-36999 Change 3232641 on 2016/12/13 by Mark.Satterthwaite - Eliminate redundant state changes in MetalRHI in the state cache. - Add a new debug level for setting buffers to nil prior to calls to set*Bytes so that the tool doesn't display incorrect data. - Make testing for validation & statistics features use the same EMetalFeatures API as everything else for consistency. - Cache the fallback depth-stencil texture in the state cache and ignore it for determining whether a pass can restart - if we are using this texture its contents are worthless anyway. Change 3232661 on 2016/12/13 by Mark.Satterthwaite Re-enable Metal SM5 & DFAO/DistanceFieldShadowing on Intel for 10.12.2 or later. Change 3232759 on 2016/12/13 by Ben.Woodhouse Fix memory leak on XB1 when calling GPURealloc with count of 0, suggested on UDN https://udn.unrealengine.com/questions/326660/gpurealloc-leak.html Change 3232803 on 2016/12/13 by Ben.Marsh Add UT to the populate DDC job, and cook UT and Fortnite for Mac as well. Change 3232836 on 2016/12/13 by Ben.Marsh Split cooks to populate DDC into separate nodes for each platform. May help to reduce number of timeouts on remote VMs. Change 3232974 on 2016/12/13 by Rolando.Caloca DR - Refactor common code to UWorld::RecreateScene #jira UE-36719 PR #2824 Change 3232976 on 2016/12/13 by Ben.Marsh Add missing dependency on tools node for Mac cooks. Need to compile SCW first. Change 3233289 on 2016/12/13 by Olaf.Piesche Fixing potentially broken spot/point light fade with old content; initialize new properties properly Change 3233811 on 2016/12/13 by Mark.Satterthwaite Fix compiling QA-Material tessellation shaders that don't need to emit from Hull or sample in Domain the HSOut buffer which was confusing MetalBackend. Change 3233854 on 2016/12/13 by Mark.Satterthwaite More information about texture type validation errors in Metal. Change 3234650 on 2016/12/14 by Rolando.Caloca DR - vk - Fix bad aspect on depth cubemaps Change 3234651 on 2016/12/14 by Rolando.Caloca DR - vk - Fix for 32 bit crash on dump layer Change 3234813 on 2016/12/14 by Guillaume.Abadie Fixes texture mask static lighting when using GBuffer selective outputs. #jira UE-39527 Change 3235047 on 2016/12/14 by Uriel.Doyon Refactored HLOD texture streaming strategy to separate forced load from visibility. Added an incremental update in the last stage of the texture streaming update load to clear any pending work. Added an option "All" to the "BuildMateriaTexturelStreamingData" command to force rebuild everything. Change 3235317 on 2016/12/14 by Uriel.Doyon Removed timed primitives in the texture streaming since it was not used and there is now a fallback implementation in UPrimitiveComponent::GetStreamingTextureInfo. Change 3235431 on 2016/12/14 by Rolando.Caloca DR - Fix for Vulkan drawing black Change 3236788 on 2016/12/15 by Mark.Satterthwaite Fix 10.11.6 support (aka -nometalv2): the stencil view workaround necessitates a mid-render blit and the way things were setup resulted in the HasValidRenderTargets assert firing. Refactored the code to separate the concept or valid render-states in the cache from active render-states in the render-pass. Now it works as intended and will be needed for 4.15. Change 3236850 on 2016/12/15 by Mark.Satterthwaite Make changing the Metal Shader Version project setting prompt the user to restart for the changes to take effect. #jira UE-39801 Change 3237002 on 2016/12/15 by Benjamin.Hyder submitting updated TM-Shadermodels map Change 3237312 on 2016/12/15 by Rolando.Caloca DR - Change more macros to lambdas Change 3237394 on 2016/12/15 by Mark.Satterthwaite Add Metal-specific permutations of TBasePassHS - they affect the C++ definition on all platforms but are only cached or used on Metal - because the way we compile the combined VS+HS tessellation stage requires that the combined VS + HS HLSL code references the same resources, otherwise we get incorrect resouce bindings and subsequently fail to render properly. Long-term the Metal tessellation code will need to be refactored so that the vertex shader stage is emitted as a separate shader from the hull shader stage as this but will keep cropping back up and continue to complicate the engine. #jira UE-39799 Change 3237490 on 2016/12/15 by Daniel.Wright Fixed ULandscapeComponent::GetUsedMaterials Change 3237597 on 2016/12/15 by Ben.Woodhouse Disable timestamp queries on pre-Maxwell nvidia hardware. Local testing suggests that this is the major cause of instability in the UE4.14 release. It's possible that we could be more targeted by only excluding Fermi and older hardware, but identifying fermi hardware by device ID is difficult in practice, since the range overlaps with Kepler. Change 3237654 on 2016/12/15 by Daniel.Wright Non-editor compile fix Change 3238229 on 2016/12/16 by Rolando.Caloca DR - Remove ExcludeRect from inner RHI Clear methods; ensure will happen if trying to use it Change 3238236 on 2016/12/16 by Rolando.Caloca DR - Compile fixes Change 3238280 on 2016/12/16 by Marc.Olano Small optimization to Lanczos-3 upsample shader code. Change 3238321 on 2016/12/16 by Rolando.Caloca DR - Compile fix Change 3238331 on 2016/12/16 by Rolando.Caloca DR - compile fix Change 3238495 on 2016/12/16 by Marc.Olano Replace TEA random number generator with PCG. Was only used in #if-disabled reference rendering, but ldoes make better quality reference rendering when enabled. Change 3238496 on 2016/12/16 by Marc.Olano Tone mapping fix for OR-31752, cherry picked from Orion 3208273 Assumption that green is approximates luminance fails on red/blue HDR content, resulting in ugly black artifacts. Go back to luminance. Change 3238520 on 2016/12/16 by Rolando.Caloca DR - CIS Fix Change 3238571 on 2016/12/16 by Rolando.Caloca DR - CIS fix Change 3238605 on 2016/12/16 by Daniel.Wright Sharing IndirectLightingCacheTextureSampler samplers Change 3238626 on 2016/12/16 by Daniel.Wright Ray Traced Distance Field Shadow optimizations * Tighter light space tile culling * Skip ray marching pixels before the RTDF cascade near distance, or further than the cascade far distance * Depth bounds test on upsample * Created FLightTileIntersectionParameters for encapsulation of light tile culling functionality * RTDF shadow time went from 1.8ms -> .8ms and 3.1ms -> 1.2ms in FortGPUTestbed on 7870 with these changes Change 3238652 on 2016/12/16 by Rolando.Caloca DR - RHI clear methods no longer have an ExcludeRect, use DrawClearQuad functions instead Change 3238855 on 2016/12/16 by Rolando.Caloca DR - Added FRHITexture2D GetSizeXY Change 3238881 on 2016/12/16 by Rolando.Caloca DR - CIS fix Change 3239008 on 2016/12/16 by Arne.Schober DR - Fixing accidently returning a stackpointer in EnqueueRenderCommands Change 3239012 on 2016/12/16 by Arne.Schober DR - missing file Change 3239255 on 2016/12/17 by Rolando.Caloca DR - Remove shader clears from D3D11 Change 3239690 on 2016/12/19 by Rolando.Caloca DR - vk - Misc fixes from 1.0.37.00 SDK warnings Change 3239964 on 2016/12/19 by Rolando.Caloca DR - Fix click on editor not showing selected Change 3239995 on 2016/12/19 by Rolando.Caloca DR - Enable dist field on GL4 & Vulkan SM5 Change 3240162 on 2016/12/19 by Daniel.Wright Added EnableDepthBoundsTest / DisableDepthBoundsTest to RHIUtilites to share some common code Change 3240163 on 2016/12/19 by Daniel.Wright Distance field self shadowing controls for hiding world position offset self-shadow artifacts * Removed static mesh build settings DistanceFieldBias, which shrunk the distance field, breaking AO and shadows * Added DistanceFieldSelfShadowBias, which prevents occlusion close to the surface only, maintaining shadows on the ground and AO on the ground Change 3240271 on 2016/12/19 by Daniel.Wright Use 16 bit indices for distance field objects culled to tiles, when 16 bit will be enough. Saves 10mb of tile culling buffers. Change 3240282 on 2016/12/19 by Rolando.Caloca DR - Proper fix for hit proxies clear - Added missing stencil ref to DrawClearQuad Change 3240316 on 2016/12/19 by Rolando.Caloca DR - vk - Fixed some new 1.0.37.0 warnings Change 3240354 on 2016/12/19 by Rolando.Caloca DR - Dev shaders on sm4/5 Change 3240759 on 2016/12/20 by Rolando.Caloca DR - Fix bad crc on GL element declarations Change 3240895 on 2016/12/20 by Rolando.Caloca DR - vk - Swapchain fixes Change 3241057 on 2016/12/20 by Rolando.Caloca DR - vk - Fix resize on desktop Change 3241112 on 2016/12/20 by Rolando.Caloca DR - vk - Fix 1.0.37.0 warnings - Ignore some warnings we know we can't fix Change 3241310 on 2016/12/20 by Rolando.Caloca DR - vk - Fix crash Change 3241417 on 2016/12/20 by Daniel.Wright [Copy] Fixed race condition with FPrecomputedLightVolume::Data which was exposed when switching lighting scenarios Change 3241990 on 2016/12/21 by Daniel.Wright Converted DistanceFieldVolume data to BulkData * FDistanceFieldVolumeData Serialize time from .7s on PS4 to 0s Change 3242005 on 2016/12/21 by Daniel.Wright Removed unused !USE_DEPTH_RANGE_LISTS path to reduce complexity Change 3242295 on 2016/12/21 by Bob.Tellez Duplicating CL#3242294 from //Fortnite/Main #UE4 Re-applying the fix for rendering editor primitives when r.EarlyZPassOnlyMaterialMasking is enabled Change 3242487 on 2016/12/21 by Marcus.Wassmer Fix typo Change 3243091 on 2016/12/22 by Daniel.Wright Fixed too many groups dispatched for TConeTraceScreenGridGlobalOcclusionCS Change 3243161 on 2016/12/22 by Uriel.Doyon New async tasks for the streaming update. Optimizing the biggest frame cost. Change 3243179 on 2016/12/22 by Uriel.Doyon Fixed possible invalid access from the async FNormalizeLightmapTexelFactorTask Change 3243236 on 2016/12/22 by Daniel.Wright Fixed DFAO bilateral upsample * Depth buffer was being unbound due to lack of DepthRead_StencilNop Change 3243452 on 2016/12/23 by Ben.Woodhouse Bring back 1024 render query limit workaround on D3D12 which was lost during the merge from partners #jira UE-35247 Change 3243512 on 2016/12/23 by Uriel.Doyon Improved task system for texture streaming. Change 3243742 on 2016/12/26 by Rolando.Caloca DR - vk - Fix UAV clears - Removed old validation layer - Print found device layers Change 3243745 on 2016/12/27 by Rolando.Caloca DR - vk - Fix for texture cube arrays - Warning for ClearUAVs Change 3243762 on 2016/12/27 by Rolando.Caloca DR - vk - Always use pipeline cache Change 3244450 on 2016/12/31 by Rolando.Caloca DR - vk - Pre reqs for separate transfer queue Change 3244453 on 2016/12/31 by Rolando.Caloca DR - vk - Win32 compile fix Change 3244756 on 2017/01/03 by Marcus.Wassmer Copying //Tasks/UE4/Dev-Niagara@3244743 to Dev-Rendering (//UE4/Dev-Rendering) Change 3244757 on 2017/01/03 by Marcus.Wassmer Niagara is still experimental in non-task branches. Change 3245059 on 2017/01/03 by Benjamin.Hyder Submitting TM-TrigNodes map Change 3245500 on 2017/01/03 by Olaf.Piesche Compile fix #1 for post-merge problems Change 3245572 on 2017/01/03 by Olaf.Piesche (Speculative) fix #2 for post-merge build problem. Hopefully fixes public distribution level error for cross compiler tool. Change 3245683 on 2017/01/03 by Marcus.Wassmer Fix some niagara warnings Change 3245732 on 2017/01/03 by Marcus.Wassmer Fix Niagara compile on clang platforms. Fix a few warnings / static analysis things as well. Change 3246403 on 2017/01/04 by Rolando.Caloca DR - vk - Fix bogus warning Change 3246432 on 2017/01/04 by Marcus.Wassmer Copying //Tasks/UE4/Dev-Niagara@3246424 to Dev-Rendering (//UE4/Dev-Rendering) Change 3246538 on 2017/01/04 by Rolando.Caloca DR - vk - Show hitch time for compute psos Change 3246580 on 2017/01/04 by Rolando.Caloca DR - vk - compile fix Change 3246610 on 2017/01/04 by Rolando.Caloca DR - Compute PSO pre reqs Change 3246707 on 2017/01/04 by Marcus.Wassmer Add missing integer operations to UnrealMathDirectX.h Change 3246786 on 2017/01/04 by Marcus.Wassmer Avoid public dependency build errors. Should probably just remove the DDCUtils module instead Change 3246828 on 2017/01/04 by Olaf.Piesche UE-39249; need to check the view as well as the view family in CheckAndUpdateLastFrame; scene captures use a different family, but each eye for VR uses a different scene view. Change 3247026 on 2017/01/04 by Rolando.Caloca DR - Remove CrossCompilerTool as it's not required anymore Change 3247086 on 2017/01/04 by Marcus.Wassmer Remove includes for Core.h monolithic header Change 3247227 on 2017/01/04 by Marcus.Wassmer Fix typo and compile errors. Change 3247228 on 2017/01/04 by Marcus.Wassmer Use crossplatform intrinsics Change 3247229 on 2017/01/04 by Marcus.Wassmer Implement missing integer NEON operations. Change NEON vectorint to match name and sign from other platforms Change 3247245 on 2017/01/04 by Marcus.Wassmer Fixing various warnings/errors from clang platforms (Mac/Linux) Change 3247331 on 2017/01/04 by Marcus.Wassmer More Mac/clang fixes Change 3247958 on 2017/01/05 by Marcus.Wassmer VectorInt < - > Float ops should be conversions not reinterpret cast Change 3247959 on 2017/01/05 by Marcus.Wassmer Add missing ops to non-vector header Change 3247964 on 2017/01/05 by Rolando.Caloca DR - Temp fix for crash #jira UE-40211 Change 3248067 on 2017/01/05 by Rolando.Caloca DR - Static analysis fixes #jira UE-40167 Change 3248284 on 2017/01/05 by Rolando.Caloca DR - Linuix Compile fix #jira UE-40260 Change 3248288 on 2017/01/05 by Rolando.Caloca DR - Linux compile fix #jira UE-40264 Change 3248399 on 2017/01/05 by Brian.Karis Filtered importance sampling for envmap prefiltering. Fixed SSR on clearcoat with skylight only. Change 3248503 on 2017/01/05 by Rolando.Caloca DR - Linux fixes #jira UE-40264 Change 3248666 on 2017/01/05 by Brian.Karis Fix GL compile error Change 3248740 on 2017/01/05 by Marcus.Wassmer Fix linux and clang errors/warnings Change 3248851 on 2017/01/05 by Marcus.Wassmer Simplest fix for ES2 compile errors Change 3249217 on 2017/01/06 by Simon.Tovey Speculative fix for static analysis warning Change 3249296 on 2017/01/06 by Ben.Woodhouse XB1/Fast semantics: Add missing L1/L2 cache flush on transition to readable (or RW). The missing cache flush was causing indeterminism when reading from a texture shortly after writing to it as a render target. This fixes bloom and diffuse irradiance issues The bug has been there for a while, but CL 3227787 (drawclear early out) caused it to manifest #jira UE-39727 #jira UE-40238 Change 3249300 on 2017/01/06 by Ben.Woodhouse Remove workaround for diffuse irradiance (redundant clear). No longer necessary with CL 3249296 Change 3249387 on 2017/01/06 by Rolando.Caloca DR - Fix GL clear issues #jira UE-40254 Change 3249435 on 2017/01/06 by Ben.Woodhouse Duplicated from UT CL 3238664 Fix dbuffer decal rendering issues in fullscreen on PC. Also fixes crash in editor when viewing dbuffer materials. Pass clearcolor in RT params for system textures to workaround a bug with ClearColorTexture not working in fullscreen mode on DX11. Make sure dbuffer targets are bound if we're rendering mesh decals #jira UT-6891 #jira UE-39842 Change 3249721 on 2017/01/06 by Marcus.Wassmer Remove final references to non-existent Niagara data Change 3249742 on 2017/01/06 by Marcus.Wassmer Fix missing GPU particles on Mac. Pointers getting reused is causing the blendstate equality operator to fail. Simple workaround until we have time for a proper fix. [CL 3249983 by Marcus Wassmer in Main branch]
2017-01-06 17:51:46 -05: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);
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3249742) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3232283 on 2016/12/13 by Ben.Woodhouse D3D12 - downgrade root signature size warning to a log following a discussion with Microsoft. There's not much we can actually do about it, and it's not relevant to all hardware #jira UE-36999 Change 3232641 on 2016/12/13 by Mark.Satterthwaite - Eliminate redundant state changes in MetalRHI in the state cache. - Add a new debug level for setting buffers to nil prior to calls to set*Bytes so that the tool doesn't display incorrect data. - Make testing for validation & statistics features use the same EMetalFeatures API as everything else for consistency. - Cache the fallback depth-stencil texture in the state cache and ignore it for determining whether a pass can restart - if we are using this texture its contents are worthless anyway. Change 3232661 on 2016/12/13 by Mark.Satterthwaite Re-enable Metal SM5 & DFAO/DistanceFieldShadowing on Intel for 10.12.2 or later. Change 3232759 on 2016/12/13 by Ben.Woodhouse Fix memory leak on XB1 when calling GPURealloc with count of 0, suggested on UDN https://udn.unrealengine.com/questions/326660/gpurealloc-leak.html Change 3232803 on 2016/12/13 by Ben.Marsh Add UT to the populate DDC job, and cook UT and Fortnite for Mac as well. Change 3232836 on 2016/12/13 by Ben.Marsh Split cooks to populate DDC into separate nodes for each platform. May help to reduce number of timeouts on remote VMs. Change 3232974 on 2016/12/13 by Rolando.Caloca DR - Refactor common code to UWorld::RecreateScene #jira UE-36719 PR #2824 Change 3232976 on 2016/12/13 by Ben.Marsh Add missing dependency on tools node for Mac cooks. Need to compile SCW first. Change 3233289 on 2016/12/13 by Olaf.Piesche Fixing potentially broken spot/point light fade with old content; initialize new properties properly Change 3233811 on 2016/12/13 by Mark.Satterthwaite Fix compiling QA-Material tessellation shaders that don't need to emit from Hull or sample in Domain the HSOut buffer which was confusing MetalBackend. Change 3233854 on 2016/12/13 by Mark.Satterthwaite More information about texture type validation errors in Metal. Change 3234650 on 2016/12/14 by Rolando.Caloca DR - vk - Fix bad aspect on depth cubemaps Change 3234651 on 2016/12/14 by Rolando.Caloca DR - vk - Fix for 32 bit crash on dump layer Change 3234813 on 2016/12/14 by Guillaume.Abadie Fixes texture mask static lighting when using GBuffer selective outputs. #jira UE-39527 Change 3235047 on 2016/12/14 by Uriel.Doyon Refactored HLOD texture streaming strategy to separate forced load from visibility. Added an incremental update in the last stage of the texture streaming update load to clear any pending work. Added an option "All" to the "BuildMateriaTexturelStreamingData" command to force rebuild everything. Change 3235317 on 2016/12/14 by Uriel.Doyon Removed timed primitives in the texture streaming since it was not used and there is now a fallback implementation in UPrimitiveComponent::GetStreamingTextureInfo. Change 3235431 on 2016/12/14 by Rolando.Caloca DR - Fix for Vulkan drawing black Change 3236788 on 2016/12/15 by Mark.Satterthwaite Fix 10.11.6 support (aka -nometalv2): the stencil view workaround necessitates a mid-render blit and the way things were setup resulted in the HasValidRenderTargets assert firing. Refactored the code to separate the concept or valid render-states in the cache from active render-states in the render-pass. Now it works as intended and will be needed for 4.15. Change 3236850 on 2016/12/15 by Mark.Satterthwaite Make changing the Metal Shader Version project setting prompt the user to restart for the changes to take effect. #jira UE-39801 Change 3237002 on 2016/12/15 by Benjamin.Hyder submitting updated TM-Shadermodels map Change 3237312 on 2016/12/15 by Rolando.Caloca DR - Change more macros to lambdas Change 3237394 on 2016/12/15 by Mark.Satterthwaite Add Metal-specific permutations of TBasePassHS - they affect the C++ definition on all platforms but are only cached or used on Metal - because the way we compile the combined VS+HS tessellation stage requires that the combined VS + HS HLSL code references the same resources, otherwise we get incorrect resouce bindings and subsequently fail to render properly. Long-term the Metal tessellation code will need to be refactored so that the vertex shader stage is emitted as a separate shader from the hull shader stage as this but will keep cropping back up and continue to complicate the engine. #jira UE-39799 Change 3237490 on 2016/12/15 by Daniel.Wright Fixed ULandscapeComponent::GetUsedMaterials Change 3237597 on 2016/12/15 by Ben.Woodhouse Disable timestamp queries on pre-Maxwell nvidia hardware. Local testing suggests that this is the major cause of instability in the UE4.14 release. It's possible that we could be more targeted by only excluding Fermi and older hardware, but identifying fermi hardware by device ID is difficult in practice, since the range overlaps with Kepler. Change 3237654 on 2016/12/15 by Daniel.Wright Non-editor compile fix Change 3238229 on 2016/12/16 by Rolando.Caloca DR - Remove ExcludeRect from inner RHI Clear methods; ensure will happen if trying to use it Change 3238236 on 2016/12/16 by Rolando.Caloca DR - Compile fixes Change 3238280 on 2016/12/16 by Marc.Olano Small optimization to Lanczos-3 upsample shader code. Change 3238321 on 2016/12/16 by Rolando.Caloca DR - Compile fix Change 3238331 on 2016/12/16 by Rolando.Caloca DR - compile fix Change 3238495 on 2016/12/16 by Marc.Olano Replace TEA random number generator with PCG. Was only used in #if-disabled reference rendering, but ldoes make better quality reference rendering when enabled. Change 3238496 on 2016/12/16 by Marc.Olano Tone mapping fix for OR-31752, cherry picked from Orion 3208273 Assumption that green is approximates luminance fails on red/blue HDR content, resulting in ugly black artifacts. Go back to luminance. Change 3238520 on 2016/12/16 by Rolando.Caloca DR - CIS Fix Change 3238571 on 2016/12/16 by Rolando.Caloca DR - CIS fix Change 3238605 on 2016/12/16 by Daniel.Wright Sharing IndirectLightingCacheTextureSampler samplers Change 3238626 on 2016/12/16 by Daniel.Wright Ray Traced Distance Field Shadow optimizations * Tighter light space tile culling * Skip ray marching pixels before the RTDF cascade near distance, or further than the cascade far distance * Depth bounds test on upsample * Created FLightTileIntersectionParameters for encapsulation of light tile culling functionality * RTDF shadow time went from 1.8ms -> .8ms and 3.1ms -> 1.2ms in FortGPUTestbed on 7870 with these changes Change 3238652 on 2016/12/16 by Rolando.Caloca DR - RHI clear methods no longer have an ExcludeRect, use DrawClearQuad functions instead Change 3238855 on 2016/12/16 by Rolando.Caloca DR - Added FRHITexture2D GetSizeXY Change 3238881 on 2016/12/16 by Rolando.Caloca DR - CIS fix Change 3239008 on 2016/12/16 by Arne.Schober DR - Fixing accidently returning a stackpointer in EnqueueRenderCommands Change 3239012 on 2016/12/16 by Arne.Schober DR - missing file Change 3239255 on 2016/12/17 by Rolando.Caloca DR - Remove shader clears from D3D11 Change 3239690 on 2016/12/19 by Rolando.Caloca DR - vk - Misc fixes from 1.0.37.00 SDK warnings Change 3239964 on 2016/12/19 by Rolando.Caloca DR - Fix click on editor not showing selected Change 3239995 on 2016/12/19 by Rolando.Caloca DR - Enable dist field on GL4 & Vulkan SM5 Change 3240162 on 2016/12/19 by Daniel.Wright Added EnableDepthBoundsTest / DisableDepthBoundsTest to RHIUtilites to share some common code Change 3240163 on 2016/12/19 by Daniel.Wright Distance field self shadowing controls for hiding world position offset self-shadow artifacts * Removed static mesh build settings DistanceFieldBias, which shrunk the distance field, breaking AO and shadows * Added DistanceFieldSelfShadowBias, which prevents occlusion close to the surface only, maintaining shadows on the ground and AO on the ground Change 3240271 on 2016/12/19 by Daniel.Wright Use 16 bit indices for distance field objects culled to tiles, when 16 bit will be enough. Saves 10mb of tile culling buffers. Change 3240282 on 2016/12/19 by Rolando.Caloca DR - Proper fix for hit proxies clear - Added missing stencil ref to DrawClearQuad Change 3240316 on 2016/12/19 by Rolando.Caloca DR - vk - Fixed some new 1.0.37.0 warnings Change 3240354 on 2016/12/19 by Rolando.Caloca DR - Dev shaders on sm4/5 Change 3240759 on 2016/12/20 by Rolando.Caloca DR - Fix bad crc on GL element declarations Change 3240895 on 2016/12/20 by Rolando.Caloca DR - vk - Swapchain fixes Change 3241057 on 2016/12/20 by Rolando.Caloca DR - vk - Fix resize on desktop Change 3241112 on 2016/12/20 by Rolando.Caloca DR - vk - Fix 1.0.37.0 warnings - Ignore some warnings we know we can't fix Change 3241310 on 2016/12/20 by Rolando.Caloca DR - vk - Fix crash Change 3241417 on 2016/12/20 by Daniel.Wright [Copy] Fixed race condition with FPrecomputedLightVolume::Data which was exposed when switching lighting scenarios Change 3241990 on 2016/12/21 by Daniel.Wright Converted DistanceFieldVolume data to BulkData * FDistanceFieldVolumeData Serialize time from .7s on PS4 to 0s Change 3242005 on 2016/12/21 by Daniel.Wright Removed unused !USE_DEPTH_RANGE_LISTS path to reduce complexity Change 3242295 on 2016/12/21 by Bob.Tellez Duplicating CL#3242294 from //Fortnite/Main #UE4 Re-applying the fix for rendering editor primitives when r.EarlyZPassOnlyMaterialMasking is enabled Change 3242487 on 2016/12/21 by Marcus.Wassmer Fix typo Change 3243091 on 2016/12/22 by Daniel.Wright Fixed too many groups dispatched for TConeTraceScreenGridGlobalOcclusionCS Change 3243161 on 2016/12/22 by Uriel.Doyon New async tasks for the streaming update. Optimizing the biggest frame cost. Change 3243179 on 2016/12/22 by Uriel.Doyon Fixed possible invalid access from the async FNormalizeLightmapTexelFactorTask Change 3243236 on 2016/12/22 by Daniel.Wright Fixed DFAO bilateral upsample * Depth buffer was being unbound due to lack of DepthRead_StencilNop Change 3243452 on 2016/12/23 by Ben.Woodhouse Bring back 1024 render query limit workaround on D3D12 which was lost during the merge from partners #jira UE-35247 Change 3243512 on 2016/12/23 by Uriel.Doyon Improved task system for texture streaming. Change 3243742 on 2016/12/26 by Rolando.Caloca DR - vk - Fix UAV clears - Removed old validation layer - Print found device layers Change 3243745 on 2016/12/27 by Rolando.Caloca DR - vk - Fix for texture cube arrays - Warning for ClearUAVs Change 3243762 on 2016/12/27 by Rolando.Caloca DR - vk - Always use pipeline cache Change 3244450 on 2016/12/31 by Rolando.Caloca DR - vk - Pre reqs for separate transfer queue Change 3244453 on 2016/12/31 by Rolando.Caloca DR - vk - Win32 compile fix Change 3244756 on 2017/01/03 by Marcus.Wassmer Copying //Tasks/UE4/Dev-Niagara@3244743 to Dev-Rendering (//UE4/Dev-Rendering) Change 3244757 on 2017/01/03 by Marcus.Wassmer Niagara is still experimental in non-task branches. Change 3245059 on 2017/01/03 by Benjamin.Hyder Submitting TM-TrigNodes map Change 3245500 on 2017/01/03 by Olaf.Piesche Compile fix #1 for post-merge problems Change 3245572 on 2017/01/03 by Olaf.Piesche (Speculative) fix #2 for post-merge build problem. Hopefully fixes public distribution level error for cross compiler tool. Change 3245683 on 2017/01/03 by Marcus.Wassmer Fix some niagara warnings Change 3245732 on 2017/01/03 by Marcus.Wassmer Fix Niagara compile on clang platforms. Fix a few warnings / static analysis things as well. Change 3246403 on 2017/01/04 by Rolando.Caloca DR - vk - Fix bogus warning Change 3246432 on 2017/01/04 by Marcus.Wassmer Copying //Tasks/UE4/Dev-Niagara@3246424 to Dev-Rendering (//UE4/Dev-Rendering) Change 3246538 on 2017/01/04 by Rolando.Caloca DR - vk - Show hitch time for compute psos Change 3246580 on 2017/01/04 by Rolando.Caloca DR - vk - compile fix Change 3246610 on 2017/01/04 by Rolando.Caloca DR - Compute PSO pre reqs Change 3246707 on 2017/01/04 by Marcus.Wassmer Add missing integer operations to UnrealMathDirectX.h Change 3246786 on 2017/01/04 by Marcus.Wassmer Avoid public dependency build errors. Should probably just remove the DDCUtils module instead Change 3246828 on 2017/01/04 by Olaf.Piesche UE-39249; need to check the view as well as the view family in CheckAndUpdateLastFrame; scene captures use a different family, but each eye for VR uses a different scene view. Change 3247026 on 2017/01/04 by Rolando.Caloca DR - Remove CrossCompilerTool as it's not required anymore Change 3247086 on 2017/01/04 by Marcus.Wassmer Remove includes for Core.h monolithic header Change 3247227 on 2017/01/04 by Marcus.Wassmer Fix typo and compile errors. Change 3247228 on 2017/01/04 by Marcus.Wassmer Use crossplatform intrinsics Change 3247229 on 2017/01/04 by Marcus.Wassmer Implement missing integer NEON operations. Change NEON vectorint to match name and sign from other platforms Change 3247245 on 2017/01/04 by Marcus.Wassmer Fixing various warnings/errors from clang platforms (Mac/Linux) Change 3247331 on 2017/01/04 by Marcus.Wassmer More Mac/clang fixes Change 3247958 on 2017/01/05 by Marcus.Wassmer VectorInt < - > Float ops should be conversions not reinterpret cast Change 3247959 on 2017/01/05 by Marcus.Wassmer Add missing ops to non-vector header Change 3247964 on 2017/01/05 by Rolando.Caloca DR - Temp fix for crash #jira UE-40211 Change 3248067 on 2017/01/05 by Rolando.Caloca DR - Static analysis fixes #jira UE-40167 Change 3248284 on 2017/01/05 by Rolando.Caloca DR - Linuix Compile fix #jira UE-40260 Change 3248288 on 2017/01/05 by Rolando.Caloca DR - Linux compile fix #jira UE-40264 Change 3248399 on 2017/01/05 by Brian.Karis Filtered importance sampling for envmap prefiltering. Fixed SSR on clearcoat with skylight only. Change 3248503 on 2017/01/05 by Rolando.Caloca DR - Linux fixes #jira UE-40264 Change 3248666 on 2017/01/05 by Brian.Karis Fix GL compile error Change 3248740 on 2017/01/05 by Marcus.Wassmer Fix linux and clang errors/warnings Change 3248851 on 2017/01/05 by Marcus.Wassmer Simplest fix for ES2 compile errors Change 3249217 on 2017/01/06 by Simon.Tovey Speculative fix for static analysis warning Change 3249296 on 2017/01/06 by Ben.Woodhouse XB1/Fast semantics: Add missing L1/L2 cache flush on transition to readable (or RW). The missing cache flush was causing indeterminism when reading from a texture shortly after writing to it as a render target. This fixes bloom and diffuse irradiance issues The bug has been there for a while, but CL 3227787 (drawclear early out) caused it to manifest #jira UE-39727 #jira UE-40238 Change 3249300 on 2017/01/06 by Ben.Woodhouse Remove workaround for diffuse irradiance (redundant clear). No longer necessary with CL 3249296 Change 3249387 on 2017/01/06 by Rolando.Caloca DR - Fix GL clear issues #jira UE-40254 Change 3249435 on 2017/01/06 by Ben.Woodhouse Duplicated from UT CL 3238664 Fix dbuffer decal rendering issues in fullscreen on PC. Also fixes crash in editor when viewing dbuffer materials. Pass clearcolor in RT params for system textures to workaround a bug with ClearColorTexture not working in fullscreen mode on DX11. Make sure dbuffer targets are bound if we're rendering mesh decals #jira UT-6891 #jira UE-39842 Change 3249721 on 2017/01/06 by Marcus.Wassmer Remove final references to non-existent Niagara data Change 3249742 on 2017/01/06 by Marcus.Wassmer Fix missing GPU particles on Mac. Pointers getting reused is causing the blendstate equality operator to fail. Simple workaround until we have time for a proper fix. [CL 3249983 by Marcus Wassmer in Main branch]
2017-01-06 17:51:46 -05:00
}
};
BEGIN_SHADER_PARAMETER_STRUCT(FShadowMeshSDFObjectCull, )
SHADER_PARAMETER_STRUCT_INCLUDE(FShadowObjectCullVS::FParameters, VS)
SHADER_PARAMETER_STRUCT_INCLUDE(FShadowObjectCullPS::FParameters, PS)
RDG_BUFFER_ACCESS(MeshSDFIndirectArgs, ERHIAccess::IndirectArgs)
RENDER_TARGET_BINDING_SLOTS()
END_SHADER_PARAMETER_STRUCT()
IMPLEMENT_GLOBAL_SHADER(FShadowObjectCullPS, "/Engine/Private/DistanceFieldShadowing.usf", "ShadowObjectCullPS", SF_Pixel);
enum EDistanceFieldShadowingType
{
DFS_DirectionalLightScatterTileCulling,
DFS_DirectionalLightTiledCulling,
DFS_PointLightTiledCulling
};
class FDistanceFieldShadowingCS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER(FDistanceFieldShadowingCS);
SHADER_USE_PARAMETER_STRUCT(FDistanceFieldShadowingCS, FGlobalShader);
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<float2>, RWShadowFactors)
SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
SHADER_PARAMETER_STRUCT_INCLUDE(FSceneTextureShaderParameters, SceneTextures)
SHADER_PARAMETER_RDG_UNIFORM_BUFFER(FStrataGlobalUniformParameters, Strata)
SHADER_PARAMETER(FVector2f, NumGroups)
SHADER_PARAMETER(FVector3f, LightDirection)
SHADER_PARAMETER(FVector4f, LightTranslatedPositionAndInvRadius)
SHADER_PARAMETER(float, LightSourceRadius)
SHADER_PARAMETER(float, RayStartOffsetDepthScale)
SHADER_PARAMETER(FVector3f, TanLightAngleAndNormalThreshold)
SHADER_PARAMETER(FIntRect, ScissorRectMinAndSize)
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldObjectBufferParameters, ObjectBufferParameters)
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldCulledObjectBufferParameters, CulledObjectBufferParameters)
SHADER_PARAMETER_STRUCT_INCLUDE(FLightTileIntersectionParameters, LightTileIntersectionParameters)
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldAtlasParameters, DistanceFieldAtlasParameters)
SHADER_PARAMETER_STRUCT_INCLUDE(FHeightFieldAtlasParameters, HeightFieldAtlasParameters)
SHADER_PARAMETER(FMatrix44f, TranslatedWorldToShadow)
SHADER_PARAMETER(float, TwoSidedMeshDistanceBias)
SHADER_PARAMETER(float, MinDepth)
SHADER_PARAMETER(float, MaxDepth)
SHADER_PARAMETER(uint32, DownsampleFactor)
SHADER_PARAMETER(FVector2f, InvOutputBufferSize)
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, ShadowFactorsTexture)
SHADER_PARAMETER_SAMPLER(SamplerState, ShadowFactorsSampler)
END_SHADER_PARAMETER_STRUCT()
class FCullingType : SHADER_PERMUTATION_INT("CULLING_TYPE", 3);
class FShadowQuality : SHADER_PERMUTATION_INT("DF_SHADOW_QUALITY", 3);
class FPrimitiveType : SHADER_PERMUTATION_INT("DISTANCEFIELD_PRIMITIVE_TYPE", 2);
class FHasPreviousOutput : SHADER_PERMUTATION_BOOL("HAS_PREVIOUS_OUTPUT");
class FOffsetDataStructure : SHADER_PERMUTATION_INT("OFFSET_DATA_STRUCT", 3);
class FCompactCulledObjects : SHADER_PERMUTATION_BOOL("COMPACT_CULLED_SHADOW_OBJECTS");
using FPermutationDomain = TShaderPermutationDomain<FCullingType, FShadowQuality, FPrimitiveType, FHasPreviousOutput, FOffsetDataStructure, FCompactCulledObjects>;
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)
{
const FPermutationDomain PermutationVector(Parameters.PermutationId);
if (!PermutationVector.Get<FCompactCulledObjects>() && PermutationVector.Get<FCullingType>() != 0)
{
// Compacting culled objects is only relevant when we do scattered tile culling
return false;
}
return DoesPlatformSupportDistanceFieldShadowing(Parameters.Platform);
}
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)
{
OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZEX"), GDistanceFieldShadowTileSizeX);
OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZEY"), GDistanceFieldShadowTileSizeY);
OutEnvironment.SetDefine(TEXT("FORCE_DEPTH_TEXTURE_READS"), 1);
OutEnvironment.SetDefine(TEXT("PLATFORM_SUPPORTS_TYPED_UAV_LOAD"), (int32)RHISupports4ComponentUAVReadWrite(Parameters.Platform));
}
};
IMPLEMENT_GLOBAL_SHADER(FDistanceFieldShadowingCS, "/Engine/Private/DistanceFieldShadowing.usf", "DistanceFieldShadowingCS", SF_Compute);
class FDistanceFieldShadowingUpsamplePS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER(FDistanceFieldShadowingUpsamplePS);
SHADER_USE_PARAMETER_STRUCT(FDistanceFieldShadowingUpsamplePS, FGlobalShader);
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
SHADER_PARAMETER_STRUCT_INCLUDE(FSceneTextureShaderParameters, SceneTextures)
SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, ShadowFactorsTexture)
SHADER_PARAMETER_SAMPLER(SamplerState, ShadowFactorsSampler)
SHADER_PARAMETER(FIntRect, ScissorRectMinAndSize)
SHADER_PARAMETER(float, FadePlaneOffset)
SHADER_PARAMETER(float, InvFadePlaneLength)
SHADER_PARAMETER(float, NearFadePlaneOffset)
SHADER_PARAMETER(float, InvNearFadePlaneLength)
END_SHADER_PARAMETER_STRUCT()
class FUpsample : SHADER_PERMUTATION_BOOL("UPSAMPLE_REQUIRED");
using FPermutationDomain = TShaderPermutationDomain<FUpsample>;
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)
{
return DoesPlatformSupportDistanceFieldShadowing(Parameters.Platform);
}
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)
{
OutEnvironment.SetDefine(TEXT("DOWNSAMPLE_FACTOR"), GAODownsampleFactor);
OutEnvironment.SetDefine(TEXT("FORCE_DEPTH_TEXTURE_READS"), 1);
}
};
IMPLEMENT_GLOBAL_SHADER(FDistanceFieldShadowingUpsamplePS, "/Engine/Private/DistanceFieldShadowing.usf", "DistanceFieldShadowingUpsamplePS", SF_Pixel);
bool UseShadowIndirectDraw(EShaderPlatform ShaderPlatform)
{
return IsFeatureLevelSupported(ShaderPlatform, ERHIFeatureLevel::SM5)
&& !IsVulkanMobilePlatform(ShaderPlatform)
&& FDataDrivenShaderPlatformInfo::GetSupportsManualVertexFetch(ShaderPlatform);
}
class FShadowTileVS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER(FShadowTileVS);
SHADER_USE_PARAMETER_STRUCT(FShadowTileVS, FGlobalShader);
using FPermutationDomain = TShaderPermutationDomain<>;
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, ViewUniformBuffer)
SHADER_PARAMETER_RDG_BUFFER_SRV(Buffer<uint>, TileListData)
END_SHADER_PARAMETER_STRUCT()
static int32 GetTileSize()
{
return 8;
}
static FPermutationDomain RemapPermutation(FPermutationDomain PermutationVector)
{
return PermutationVector;
}
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
{
return UseShadowIndirectDraw(Parameters.Platform) && DoesPlatformSupportDistanceFieldShadowing(Parameters.Platform);
}
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
{
OutEnvironment.SetDefine(TEXT("SHADOW_TILE_VS"), 1);
OutEnvironment.SetDefine(TEXT("WORK_TILE_SIZE"), GetTileSize());
FGlobalShader::ModifyCompilationEnvironment(Parameters, OutEnvironment);
}
};
IMPLEMENT_GLOBAL_SHADER(FShadowTileVS, "/Engine/Private/DistanceFieldShadowing.usf", "ShadowTileVS", SF_Vertex);
const uint32 ComputeCulledObjectStartOffsetGroupSize = 8;
/** */
class FComputeCulledObjectStartOffsetCS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER(FComputeCulledObjectStartOffsetCS);
SHADER_USE_PARAMETER_STRUCT(FComputeCulledObjectStartOffsetCS, FGlobalShader);
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
SHADER_PARAMETER_STRUCT_INCLUDE(FLightTileIntersectionParameters, LightTileIntersectionParameters)
END_SHADER_PARAMETER_STRUCT()
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
{
return DoesPlatformSupportDistanceFieldShadowing(Parameters.Platform);
}
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
{
FGlobalShader::ModifyCompilationEnvironment(Parameters,OutEnvironment);
OutEnvironment.SetDefine(TEXT("COMPUTE_START_OFFSET_GROUP_SIZE"), ComputeCulledObjectStartOffsetGroupSize);
}
};
IMPLEMENT_SHADER_TYPE(,FComputeCulledObjectStartOffsetCS,TEXT("/Engine/Private/DistanceFieldShadowing.usf"),TEXT("ComputeCulledTilesStartOffsetCS"),SF_Compute);
void ScatterObjectsToShadowTiles(
FRDGBuilder& GraphBuilder,
const FViewInfo& View,
const FMatrix& WorldToShadowValue,
float ShadowBoundingRadius,
bool bCountingPass,
EDistanceFieldPrimitiveType PrimitiveType,
FIntPoint LightTileDimensions,
FRDGBufferRef ObjectIndirectArguments,
const FDistanceFieldObjectBufferParameters& ObjectBufferParameters,
const FDistanceFieldCulledObjectBufferParameters& CulledObjectBufferParameters,
const FLightTileIntersectionParameters& LightTileIntersectionParameters)
{
{
FShadowMeshSDFObjectCull* PassParameters = GraphBuilder.AllocParameters<FShadowMeshSDFObjectCull>();
if (GRHIRequiresRenderTargetForPixelShaderUAVs)
{
FRDGTextureDesc DummyDesc = FRDGTextureDesc::Create2D(LightTileDimensions, PF_B8G8R8A8, FClearValueBinding::Black, TexCreate_RenderTargetable);
PassParameters->RenderTargets[0] = FRenderTargetBinding(GraphBuilder.CreateTexture(DummyDesc, TEXT("Dummy")), ERenderTargetLoadAction::ENoAction);
}
const float MinExpandRadiusValue = (PrimitiveType == DFPT_HeightField ? 0.87f : 1.414f) * ShadowBoundingRadius / FMath::Min(LightTileDimensions.X, LightTileDimensions.Y);
PassParameters->VS.View = GetShaderBinding(View.ViewUniformBuffer);
PassParameters->VS.ObjectBufferParameters = ObjectBufferParameters;
PassParameters->VS.CulledObjectBufferParameters = CulledObjectBufferParameters;
PassParameters->VS.TranslatedWorldToShadow = FMatrix44f(FTranslationMatrix(-View.ViewMatrices.GetPreViewTranslation()) * WorldToShadowValue);
PassParameters->VS.MinExpandRadius = MinExpandRadiusValue;
PassParameters->PS.View = GetShaderBinding(View.ViewUniformBuffer);
PassParameters->PS.ObjectBufferParameters = ObjectBufferParameters;
PassParameters->PS.CulledObjectBufferParameters = CulledObjectBufferParameters;
PassParameters->PS.LightTileIntersectionParameters = LightTileIntersectionParameters;
PassParameters->PS.TranslatedWorldToShadow = FMatrix44f(FTranslationMatrix(-View.ViewMatrices.GetPreViewTranslation()) * WorldToShadowValue);
PassParameters->PS.ObjectExpandScale = PrimitiveType == DFPT_HeightField ? 0.f : WorldToShadowValue.GetMaximumAxisScale();
PassParameters->MeshSDFIndirectArgs = ObjectIndirectArguments;
FShadowObjectCullVS::FPermutationDomain VSPermutationVector;
VSPermutationVector.Set< FShadowObjectCullVS::FPrimitiveType >(PrimitiveType);
auto VertexShader = View.ShaderMap->GetShader< FShadowObjectCullVS >(VSPermutationVector);
FShadowObjectCullPS::FPermutationDomain PermutationVector;
PermutationVector.Set< FShadowObjectCullPS::FPrimitiveType >(PrimitiveType);
PermutationVector.Set< FShadowObjectCullPS::FCountingPass >(bCountingPass);
PermutationVector.Set<FShadowObjectCullPS::FCompactCulledObjects>(GDFShadowCompactCulledObjects != 0);
auto PixelShader = View.ShaderMap->GetShader< FShadowObjectCullPS >(PermutationVector);
const bool bReverseCulling = View.bReverseCulling;
ClearUnusedGraphResources(VertexShader, &PassParameters->VS);
ClearUnusedGraphResources(PixelShader, &PassParameters->PS);
GraphBuilder.AddPass(
RDG_EVENT_NAME("ScatterMeshSDFsToLightGrid %ux%u", LightTileDimensions.X, LightTileDimensions.Y),
PassParameters,
ERDGPassFlags::Raster,
[LightTileDimensions, bReverseCulling, VertexShader, PixelShader, PassParameters](FRHICommandList& RHICmdList)
{
FGraphicsPipelineStateInitializer GraphicsPSOInit;
RHICmdList.ApplyCachedRenderTargets(GraphicsPSOInit);
RHICmdList.SetViewport(0, 0, 0.0f, LightTileDimensions.X, LightTileDimensions.Y, 1.0f);
// Render backfaces since camera may intersect
GraphicsPSOInit.RasterizerState = bReverseCulling ? TStaticRasterizerState<FM_Solid, CM_CW>::GetRHI() : TStaticRasterizerState<FM_Solid, CM_CCW>::GetRHI();
GraphicsPSOInit.DepthStencilState = TStaticDepthStencilState<false, CF_Always>::GetRHI();
GraphicsPSOInit.BlendState = TStaticBlendState<>::GetRHI();
GraphicsPSOInit.PrimitiveType = PT_TriangleList;
GraphicsPSOInit.BoundShaderState.VertexDeclarationRHI = GetVertexDeclarationFVector4();
GraphicsPSOInit.BoundShaderState.VertexShaderRHI = VertexShader.GetVertexShader();
GraphicsPSOInit.BoundShaderState.PixelShaderRHI = PixelShader.GetPixelShader();
SetGraphicsPipelineState(RHICmdList, GraphicsPSOInit, 0);
SetShaderParameters(RHICmdList, VertexShader, VertexShader.GetVertexShader(), PassParameters->VS);
SetShaderParameters(RHICmdList, PixelShader, PixelShader.GetPixelShader(), PassParameters->PS);
RHICmdList.SetStreamSource(0, GetUnitCubeVertexBuffer(), 0);
RHICmdList.DrawIndexedPrimitiveIndirect(
GetUnitCubeIndexBuffer(),
PassParameters->MeshSDFIndirectArgs->GetIndirectRHICallBuffer(),
0);
});
}
}
void AllocateDistanceFieldCulledObjectBuffers(
FRDGBuilder& GraphBuilder,
uint32 MaxObjects,
FRDGBufferRef& OutObjectIndirectArguments,
FDistanceFieldCulledObjectBufferParameters& OutParameters)
{
check(MaxObjects > 0);
OutObjectIndirectArguments = GraphBuilder.CreateBuffer(FRDGBufferDesc::CreateIndirectDesc<FRHIDrawIndexedIndirectParameters>(), TEXT("DistanceField.ObjectIndirectArguments"));
FRDGBufferRef ObjectIndices = GraphBuilder.CreateBuffer(FRDGBufferDesc::CreateStructuredDesc(sizeof(uint32), MaxObjects), TEXT("DistanceField.ObjectIndices"));
OutParameters.RWObjectIndirectArguments = GraphBuilder.CreateUAV(OutObjectIndirectArguments, PF_R32_UINT);
OutParameters.RWCulledObjectIndices = GraphBuilder.CreateUAV(ObjectIndices);
OutParameters.ObjectIndirectArguments = GraphBuilder.CreateSRV(OutObjectIndirectArguments, PF_R32_UINT);
OutParameters.CulledObjectIndices = GraphBuilder.CreateSRV(ObjectIndices);
}
void CullDistanceFieldObjectsForLight(
FRDGBuilder& GraphBuilder,
const FViewInfo& View,
const FLightSceneProxy* LightSceneProxy,
EDistanceFieldPrimitiveType PrimitiveType,
const FMatrix& WorldToShadowValue,
int32 NumPlanes,
const FPlane* PlaneData,
const FVector& PrePlaneTranslation,
const FVector4f& ShadowBoundingSphere,
float ShadowBoundingRadius,
bool bCullingForDirectShadowing,
const FDistanceFieldObjectBufferParameters& ObjectBufferParameters,
FDistanceFieldCulledObjectBufferParameters& CulledObjectBufferParameters,
FLightTileIntersectionParameters& LightTileIntersectionParameters)
{
const bool bIsHeightfield = PrimitiveType == DFPT_HeightField;
const FScene* Scene = (const FScene*)(View.Family->Scene);
FRDGBufferRef ObjectIndirectArguments = nullptr;
RDG_EVENT_SCOPE(GraphBuilder, "CullDistanceFieldObjectsForLight %s", PrimitiveType == DFPT_SignedDistanceField ? TEXT("MeshSDF") : TEXT("Heightfield"));
const int32 NumObjectsInBuffer = bIsHeightfield ? ObjectBufferParameters.NumSceneHeightfieldObjects : ObjectBufferParameters.NumSceneObjects;
AllocateDistanceFieldCulledObjectBuffers(
GraphBuilder,
FMath::DivideAndRoundUp(NumObjectsInBuffer, 256) * 256,
ObjectIndirectArguments,
CulledObjectBufferParameters);
AddClearUAVPass(GraphBuilder, CulledObjectBufferParameters.RWObjectIndirectArguments, 0);
{
FCullObjectsForShadowCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FCullObjectsForShadowCS::FParameters>();
PassParameters->View = View.ViewUniformBuffer;
PassParameters->ObjectBufferParameters = ObjectBufferParameters;
PassParameters->CulledObjectBufferParameters = CulledObjectBufferParameters;
PassParameters->ObjectBoundingGeometryIndexCount = UE_ARRAY_COUNT(GCubeIndices);
PassParameters->TranslatedWorldToShadow = FMatrix44f(FTranslationMatrix(-View.ViewMatrices.GetPreViewTranslation()) * WorldToShadowValue);
PassParameters->NumShadowHullPlanes = NumPlanes;
PassParameters->ShadowBoundingSphere = ShadowBoundingSphere;
// Disable Nanite meshes for directional lights that use VSM since they draw into the VSM unconditionally (and would get double shadow)
PassParameters->bDrawNaniteMeshes = !(LightSceneProxy->UseVirtualShadowMaps() && LightSceneProxy->GetLightType() == LightType_Directional) || !bCullingForDirectShadowing;
check(NumPlanes <= 12);
for (int32 i = 0; i < NumPlanes; i++)
{
// translated planes from translated-shadow-space to translated-world-space
const FPlane4f Plane(PlaneData[i].TranslateBy(View.ViewMatrices.GetPreViewTranslation() - PrePlaneTranslation));
PassParameters->ShadowConvexHull[i] = FVector4f(FVector3f(Plane), Plane.W);
}
FCullObjectsForShadowCS::FPermutationDomain PermutationVector;
PermutationVector.Set< FCullObjectsForShadowCS::FPrimitiveType >(PrimitiveType);
auto ComputeShader = View.ShaderMap->GetShader<FCullObjectsForShadowCS>(PermutationVector);
const int32 GroupSize = FMath::DivideAndRoundUp<uint32>(NumObjectsInBuffer, UpdateObjectsGroupSize);
FComputeShaderUtils::AddPass(
GraphBuilder,
RDG_EVENT_NAME("CullMeshSDFObjectsToFrustum"),
ComputeShader,
PassParameters,
FIntVector(GroupSize, 1, 1));
}
// Allocate tile resolution based on world space size
const float LightTiles = FMath::Min(ShadowBoundingRadius / GShadowCullTileWorldSize + 1.0f, 256.0f);
FIntPoint LightTileDimensions(Align(FMath::TruncToInt(LightTiles), 64), Align(FMath::TruncToInt(LightTiles), 64));
if (LightSceneProxy->GetLightType() == LightType_Directional && GShadowScatterTileCulling)
{
const bool b16BitObjectIndices = Scene->DistanceFieldSceneData.CanUse16BitObjectIndices();
FRDGBufferRef ShadowTileNumCulledObjects = GraphBuilder.CreateBuffer(FRDGBufferDesc::CreateBufferDesc(sizeof(uint32), LightTileDimensions.X * LightTileDimensions.Y), TEXT("ShadowTileNumCulledObjects"));
LightTileIntersectionParameters.RWShadowTileNumCulledObjects = GraphBuilder.CreateUAV(ShadowTileNumCulledObjects, PF_R32_UINT);
LightTileIntersectionParameters.ShadowTileNumCulledObjects = GraphBuilder.CreateSRV(ShadowTileNumCulledObjects, PF_R32_UINT);
const uint32 MaxNumObjectsPerTile = bIsHeightfield ? GAverageHeightFieldObjectsPerShadowCullTile : GAverageObjectsPerShadowCullTile;
FRDGBufferRef ShadowTileArrayData = GraphBuilder.CreateBuffer(FRDGBufferDesc::CreateBufferDesc(b16BitObjectIndices ? sizeof(uint16) : sizeof(uint32), MaxNumObjectsPerTile * LightTileDimensions.X * LightTileDimensions.Y), TEXT("ShadowTileArrayData"));
LightTileIntersectionParameters.RWShadowTileArrayData = GraphBuilder.CreateUAV(ShadowTileArrayData, b16BitObjectIndices ? PF_R16_UINT : PF_R32_UINT);
LightTileIntersectionParameters.ShadowTileArrayData = GraphBuilder.CreateSRV(ShadowTileArrayData, b16BitObjectIndices ? PF_R16_UINT : PF_R32_UINT);
LightTileIntersectionParameters.ShadowTileListGroupSize = LightTileDimensions;
LightTileIntersectionParameters.ShadowMaxObjectsPerTile = MaxNumObjectsPerTile;
if (GDFShadowCompactCulledObjects != 0)
{
FRDGBufferRef ShadowTileStartOffsets = GraphBuilder.CreateBuffer(FRDGBufferDesc::CreateBufferDesc(sizeof(uint32), LightTileDimensions.X * LightTileDimensions.Y), TEXT("ShadowTileStartOffsets"));
LightTileIntersectionParameters.RWShadowTileStartOffsets = GraphBuilder.CreateUAV(ShadowTileStartOffsets, PF_R32_UINT);
LightTileIntersectionParameters.ShadowTileStartOffsets = GraphBuilder.CreateSRV(ShadowTileStartOffsets, PF_R32_UINT);
FRDGBufferRef NextStartOffset = GraphBuilder.CreateBuffer(FRDGBufferDesc::CreateBufferDesc(sizeof(uint32), 1), TEXT("ShadowNextStartOffset"));
LightTileIntersectionParameters.RWNextStartOffset = GraphBuilder.CreateUAV(NextStartOffset, PF_R32_UINT);
LightTileIntersectionParameters.NextStartOffset = GraphBuilder.CreateSRV(NextStartOffset, PF_R32_UINT);
// Start at 0 tiles per object
AddClearUAVPass(GraphBuilder, LightTileIntersectionParameters.RWShadowTileNumCulledObjects, 0);
// Rasterize object bounding shapes and intersect with shadow tiles to compute how many objects intersect each tile
ScatterObjectsToShadowTiles(GraphBuilder, View, WorldToShadowValue, ShadowBoundingRadius, true, PrimitiveType, LightTileDimensions, ObjectIndirectArguments, ObjectBufferParameters, CulledObjectBufferParameters, LightTileIntersectionParameters);
AddClearUAVPass(GraphBuilder, LightTileIntersectionParameters.RWNextStartOffset, 0);
// Compute the start offset for each tile's culled object data
{
FComputeCulledObjectStartOffsetCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FComputeCulledObjectStartOffsetCS::FParameters>();
PassParameters->LightTileIntersectionParameters = LightTileIntersectionParameters;
auto ComputeShader = View.ShaderMap->GetShader<FComputeCulledObjectStartOffsetCS>();
uint32 GroupSizeX = FMath::DivideAndRoundUp<int32>(LightTileDimensions.X, ComputeCulledObjectStartOffsetGroupSize);
uint32 GroupSizeY = FMath::DivideAndRoundUp<int32>(LightTileDimensions.Y, ComputeCulledObjectStartOffsetGroupSize);
FComputeShaderUtils::AddPass(
GraphBuilder,
RDG_EVENT_NAME("ComputeCulledObjectStartOffset"),
ComputeShader,
PassParameters,
FIntVector(GroupSizeX, GroupSizeY, 1));
}
}
else
{
LightTileIntersectionParameters.RWShadowTileStartOffsets = nullptr;
LightTileIntersectionParameters.ShadowTileStartOffsets = nullptr;
LightTileIntersectionParameters.RWNextStartOffset = nullptr;
LightTileIntersectionParameters.NextStartOffset = nullptr;
}
// Start at 0 tiles per object
AddClearUAVPass(GraphBuilder, LightTileIntersectionParameters.RWShadowTileNumCulledObjects, 0);
// Rasterize object bounding shapes and intersect with shadow tiles, and write out intersecting tile indices for the cone tracing pass
ScatterObjectsToShadowTiles(GraphBuilder, View, WorldToShadowValue, ShadowBoundingRadius, false, PrimitiveType, LightTileDimensions, ObjectIndirectArguments, ObjectBufferParameters, CulledObjectBufferParameters, LightTileIntersectionParameters);
}
}
int32 GetDFShadowQuality()
{
return FMath::Clamp(GDFShadowQuality, 0, 3);
}
int32 GetHFShadowQuality()
{
return FMath::Clamp(GHFShadowQuality, 0, 3);
}
bool SupportsDistanceFieldShadows(ERHIFeatureLevel::Type FeatureLevel, EShaderPlatform ShaderPlatform)
{
return GDistanceFieldShadowing
&& GetDFShadowQuality() > 0
&& DoesPlatformSupportDistanceFieldShadowing(ShaderPlatform);
}
bool SupportsHeightFieldShadows(ERHIFeatureLevel::Type FeatureLevel, EShaderPlatform ShaderPlatform)
{
return GHeightFieldShadowing
&& GetHFShadowQuality() > 0
&& FeatureLevel >= ERHIFeatureLevel::SM5
&& DoesPlatformSupportDistanceFieldShadowing(ShaderPlatform);
}
bool FSceneRenderer::ShouldPrepareForDistanceFieldShadows() const
{
bool bSceneHasRayTracedDFShadows = false;
for (auto LightIt = Scene->Lights.CreateConstIterator(); LightIt; ++LightIt)
{
const FLightSceneInfoCompact& LightSceneInfoCompact = *LightIt;
const FLightSceneInfo* const LightSceneInfo = LightSceneInfoCompact.LightSceneInfo;
if (LightSceneInfo->ShouldRenderLightViewIndependent())
{
const FVisibleLightInfo& VisibleLightInfo = ActiveViewFamily->VisibleLightInfos[LightSceneInfo->Id];
for (int32 ShadowIndex = 0; ShadowIndex < VisibleLightInfo.AllProjectedShadows.Num(); ShadowIndex++)
{
const FProjectedShadowInfo* ProjectedShadowInfo = VisibleLightInfo.AllProjectedShadows[ShadowIndex];
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3028916) #lockdown nick.penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 3006483 on 2016/06/08 by Simon.Tovey Fix for UE-31653 Instance params from the Spawn, Required and TypeData modules were not being autopopulated. Change 3006514 on 2016/06/08 by Zabir.Hoque MIGRATING FIX @ Request Off by 1 error on reflection roughness calculation affecting 4.12. When I hoisted the max mip index i did a -1 on both sides(c++ & hlsl). This is the simplest hotfix. In 4.13 I'll remove the shader instruction and only do the "-1" in c++ this 1 less shader instruction. #CodeReview: Marcus.Wassmer, Daniel.Wright Change 3006605 on 2016/06/08 by Rolando.Caloca DR - vk - Remove a bunch of unused code, clean up some todos Change 3006969 on 2016/06/08 by HaarmPieter.Duiker Add #ifdefs around inverse tonemapping to avoid performance hit in normal use Change 3007240 on 2016/06/09 by Chris.Bunner Made a pass at fixing global shader compile warnings and errors. Change 3007242 on 2016/06/09 by Chris.Bunner Don't force unlit mode when re-loading a map. #jira UE-31247 Change 3007243 on 2016/06/09 by Chris.Bunner Cache InvalidLightmapSettings material for instanced meshes. #jira UE-31182 Change 3007258 on 2016/06/09 by Chris.Bunner Fixed refractive depth bias material parameter. Change 3007466 on 2016/06/09 by Rolando.Caloca DR - Use vulkan debug marker extension directly from header Change 3007504 on 2016/06/09 by Martin.Mittring added refresh button to ImageVerifier Change 3007528 on 2016/06/09 by Martin.Mittring ALU optimization to SSR, minor perf difference on NVTitan, needs to to be profiled on lower end make render more deterministic Change 3007551 on 2016/06/09 by Chris.Bunner Reverted constant type change in previous commit. Change 3007559 on 2016/06/09 by Martin.Mittring updated ImageValidator Change 3007584 on 2016/06/09 by Rolando.Caloca DR - Fix case when not running under RD Change 3007668 on 2016/06/09 by Rolando.Caloca DR - vk - Split layers/extensions by required/optional Change 3007820 on 2016/06/09 by Rolando.Caloca DR - Android compile fix Change 3007926 on 2016/06/09 by Martin.Mittring fixed UI scaling in ImageVerifyer Change 3007931 on 2016/06/09 by John.Billon -Fixed cutouts not working for certain sized texture/subUV size combinations. -Also fixed issue with subUV module not being postloaded consistently on startup. #Jira UE-31583 Change 3008023 on 2016/06/09 by Martin.Mittring refactor noise code in shaders Change 3008127 on 2016/06/09 by Zabir.Hoque Merging back hot fixes: 1. Fix DX12 crashing due to oclusion queries waiting on incorrect sync point. Integrating change from MS. 2. Immediate context should flush directly and not attempt to flush the immediate context, ie. itself. Change 3008129 on 2016/06/09 by Daniel.Wright Disabled r.ProfileGPU.PrintAssetSummary by default due to spam Change 3008169 on 2016/06/09 by Rolando.Caloca DR - Fix mobile rendering not freeing resource when using RHI thread Change 3008429 on 2016/06/09 by Uriel.Doyon Enabled texture streaming new metrics. Added progress bar while texture streaming is being built. Added debug shader validation to prevent crashes when there are uniform expression set mismatches. Added texture streaming build to "Build All" Change 3008436 on 2016/06/09 by Uriel.Doyon Fixed shipping build Change 3008833 on 2016/06/10 by Rolando.Caloca DR - Allow RenderTargets to be easily shared via GPU to other DX or OpenGL applications Submitted by Allar PR #1864 #jira UE-24545 Change 3008842 on 2016/06/10 by Rolando.Caloca DR - Remove vertex densities view mode Change 3008857 on 2016/06/10 by John.Billon Added a PostLoad to ParticleModuleSubUV to call postload on the SubUV animation to ensure that the animation is loaded in time for caching. Change 3008870 on 2016/06/10 by Rolando.Caloca DR - Rebuild hlslcc libs (missing from last merge) Change 3008925 on 2016/06/10 by John.Billon Fixed r.ScreenPercentage.Editor #Jira UE-31549 Change 3009028 on 2016/06/10 by Daniel.Wright Shadow depth refactor * Shadow setup and render target allocation now happens in InitViews, and shadow depth rendering happens at one spot in the frame * This provides control over where shadow depths are rendered for things like async compute, and allows easy atlasing of shadowmaps for forward shading * The 33Mb of shadow depth buffers in FSceneRenderTargets has been removed, and shadow depth buffers are now allocated as needed * A large amount of duplicated code to handle each shadow type has been combined * Cleaner parallel rendering: no more view hacking for the shadow depth pass, no more shadow depths in the middle of translucency * 'vis ShadowDepthAtlas' or 'vis WholeSceneShadowMap' must now be used to visualize the shadow depth textures Change 3009032 on 2016/06/10 by Daniel.Wright Fixed crash with simple forward shading in the material editor Change 3009178 on 2016/06/10 by Rolando.Caloca DR - Add support for multi callbacks on HlslParser, added a write to string callback Change 3009268 on 2016/06/10 by Daniel.Wright Warning fixes Change 3009416 on 2016/06/10 by Martin.Mittring moved decal rendering code in common spot for upcoming MeshDecal rendering Change 3009433 on 2016/06/10 by John.Billon Adding ensures for translucency lighting volume render target acesses. #Jira UE-31578 Change 3009449 on 2016/06/10 by Daniel.Wright Fixed whole scene point light shadow depths getting rendered redundantly Change 3009675 on 2016/06/10 by Martin.Mittring fixed Clang compiling Change 3009815 on 2016/06/10 by Martin.Mittring renamed IsUsedWithDeferredDecal to IsDeferredDecal to be more correct Change 3009946 on 2016/06/10 by Martin.Mittring minor optimization Change 3010270 on 2016/06/11 by HaarmPieter.Duiker Update gamut transformations used when dumping EXRs to account for bug UE-29935 Change 3011423 on 2016/06/13 by Martin.Mittring fixed default of bOutputsVelocityInBasePass #code_review:Rolando.Caloca #test:PC Change 3011448 on 2016/06/13 by Martin.Mittring minor engine code cleanup #code_review:Olaf.Piesche #test:PC Change 3011991 on 2016/06/13 by Daniel.Wright Fixed downsampled translucency crash in VR Change 3011993 on 2016/06/13 by Daniel.Wright Stationary Mobility for primitive components is allowed again, with the meaning 'moves rarely' Mobility tooltips now reflect whether a primitive component or light component is being inspected Change 3012096 on 2016/06/13 by Daniel.Wright Missing file from cl 3011993 Change 3012546 on 2016/06/14 by John.Billon Added r.ContactShadows.Enable CVar to allow contact shadows to be globally disabled/enabled #Jira OR-23282 Change 3012706 on 2016/06/14 by John.Billon Renamed r.ContactShadows.Enable to r.ContactShadows Change 3012992 on 2016/06/14 by Rolando.Caloca DR - vk - Fixed backbuffer/swapchain order with RHI thread enabled - Added support for CustomPresent Change 3013030 on 2016/06/14 by Rolando.Caloca DR - vk - Fix dev issue Change 3013423 on 2016/06/14 by Martin.Mittring removed code redundancy for easier upcoming changes #test:PC Change 3013451 on 2016/06/14 by Martin.Mittring removed no longer needed debug cvar #test:PC Change 3013643 on 2016/06/14 by Zabir.Hoque Fix API only being inlined in the cpp and not avaialble in the .h Change 3013696 on 2016/06/14 by Olaf.Piesche Adding missing quality level spawn rate scaling on GPU emitters Change 3013736 on 2016/06/14 by Daniel.Wright Cached shadowmaps for whole scene point and spot light shadows * Controlled by 'r.Shadow.CacheWholeSceneShadows', defaults to enabled (7ms -> 1.5ms of shadow depths on Titan for ~20 lights) * Primitives with Static or Stationary mobility have their depths cached, as long as the light is not moving * Primitives with Movable mobility or using World Position Offset in their materials will not have their depths cached * Cached shadowmaps are copied each frame and then movable primitive depths composited * Fast paths exist for when there were no static primitives (skip cached shadowmap) or movable primitives (project directly from cached shadowmap) * 'r.Shadow.CacheWPOPrimitives' controls whether materials using WPO can be cached (default is off for correctness) * 'r.Shadow.CachedShadowsCastFromMovablePrimitives' can be used to force off all support for movable primitives, skipping the shadowmap copies (1.5ms -> 0ms of shadow depths for ~20 lights) Change 3014103 on 2016/06/15 by Daniel.Wright Compile fix Change 3014507 on 2016/06/15 by Simon.Tovey Resurrected Niagara playground and moved to Samples/NotForLicencees Change 3014931 on 2016/06/15 by Martin.Mittring moved r.RenderInternals code into renderer to be able to access more low level data #test:PC, paragon Change 3014933 on 2016/06/15 by Martin.Mittring nicer text Change 3014956 on 2016/06/15 by Daniel.Wright Fixed HLOD and mesh LODs getting hit by Lightmass ray traces that didn't originate from a mesh Volume lighting samples and precomputed visibility cells are now only placed on LOD0 (of both mesh LODs and HLOD) Change 3014985 on 2016/06/15 by Uriel.Doyon Enabled Texture Build shaders on Mac Exposed IStreamingManager::AddViewSlaveLocation in ENGINE_API Fixed issue FStreamingManagerTexture::ConditionalUpdateStaticData which would to update some data in shipping. Fixed r.Streaming.MipBias not affecting maximum allowed resolution, showing warnings of texture streaming overbudgets #jira UE-30566 #jira UE-31098 Change 3014995 on 2016/06/15 by Rolando.Caloca DR - vk - Removed RHI thread wait on acquire image - Move Descriptor pool into context Change 3015002 on 2016/06/15 by Rolando.Caloca DR - Add (disabled) additional cvar for r.DumpShaderDebugWorkerCommandLine Change 3015041 on 2016/06/15 by Martin.Mittring fixed ImageValidator crashing when using files that exist only in ref or test folder Change 3015309 on 2016/06/15 by Rolando.Caloca DR - vk - Enable fence re-use on SDKs >= 1.0.16.0 Change 3015356 on 2016/06/15 by Rolando.Caloca DR - vk - Prep for staging buffer refactor Change 3015430 on 2016/06/15 by Martin.Mittring minor optimization for subsurfacescatteringprofile Change 3016097 on 2016/06/16 by Simon.Tovey Enabling Niagara by default in the Niagara playground Change 3016098 on 2016/06/16 by Simon.Tovey Some misc fixup to get niagara working again Change 3016183 on 2016/06/16 by Rolando.Caloca DR - vk - Recreate buffer view for volatile buffers Change 3016225 on 2016/06/16 by Marcus.Wassmer Duplicate reflection fixes from 4.12 hotfixes. Change 3016289 on 2016/06/16 by Chris.Bunner Always gather MP_Normal definitions as they can be shared by other material properties. #jira UE-31792 Change 3016294 on 2016/06/16 by Daniel.Wright Fix for ensure accessing CVarCacheWPOPrimitives in game Change 3016305 on 2016/06/16 by Daniel.Wright Raised r.Shadow.CSM.MaxCascades to 10 on Epic scalability level, which it should have always been Change 3016330 on 2016/06/16 by Daniel.Wright Cached shadowmaps are tossed after 5s of not being used for rendering - helps in the case where you fly through a bunch of lights and never look back Skipping shadow depth cubemap clear if there will be a cached shadowmap copy later - saves .4ms on PS4 for a close up point light Stats for shadowmap memory used under 'stat shadowrendering' Change 3016506 on 2016/06/16 by Daniel.Wright Fixed crash building map in SunTemple due to null access Change 3016703 on 2016/06/16 by Uriel.Doyon Fixed warning due to floating point imprecision when building texture streaming Change 3016718 on 2016/06/16 by Daniel.Wright Volume lighting samples use adaptive sampling final gather * Increases their build time by 2x but improves quality in difficult cases (small bright sources of bounce lighting) Change 3016871 on 2016/06/16 by Max.Chen Sequencer: Added support for the named "PerformanceCapture" event which like Matinee, calls GEngine->PerformanceCapture to output a screenshot when the event fires. Refactor event track/sections so that the player is passed to the trigger events evaluation. Copy from Dev-Sequencer #jira UE-32093 Change 3017189 on 2016/06/16 by Zabir.Hoque Fix GBuffer format selection type-o. #CodeReview: Marcus.Wassmer Change 3017241 on 2016/06/16 by Martin.Mittring optimized and cleaned up rendering in transluceny, distortion, custom mesh drawing #code_review:Daniel.Wright, Marcus.Wassmer, Nick.Penwarden Change 3017856 on 2016/06/17 by Rolando.Caloca DR - Missing GL enum Change 3017910 on 2016/06/17 by Ben.Woodhouse - Added a Video Buffer to ensure smooth submission of frames from CEF. Without this, we can get multiple texture updates per engine frame, which causes stuttering at high framerates - Disable hardware acceleration on Windows, since this causes severe performance issues with video rendering Please note: To actually see 60fps video, you need to ensure the browser frame rate passed into FWebBrowserSingleton::CreateBrowserWindow is set to 60 (default is 24) #RB:Keli.Hloedversson,Martin.Mittring Change 3018126 on 2016/06/17 by Ben.Woodhouse Fix build warning on Mac #RB:David.Hill Change 3018167 on 2016/06/17 by Chris.Bunner Handle case when float4 is passed to TransformPosition material node. #jira UE-24980 Change 3018246 on 2016/06/17 by Benjamin.Hyder Submitting Preliminary ShadowRefactor TestMap Change 3018330 on 2016/06/17 by Benjamin.Hyder labeled ShadowRefactor map Change 3018377 on 2016/06/17 by Chris.Bunner Removed additional node creation when initializing a RotateAboutAxis node. #jira UE-8034 Change 3018433 on 2016/06/17 by Rolando.Caloca DR - Fix some clang warnings on Vulkan Change 3018664 on 2016/06/17 by Martin.Mittring unified some code for easier maintainance, fixed missing multiply from former change (CL 2933812) #test:PC #code_review:Marcus.Wassmer,Brian.Karis Change 3019023 on 2016/06/19 by Benjamin.Hyder Re-Labeled ShadowRefactor map Change 3019024 on 2016/06/19 by Benjamin.Hyder Correcting Translucent Volume (Non-Directional) settings Change 3019026 on 2016/06/19 by Benjamin.Hyder Correcting Lighting ShadowRefactor map Change 3019414 on 2016/06/20 by Allan.Bentham Refactor mobile shadows Change 3019494 on 2016/06/20 by Gil.Gribb Merging //UE4/Dev-Main@3018959 to Dev-Rendering (//UE4/Dev-Rendering) Change 3019504 on 2016/06/20 by John.Billon -Created a blueprint node (ExportRenderTarget and ExportTexture2D) to export render targets/textures as HDR images to disk. -Moved HDR export code(FHDRExportHelper and CubemapUnwrapUtils) to runtime from editor to allow access from blueprints. -Created a small common interface for blueprints and the editor itself to use for exporting. #Jira UE-31429 Change 3019561 on 2016/06/20 by Gil.Gribb UE4 - Worked around afulness of windows scheduler. This would occasionally cause hitches on quad core machines with additional load in the tick task manager. Change 3019616 on 2016/06/20 by Rolando.Caloca DR - Replicate change in DevRendering to fix splotches on characters with morph targets Change: 3019599 O - Fix flickering on heroes with morph targets Change 3019627 on 2016/06/20 by Rolando.Caloca DR - Doh! Compile fix Change 3019674 on 2016/06/20 by Simon.Tovey Ripped out the quick hacky VM debugger I wrote a while back. Over complicated the VM and didn't do enough work to justify it. Will revisit debugging and profiling of VM scripts in future. Change 3019691 on 2016/06/20 by Ben.Woodhouse Add a per-object shadow setting for directional lights (r.Shadow.PerObjectDirectionalDepthBias), which is independent of the CSM setting. Often a smaller bias is desirable on per-object shadows, where detailed self-shadowing is needed. This change also makes the CSM naming consistent with what the setting actually does (the old setting was named r.shadow.csm, although it affects per-object shadows as well as CSMs). #RB:Martin.Mittring, Daniel.Wright Change 3019741 on 2016/06/20 by John.Billon Fixed compile error on mac. Change 3019984 on 2016/06/20 by Martin.Mittring minor optimization Change 3020172 on 2016/06/20 by Zachary.Wilson Fixing mesh distance fields for engine content cube and cylinder by setting distance field resolution to 2. for UE-26783 #rb: none Change 3020195 on 2016/06/20 by Zachary.Wilson Fixing engine coontent sphere's distance fields for UE-26783, distance fields resolution set to 2. #rb: none Change 3020196 on 2016/06/20 by Rolando.Caloca DR - Appease static analysis Change 3020231 on 2016/06/20 by Zachary.Wilson Making basic shapes consistent distance field resolution scale. #rb: none Change 3020468 on 2016/06/20 by David.Hill CameraWS UE-29146 Change 3020502 on 2016/06/20 by Benjamin.Hyder Adding AutomationMatinee Camera for RenderOutputValidation Change 3020508 on 2016/06/20 by Benjamin.Hyder Adding AutomationMatinee for RenderOutputValidation Change 3020514 on 2016/06/20 by Benjamin.Hyder Setting Autoplay for AutomationMatinee (sequence) Change 3020561 on 2016/06/20 by Daniel.Wright Removed outdated comment on uniform expression assert Change 3021268 on 2016/06/21 by Daniel.Wright Scaled sphere intersection for indirect capsule shadows * Fixes the discontinuity when capsule axis points close to the light direction * GPU cost is effectively the same (more expensive to compute, but tighter culling) Change 3021325 on 2016/06/21 by Daniel.Wright Split ShadowRendering.cpp into ShadowDepthRendering.cpp Change 3021355 on 2016/06/21 by Daniel.Wright Fixed RTDF shadows (broken by shadowmap caching) Change 3021444 on 2016/06/21 by Daniel.Wright Fixed crash due to Depth drawing policy not using the default material shader map properly Change 3021543 on 2016/06/21 by Daniel.Wright Fixed drawing to a Canvas after EndDrawCanvasToRenderTarget causing a crash Fixed DrawMaterialToRenderTarget breaking the Canvas object that BeginDrawCanvasToRenderTarget returns Change 3021749 on 2016/06/21 by Daniel.Wright Moved RenderBasePass and dependencies into BasePassRendering.cpp Moved RenderPrePass and dependencies into DepthRendering.cpp Change 3021766 on 2016/06/21 by Benjamin.Hyder Adding 150dynamiclights level to Dev-Folder Change 3021971 on 2016/06/21 by Daniel.Wright Removed the CPU-culled light grid which is used to implement TLM_SurfacePerPixelLighting, in preparation for a GPU-culled light grid implementation * TLM_SurfacePerPixelLighting now behaves like TLM_Surface Change 3022760 on 2016/06/22 by Chris.Bunner Merge fixup. Change 3022911 on 2016/06/22 by Rolando.Caloca DR - Added r.D3DDumpD3DAsmFile to enable dumping the fxc disassembly when dumping shaders Change 3023037 on 2016/06/22 by Rolando.Caloca DR - Fix for the case of global destructors calling FlushRenderingCommands() after the RHI has been destroyed Change 3023139 on 2016/06/22 by Daniel.Wright Added on screen message for when VisualizeMeshDistanceFields is requested but engine scalability settings have DFAO disabled Change 3023231 on 2016/06/22 by Daniel.Wright Only allowing opaque per-object shadows or CSM in the mobile renderer Change 3023415 on 2016/06/22 by Daniel.Wright Fix crash in dx12 trying to clear stencil when there is no stencil in the depth target Change 3024888 on 2016/06/23 by Daniel.Wright Fixed preshadows being rendered redundantly with multiple lights Change 3025119 on 2016/06/23 by Martin.Mittring added MeshDecal content to RenderTest Change 3025122 on 2016/06/23 by Martin.Mittring enabled DBuffer for RenderTest Change 3025153 on 2016/06/23 by Marc.Olano Fix Spherical Particle Opacity. Particles using this stopped rendering sometime after 4.10. Needed to use world space without shader offsets, not absolute world space. Change 3025180 on 2016/06/23 by Marc.Olano Use translated world space for particle centers. Better fix for Spherical Particle Opacity problems, but with fingers in more pies. Includes rename of particle center vertex factory variables. Change 3025265 on 2016/06/23 by David.Hill Bilbords translucent during PIE - lighting model was incorrectly set in gbuffer #jira UE-26165 Change 3025269 on 2016/06/23 by Ryan.Brucks Adding new Testmap for Pixel Depth Offset velocities with Temporal AA Change 3025345 on 2016/06/23 by Benjamin.Hyder Submitting MeshDecal Content Change 3025444 on 2016/06/23 by Benjamin.Hyder updating content for MeshDecal Change 3025491 on 2016/06/23 by Benjamin.Hyder Updating DecalMesh Textures Change 3025802 on 2016/06/23 by Martin.Mittring added to readme Change 3026475 on 2016/06/24 by Rolando.Caloca DR - Show current state of r.RHIThread.Enable when not using param Change 3026479 on 2016/06/24 by Rolando.Caloca DR - Upgrade glslang to 1.0.17.0 Change 3026480 on 2016/06/24 by Rolando.Caloca DR - Vulkan headers to 1.0.17.0 Change 3026481 on 2016/06/24 by Rolando.Caloca DR - Vulkan wrapper for extra logging Change 3026491 on 2016/06/24 by Rolando.Caloca DR - Missed file Change 3026574 on 2016/06/24 by Rolando.Caloca DR - vk - Enabled fence reuse on 1.0.17.0 - Added more logging info Change 3026656 on 2016/06/24 by Frank.Fella Niagara - Prevent sequencer uobjects from being garbage collected. Change 3026657 on 2016/06/24 by Benjamin.Hyder Updating Rendertestmap to latest Change 3026723 on 2016/06/24 by Rolando.Caloca DR - Fix for ES3.1 RHIs Change 3026784 on 2016/06/24 by Martin.Mittring New feature: Mesh Decals / Material layers (Chris.Bunner is the goto person on MeshDecals from now on) Change 3026866 on 2016/06/24 by Olaf.Piesche #jira OR-18363 #jira UE-27780 fix distortion in particle macro uvs [CL 3028922 by Gil Gribb in Main branch]
2016-06-27 13:42:20 -04:00
if (ProjectedShadowInfo->bRayTracedDistanceField)
{
bSceneHasRayTracedDFShadows = true;
break;
}
}
}
}
return ActiveViewFamily->EngineShowFlags.DynamicShadows
&& bSceneHasRayTracedDFShadows
&& SupportsDistanceFieldShadows(Scene->GetFeatureLevel(), Scene->GetShaderPlatform());
}
bool FSceneRenderer::ShouldPrepareHeightFieldScene() const
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3304653) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3288774 on 2017/02/06 by Ben.Salem Added in min/max/avg values to table. Allow us to also set which stat groups we use explicitly to massively cut down on plugin overhead. #tests Several tests passes taken on ShooterGame. Change 3289887 on 2017/02/07 by David.Hill Eye Adaptation: Fix basic mode. The last step of the basic eye adaptation needs to know the correct down-sampled viewport size #jira: UE-29491 Change 3290281 on 2017/02/07 by Chris.Bunner Account for LogToLin approximation value offseting. Change 3290282 on 2017/02/07 by Chris.Bunner Fixed missing 2000 nit branch in tonemapper. Change 3290331 on 2017/02/07 by Chris.Bunner Minor optimization for BlendMaterialAttributes node compilation. Change 3291140 on 2017/02/07 by Daniel.Wright Fixed distance field temporal filter using Point filtering * Fixed the manual bilinear filter in the high quality reprojection path, still doesn't solve the streaking artifacts though Change 3292060 on 2017/02/08 by Rolando.Caloca DR - Some enums for max/num bits on RHI definitions Change 3292213 on 2017/02/08 by Benjamin.Hyder Updating TM-DistanceFields map in QAGame Change 3292291 on 2017/02/08 by Benjamin.Hyder small tweaks to TM-DistanceFields Change 3292399 on 2017/02/08 by Chris.Bunner Minor fix to HDR format type check. Change 3293560 on 2017/02/08 by Rolando.Caloca DR - vk - Events Change 3293562 on 2017/02/08 by Rolando.Caloca DR - vk - Disambiguate class name Change 3295346 on 2017/02/09 by Rolando.Caloca DR - Duplicate fix from 3295320 Change 3296930 on 2017/02/10 by Chris.Bunner Search keywords for pre-skinned position/normal nodes. Change 3297162 on 2017/02/10 by Daniel.Wright Distance field temporal filter stores a confidence value, which is used to track leaking of occlusion during the upsample, and flush those leaked values through the history faster. Reduces DFAO ghosting when the camera is moving. Change 3297345 on 2017/02/10 by Daniel.Wright Added 'r.CompressMeshDistanceFields' to rendering project settings, defaults to off to prevent hitches when streaming in levels Change 3297371 on 2017/02/10 by Chris.Bunner Custom vertex interpolator in/out node with auto-packing - Function support. Unified UV/CVI interpolator arrays for mixed custom UV support. Change 3298013 on 2017/02/10 by Daniel.Wright Ray Traced Distance Field shadowing is overlapped with the shadow depth pass, controlled by r.DFShadowAsyncCompute. * Didn't save any GPU time on PS4, so currently disabled until further investigation. * This change breaks RTDF shadows in splitscreen / stereo Change 3300028 on 2017/02/13 by Ben.Salem Adding GPU/Render/Game thread timers by default. Remove pointless flavor whitelisting on the plugin. Add sample usage in ShooterGame.ini config. #tests Ran half a dozen perf passes, and preflighted my changes in EC Change 3301571 on 2017/02/14 by Joe.Graf Deleted this plugin since it is no longer needed as an example Change 3301882 on 2017/02/14 by Daniel.Wright Fixed DistanceFieldAOConfidenceHistoryRT not getting released on RT Change 3304283 on 2017/02/15 by Daniel.Wright Variable shadowing fix Change 3304653 on 2017/02/15 by Ben.Salem Fix thread safety issues in Performance Monitor - deal with floating point bug in determining when to record frames. #tests Preflighted changes several times, ran several runs on Showdown [CL 3307957 by Marcus Wassmer in Main branch]
2017-02-16 17:52:21 -05:00
{
return Scene
&& ActiveViewFamily->EngineShowFlags.DynamicShadows
&& SupportsHeightFieldShadows(Scene->GetFeatureLevel(), Scene->GetShaderPlatform());
}
void RayTraceShadows(
FRDGBuilder& GraphBuilder,
bool bAsyncCompute,
const FMinimalSceneTextures& SceneTextures,
FRDGTextureRef RayTracedShadowsTexture,
const FViewInfo& View,
Sparse, narrow band, streamed Mesh Signed Distance Fields * SDFs are now generated, allocated from the atlas and uploaded in 8^3 bricks (7^3 unique data, half voxel padding). * Tracing must load the brick index from the indirection table, and only bricks near the surface are stored * 3 mips are now generated, with the lowest resolution always loaded and the other 2 streamed * SDFs are now G8 narrow band. Lower resolution mips must be traversed when querying distance to nearest surface far away from the surface * The Distance Field Brick Atlas is now stored for each FScene and dynamically resized based on needs with a GPU memcopy * Brick atlas uses a 1d pooled allocator which has no fragmentation and greatly reduces packing waste over the 3d allocator * Added new indirection for Distance Field Asset data, so that only a single entry needs to be updated when a mip is streamed in or out in scenes with millions of instances * Compute shaders operating on distance field instances generate streaming requests, which are async read back to CPU, turned into IO requests, which are polled and when complete uploaded to atlases * Any mesh instance inside the Global SDF extent (200m) requests mip1, and at 50m requests mip2 * Now using a batched compute scatter to upload to the distance field atlas instead of RHIUpdateTexture3d, to bypass alignment restrictions and per-upload overhead * Distance Field streaming uses an async task to move Memcpy and IO request overhead off of the Rendering Thread * Distance Field Visualization now computes a normal from the SDF gradient and does simple lighting to better visualize the scene representation * Increased r.DistanceFields.MaxPerMeshResolution from 128 to 512, to better represent large objects * Mesh SDF generation now uses an Embree point query to calculate closest unsigned distance, and then a much smaller set of rays to count backfaces for negative region determination, for a 11x speedup * Upgraded mesh utilities to Embree 3.12.2 to get point queries * Fixed wrong transform used for SDF normals in Lumen, causing non-uniformly scaled meshes to have incorrect Surface Cache interpolation * Fixed Static Mesh materials not getting PostLoaded before SDF build, causing their blend modes to be wrong for the build, which corrupts the DDC. Also included those blend modes in the DDC key. Original costs on 1080 GTX (full updates on everything and no screen traces) 10.60ms UpdateGlobalDistanceField 3.62ms LumenReflectiveTest.DirectionalLight_1 Shadowmap 1 1.73ms VoxelizeCards Clipmaps=[0,1,2,3] 0.38ms TraceCards 1 dispatch 1 groups 0.51ms TraceCards 1 dispatch 1 groups Sparse SDF costs 12.06ms UpdateGlobalDistanceField 4.35ms LumenReflectiveTest.DirectionalLight_1 Shadowmap 1 2.30ms VoxelizeCards Clipmaps=[0,1,2,3] 0.69ms TraceCards 1 dispatch 1 groups 0.77ms TraceCards 1 dispatch 1 groups Tested: TopazEntry PC, Reverb PC and PS5, EngineTests, QAGame, Rift, Frosty P_Construct_WP, FortGPUTestbed #rb Krzysztof.Narkowicz #ROBOMERGE-OWNER: Daniel.Wright #ROBOMERGE-AUTHOR: daniel.wright #ROBOMERGE-SOURCE: CL 15784493 in //UE5/Release-5.0-EarlyAccess/... #ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v783-15756269) #ROBOMERGE-CONFLICT from-shelf [CL 15790658 by Daniel Wright in ue5-main branch]
2021-03-23 22:40:05 -04:00
const FDistanceFieldSceneData& DistanceFieldSceneData,
const FProjectedShadowInfo* ProjectedShadowInfo,
EDistanceFieldPrimitiveType PrimitiveType,
bool bHasPrevOutput,
FRDGTextureRef PrevOutputTexture,
const FDistanceFieldObjectBufferParameters& ObjectBufferParameters,
const FDistanceFieldCulledObjectBufferParameters& CulledObjectBufferParameters,
const FLightTileIntersectionParameters& LightTileIntersectionParameters)
{
FIntRect ScissorRect;
if (!ProjectedShadowInfo->GetLightSceneInfo().Proxy->GetScissorRect(ScissorRect, View, View.ViewRect))
{
ScissorRect = View.ViewRect;
}
const int32 DFShadowQuality = (PrimitiveType == DFPT_HeightField ? GetHFShadowQuality() : GetDFShadowQuality()) - 1;
check(DFShadowQuality >= 0);
EDistanceFieldShadowingType DistanceFieldShadowingType;
if (ProjectedShadowInfo->bDirectionalLight && GShadowScatterTileCulling)
{
DistanceFieldShadowingType = DFS_DirectionalLightScatterTileCulling;
}
else if (ProjectedShadowInfo->bDirectionalLight)
{
DistanceFieldShadowingType = DFS_DirectionalLightTiledCulling;
}
else
{
DistanceFieldShadowingType = DFS_PointLightTiledCulling;
}
check(DistanceFieldShadowingType != DFS_PointLightTiledCulling || PrimitiveType != DFPT_HeightField);
FHeightFieldAtlasParameters HeightFieldAtlasParameters;
HeightFieldAtlasParameters.HeightFieldTexture = GHeightFieldTextureAtlas.GetAtlasTexture(GraphBuilder);
HeightFieldAtlasParameters.HFVisibilityTexture = GHFVisibilityTextureAtlas.GetAtlasTexture(GraphBuilder);
{
FDistanceFieldShadowingCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FDistanceFieldShadowingCS::FParameters>();
PassParameters->RWShadowFactors = GraphBuilder.CreateUAV(RayTracedShadowsTexture);
PassParameters->View = View.ViewUniformBuffer;
PassParameters->SceneTextures = SceneTextures.GetSceneTextureShaderParameters(View.GetFeatureLevel());
const FLightSceneProxy& LightProxy = *(ProjectedShadowInfo->GetLightSceneInfo().Proxy);
FLightRenderParameters LightParameters;
LightProxy.GetLightShaderParameters(LightParameters);
PassParameters->LightDirection = LightParameters.Direction;
PassParameters->LightTranslatedPositionAndInvRadius = FVector4f(FVector3f(LightParameters.WorldPosition + View.ViewMatrices.GetPreViewTranslation()), LightParameters.InvRadius);
// Default light source radius of 0 gives poor results
PassParameters->LightSourceRadius = LightParameters.SourceRadius == 0 ? 20 : FMath::Clamp(LightParameters.SourceRadius, .001f, 1.0f / (4 * LightParameters.InvRadius));
PassParameters->RayStartOffsetDepthScale = LightProxy.GetRayStartOffsetDepthScale();
const bool bHeightfield = PrimitiveType == DFPT_HeightField;
const float MaxLightAngle = bHeightfield ? 45.0f : 5.0f;
const float MinLightAngle = bHeightfield ? FMath::Min(GMinDirectionalLightAngleForRTHF, MaxLightAngle) : 0.001f;
const float LightSourceAngle = FMath::Clamp(LightProxy.GetLightSourceAngle(), MinLightAngle, MaxLightAngle) * PI / 180.0f;
PassParameters->TanLightAngleAndNormalThreshold = FVector3f(FMath::Tan(LightSourceAngle), FMath::Cos(PI / 2 + LightSourceAngle), LightProxy.GetTraceDistance());
PassParameters->ScissorRectMinAndSize = FIntRect(ScissorRect.Min, ScissorRect.Size());
PassParameters->ObjectBufferParameters = ObjectBufferParameters;
PassParameters->CulledObjectBufferParameters = CulledObjectBufferParameters;
PassParameters->LightTileIntersectionParameters = LightTileIntersectionParameters;
PassParameters->DistanceFieldAtlasParameters = DistanceField::SetupAtlasParameters(GraphBuilder, DistanceFieldSceneData);
PassParameters->HeightFieldAtlasParameters = HeightFieldAtlasParameters;
PassParameters->TranslatedWorldToShadow = FMatrix44f(FTranslationMatrix(ProjectedShadowInfo->PreShadowTranslation - View.ViewMatrices.GetPreViewTranslation()) * FMatrix(ProjectedShadowInfo->TranslatedWorldToClipInnerMatrix));
PassParameters->TwoSidedMeshDistanceBias = GTwoSidedMeshDistanceBias;
PassParameters->Strata = Strata::BindStrataGlobalUniformParameters(View);
if (ProjectedShadowInfo->bDirectionalLight)
{
PassParameters->MinDepth = ProjectedShadowInfo->CascadeSettings.SplitNear - ProjectedShadowInfo->CascadeSettings.SplitNearFadeRegion;
PassParameters->MaxDepth = ProjectedShadowInfo->CascadeSettings.SplitFar;
}
else
{
check(!bHeightfield);
//@todo - set these up for point lights as well
PassParameters->MinDepth = 0.0f;
PassParameters->MaxDepth = HALF_WORLD_MAX;
}
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3304653) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3288774 on 2017/02/06 by Ben.Salem Added in min/max/avg values to table. Allow us to also set which stat groups we use explicitly to massively cut down on plugin overhead. #tests Several tests passes taken on ShooterGame. Change 3289887 on 2017/02/07 by David.Hill Eye Adaptation: Fix basic mode. The last step of the basic eye adaptation needs to know the correct down-sampled viewport size #jira: UE-29491 Change 3290281 on 2017/02/07 by Chris.Bunner Account for LogToLin approximation value offseting. Change 3290282 on 2017/02/07 by Chris.Bunner Fixed missing 2000 nit branch in tonemapper. Change 3290331 on 2017/02/07 by Chris.Bunner Minor optimization for BlendMaterialAttributes node compilation. Change 3291140 on 2017/02/07 by Daniel.Wright Fixed distance field temporal filter using Point filtering * Fixed the manual bilinear filter in the high quality reprojection path, still doesn't solve the streaking artifacts though Change 3292060 on 2017/02/08 by Rolando.Caloca DR - Some enums for max/num bits on RHI definitions Change 3292213 on 2017/02/08 by Benjamin.Hyder Updating TM-DistanceFields map in QAGame Change 3292291 on 2017/02/08 by Benjamin.Hyder small tweaks to TM-DistanceFields Change 3292399 on 2017/02/08 by Chris.Bunner Minor fix to HDR format type check. Change 3293560 on 2017/02/08 by Rolando.Caloca DR - vk - Events Change 3293562 on 2017/02/08 by Rolando.Caloca DR - vk - Disambiguate class name Change 3295346 on 2017/02/09 by Rolando.Caloca DR - Duplicate fix from 3295320 Change 3296930 on 2017/02/10 by Chris.Bunner Search keywords for pre-skinned position/normal nodes. Change 3297162 on 2017/02/10 by Daniel.Wright Distance field temporal filter stores a confidence value, which is used to track leaking of occlusion during the upsample, and flush those leaked values through the history faster. Reduces DFAO ghosting when the camera is moving. Change 3297345 on 2017/02/10 by Daniel.Wright Added 'r.CompressMeshDistanceFields' to rendering project settings, defaults to off to prevent hitches when streaming in levels Change 3297371 on 2017/02/10 by Chris.Bunner Custom vertex interpolator in/out node with auto-packing - Function support. Unified UV/CVI interpolator arrays for mixed custom UV support. Change 3298013 on 2017/02/10 by Daniel.Wright Ray Traced Distance Field shadowing is overlapped with the shadow depth pass, controlled by r.DFShadowAsyncCompute. * Didn't save any GPU time on PS4, so currently disabled until further investigation. * This change breaks RTDF shadows in splitscreen / stereo Change 3300028 on 2017/02/13 by Ben.Salem Adding GPU/Render/Game thread timers by default. Remove pointless flavor whitelisting on the plugin. Add sample usage in ShooterGame.ini config. #tests Ran half a dozen perf passes, and preflighted my changes in EC Change 3301571 on 2017/02/14 by Joe.Graf Deleted this plugin since it is no longer needed as an example Change 3301882 on 2017/02/14 by Daniel.Wright Fixed DistanceFieldAOConfidenceHistoryRT not getting released on RT Change 3304283 on 2017/02/15 by Daniel.Wright Variable shadowing fix Change 3304653 on 2017/02/15 by Ben.Salem Fix thread safety issues in Performance Monitor - deal with floating point bug in determining when to record frames. #tests Preflighted changes several times, ran several runs on Showdown [CL 3307957 by Marcus Wassmer in Main branch]
2017-02-16 17:52:21 -05:00
PassParameters->DownsampleFactor = GetDFShadowDownsampleFactor();
UE5_MAIN: Multi-view-family scene renderer refactor, part 2. Move FSceneTextures singleton out of RDG blackboard and FSceneTexturesConfig global variable singleton, into FViewFamilyInfo. This is necessary to allow multiple view families to render in a single render graph and a single scene renderer call. * Existing calls to CreateSceneTextureShaderParameters and similar functions use "GetSceneTexturesChecked", which allows for the possibility that they are reached in a code path where scene textures haven't been initialized, and nullptr is returned instead of asserting. The shader parameter setup functions then fill in dummy defaults for that case. The goal was to precisely match the original behavior, which queried the RDG blackboard, and gracefully handled null if scene textures weren't there. This definitely appears to occur in FNiagaraGpuComputeDispatch::ProcessPendingTicksFlush, which can be called with a dummy scene with no scene textures. In the future, I may change this so dummy defaults are filled in for FSceneTextures at construction time, so the structure is never in an uninitialized state, but I would like to set up a test case for the Niagara code path before doing that, and the checks aren't harmful in the meantime. * I marked as deprecated global functions which query values from FSceneTexturesConfig, but they'll still work with the caveat that if you use multi-view-family rendering, the results will be indeterminate (whatever view family rendered last). There was only one case outside the scene renderer that accessed the globals (depth clear value), which I removed, noting that there is nowhere in the code where we modify the depth clear value from its global default. I would like to permanently deprecate or remove these at some point. Display Cluster is the only code that's currently using the multi-view-family code path, and as a new (still incomplete) feature, third party code can't be using it, and won't be affected. #jira NONE #rb chris.kulla zach.bethel mihnea.balta #preflight 6261aca76119a1a496bd2644 [CL 19873983 by jason hoerner in ue5-main branch]
2022-04-22 17:33:02 -04:00
const FIntPoint OutputBufferSize = GetBufferSizeForDFShadows(View);
PassParameters->InvOutputBufferSize = FVector2f(1.f / OutputBufferSize.X, 1.f / OutputBufferSize.Y);
PassParameters->ShadowFactorsTexture = PrevOutputTexture;
PassParameters->ShadowFactorsSampler = TStaticSamplerState<>::GetRHI();
FDistanceFieldShadowingCS::FPermutationDomain PermutationVector;
PermutationVector.Set< FDistanceFieldShadowingCS::FCullingType >((uint32)DistanceFieldShadowingType);
PermutationVector.Set< FDistanceFieldShadowingCS::FShadowQuality >(DFShadowQuality);
PermutationVector.Set< FDistanceFieldShadowingCS::FPrimitiveType >(PrimitiveType);
PermutationVector.Set< FDistanceFieldShadowingCS::FHasPreviousOutput >(bHasPrevOutput);
extern int32 GDistanceFieldOffsetDataStructure;
PermutationVector.Set< FDistanceFieldShadowingCS::FOffsetDataStructure >(GDistanceFieldOffsetDataStructure);
PermutationVector.Set<FDistanceFieldShadowingCS::FCompactCulledObjects>(GDFShadowCompactCulledObjects != 0);
auto ComputeShader = View.ShaderMap->GetShader< FDistanceFieldShadowingCS >(PermutationVector);
uint32 GroupSizeX = FMath::DivideAndRoundUp(ScissorRect.Size().X / GetDFShadowDownsampleFactor(), GDistanceFieldShadowTileSizeX);
uint32 GroupSizeY = FMath::DivideAndRoundUp(ScissorRect.Size().Y / GetDFShadowDownsampleFactor(), GDistanceFieldShadowTileSizeY);
PassParameters->NumGroups = FVector2f(GroupSizeX, GroupSizeY);
FComputeShaderUtils::AddPass(
GraphBuilder,
RDG_EVENT_NAME("DistanceFieldShadowing %ux%u", GroupSizeX * GDistanceFieldShadowTileSizeX, GroupSizeY * GDistanceFieldShadowTileSizeY),
bAsyncCompute ? ERDGPassFlags::AsyncCompute : ERDGPassFlags::Compute,
ComputeShader,
PassParameters,
FIntVector(GroupSizeX, GroupSizeY, 1));
}
}
FRDGTextureRef FProjectedShadowInfo::RenderRayTracedDistanceFieldProjection(
FRDGBuilder& GraphBuilder,
bool bAsyncCompute,
const FMinimalSceneTextures& SceneTextures,
const FViewInfo& View)
{
DistanceFieldShadowViewGPUData& SDFShadowViewGPUData = CachedDistanceFieldShadowViewGPUData.FindOrAdd(&View);
if (SDFShadowViewGPUData.RayTracedShadowsTexture)
{
// Ray traced distance field shadows were already calculated, simply return previous result.
return SDFShadowViewGPUData.RayTracedShadowsTexture;
}
const bool bDFShadowSupported = SupportsDistanceFieldShadows(View.GetFeatureLevel(), View.GetShaderPlatform());
const bool bHFShadowSupported = SupportsHeightFieldShadows(View.GetFeatureLevel(), View.GetShaderPlatform());
const FScene* Scene = (const FScene*)(View.Family->Scene);
if (bDFShadowSupported && View.Family->EngineShowFlags.RayTracedDistanceFieldShadows)
{
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3304653) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3288774 on 2017/02/06 by Ben.Salem Added in min/max/avg values to table. Allow us to also set which stat groups we use explicitly to massively cut down on plugin overhead. #tests Several tests passes taken on ShooterGame. Change 3289887 on 2017/02/07 by David.Hill Eye Adaptation: Fix basic mode. The last step of the basic eye adaptation needs to know the correct down-sampled viewport size #jira: UE-29491 Change 3290281 on 2017/02/07 by Chris.Bunner Account for LogToLin approximation value offseting. Change 3290282 on 2017/02/07 by Chris.Bunner Fixed missing 2000 nit branch in tonemapper. Change 3290331 on 2017/02/07 by Chris.Bunner Minor optimization for BlendMaterialAttributes node compilation. Change 3291140 on 2017/02/07 by Daniel.Wright Fixed distance field temporal filter using Point filtering * Fixed the manual bilinear filter in the high quality reprojection path, still doesn't solve the streaking artifacts though Change 3292060 on 2017/02/08 by Rolando.Caloca DR - Some enums for max/num bits on RHI definitions Change 3292213 on 2017/02/08 by Benjamin.Hyder Updating TM-DistanceFields map in QAGame Change 3292291 on 2017/02/08 by Benjamin.Hyder small tweaks to TM-DistanceFields Change 3292399 on 2017/02/08 by Chris.Bunner Minor fix to HDR format type check. Change 3293560 on 2017/02/08 by Rolando.Caloca DR - vk - Events Change 3293562 on 2017/02/08 by Rolando.Caloca DR - vk - Disambiguate class name Change 3295346 on 2017/02/09 by Rolando.Caloca DR - Duplicate fix from 3295320 Change 3296930 on 2017/02/10 by Chris.Bunner Search keywords for pre-skinned position/normal nodes. Change 3297162 on 2017/02/10 by Daniel.Wright Distance field temporal filter stores a confidence value, which is used to track leaking of occlusion during the upsample, and flush those leaked values through the history faster. Reduces DFAO ghosting when the camera is moving. Change 3297345 on 2017/02/10 by Daniel.Wright Added 'r.CompressMeshDistanceFields' to rendering project settings, defaults to off to prevent hitches when streaming in levels Change 3297371 on 2017/02/10 by Chris.Bunner Custom vertex interpolator in/out node with auto-packing - Function support. Unified UV/CVI interpolator arrays for mixed custom UV support. Change 3298013 on 2017/02/10 by Daniel.Wright Ray Traced Distance Field shadowing is overlapped with the shadow depth pass, controlled by r.DFShadowAsyncCompute. * Didn't save any GPU time on PS4, so currently disabled until further investigation. * This change breaks RTDF shadows in splitscreen / stereo Change 3300028 on 2017/02/13 by Ben.Salem Adding GPU/Render/Game thread timers by default. Remove pointless flavor whitelisting on the plugin. Add sample usage in ShooterGame.ini config. #tests Ran half a dozen perf passes, and preflighted my changes in EC Change 3301571 on 2017/02/14 by Joe.Graf Deleted this plugin since it is no longer needed as an example Change 3301882 on 2017/02/14 by Daniel.Wright Fixed DistanceFieldAOConfidenceHistoryRT not getting released on RT Change 3304283 on 2017/02/15 by Daniel.Wright Variable shadowing fix Change 3304653 on 2017/02/15 by Ben.Salem Fix thread safety issues in Performance Monitor - deal with floating point bug in determining when to record frames. #tests Preflighted changes several times, ran several runs on Showdown [CL 3307957 by Marcus Wassmer in Main branch]
2017-02-16 17:52:21 -05:00
QUICK_SCOPE_CYCLE_COUNTER(STAT_BeginRenderRayTracedDistanceFieldShadows);
RDG_EVENT_SCOPE(GraphBuilder, "BeginRayTracedDistanceFieldShadow");
Sparse, narrow band, streamed Mesh Signed Distance Fields * SDFs are now generated, allocated from the atlas and uploaded in 8^3 bricks (7^3 unique data, half voxel padding). * Tracing must load the brick index from the indirection table, and only bricks near the surface are stored * 3 mips are now generated, with the lowest resolution always loaded and the other 2 streamed * SDFs are now G8 narrow band. Lower resolution mips must be traversed when querying distance to nearest surface far away from the surface * The Distance Field Brick Atlas is now stored for each FScene and dynamically resized based on needs with a GPU memcopy * Brick atlas uses a 1d pooled allocator which has no fragmentation and greatly reduces packing waste over the 3d allocator * Added new indirection for Distance Field Asset data, so that only a single entry needs to be updated when a mip is streamed in or out in scenes with millions of instances * Compute shaders operating on distance field instances generate streaming requests, which are async read back to CPU, turned into IO requests, which are polled and when complete uploaded to atlases * Any mesh instance inside the Global SDF extent (200m) requests mip1, and at 50m requests mip2 * Now using a batched compute scatter to upload to the distance field atlas instead of RHIUpdateTexture3d, to bypass alignment restrictions and per-upload overhead * Distance Field streaming uses an async task to move Memcpy and IO request overhead off of the Rendering Thread * Distance Field Visualization now computes a normal from the SDF gradient and does simple lighting to better visualize the scene representation * Increased r.DistanceFields.MaxPerMeshResolution from 128 to 512, to better represent large objects * Mesh SDF generation now uses an Embree point query to calculate closest unsigned distance, and then a much smaller set of rays to count backfaces for negative region determination, for a 11x speedup * Upgraded mesh utilities to Embree 3.12.2 to get point queries * Fixed wrong transform used for SDF normals in Lumen, causing non-uniformly scaled meshes to have incorrect Surface Cache interpolation * Fixed Static Mesh materials not getting PostLoaded before SDF build, causing their blend modes to be wrong for the build, which corrupts the DDC. Also included those blend modes in the DDC key. Original costs on 1080 GTX (full updates on everything and no screen traces) 10.60ms UpdateGlobalDistanceField 3.62ms LumenReflectiveTest.DirectionalLight_1 Shadowmap 1 1.73ms VoxelizeCards Clipmaps=[0,1,2,3] 0.38ms TraceCards 1 dispatch 1 groups 0.51ms TraceCards 1 dispatch 1 groups Sparse SDF costs 12.06ms UpdateGlobalDistanceField 4.35ms LumenReflectiveTest.DirectionalLight_1 Shadowmap 1 2.30ms VoxelizeCards Clipmaps=[0,1,2,3] 0.69ms TraceCards 1 dispatch 1 groups 0.77ms TraceCards 1 dispatch 1 groups Tested: TopazEntry PC, Reverb PC and PS5, EngineTests, QAGame, Rift, Frosty P_Construct_WP, FortGPUTestbed #rb Krzysztof.Narkowicz #ROBOMERGE-OWNER: Daniel.Wright #ROBOMERGE-AUTHOR: daniel.wright #ROBOMERGE-SOURCE: CL 15784493 in //UE5/Release-5.0-EarlyAccess/... #ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v783-15756269) #ROBOMERGE-CONFLICT from-shelf [CL 15790658 by Daniel Wright in ue5-main branch]
2021-03-23 22:40:05 -04:00
if (Scene->DistanceFieldSceneData.NumObjectsInBuffer > 0)
{
check(!Scene->DistanceFieldSceneData.HasPendingOperations());
FDistanceFieldObjectBufferParameters ObjectBufferParameters = DistanceField::SetupObjectBufferParameters(GraphBuilder, Scene->DistanceFieldSceneData);
Add support for distance field shadow on water. Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture. DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console. DFShadow is naturaly skipped if the directional light does not have that feature enabled. When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p. The separated light buffer is an extra 8MB allocated when in deferred. This only works with deferred for now (forward does not run the reflection/composite pass). Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line. r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled. r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded). Follow up: tile upsample, tile traceshadow, make it work with strata. Tested shooter and console. #rb Tiago.Costa, Kevin.Ortegren #preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424 [CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -04:00
if (SDFShadowViewGPUData.SDFCulledObjectBufferParameters == nullptr)
{
int32 NumPlanes = 0;
const FPlane* PlaneData = NULL;
FVector4f ShadowBoundingSphere = FVector4f::Zero();
FVector PrePlaneTranslation = FVector::ZeroVector;
Add support for distance field shadow on water. Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture. DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console. DFShadow is naturaly skipped if the directional light does not have that feature enabled. When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p. The separated light buffer is an extra 8MB allocated when in deferred. This only works with deferred for now (forward does not run the reflection/composite pass). Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line. r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled. r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded). Follow up: tile upsample, tile traceshadow, make it work with strata. Tested shooter and console. #rb Tiago.Costa, Kevin.Ortegren #preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424 [CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -04:00
if (bDirectionalLight)
{
NumPlanes = CascadeSettings.ShadowBoundsAccurate.Planes.Num();
PlaneData = CascadeSettings.ShadowBoundsAccurate.Planes.GetData();
}
else if (IsWholeScenePointLightShadow())
{
ShadowBoundingSphere = FVector4f(FVector3f(ShadowBounds.Center + View.ViewMatrices.GetPreViewTranslation()), ShadowBounds.W);
}
else
{
NumPlanes = CasterOuterFrustum.Planes.Num();
PlaneData = CasterOuterFrustum.Planes.GetData();
PrePlaneTranslation = PreShadowTranslation;
}
const FMatrix WorldToShadowValue = FTranslationMatrix(PreShadowTranslation) * FMatrix(TranslatedWorldToClipInnerMatrix);
SDFShadowViewGPUData.SDFCulledObjectBufferParameters = GraphBuilder.AllocObject<FDistanceFieldCulledObjectBufferParameters>();
SDFShadowViewGPUData.SDFLightTileIntersectionParameters = GraphBuilder.AllocObject<FLightTileIntersectionParameters>();
CullDistanceFieldObjectsForLight(
GraphBuilder,
View,
LightSceneInfo->Proxy,
DFPT_SignedDistanceField,
WorldToShadowValue,
NumPlanes,
PlaneData,
PrePlaneTranslation,
ShadowBoundingSphere,
ShadowBounds.W,
true,
ObjectBufferParameters,
*SDFShadowViewGPUData.SDFCulledObjectBufferParameters,
*SDFShadowViewGPUData.SDFLightTileIntersectionParameters
);
Add support for distance field shadow on water. Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture. DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console. DFShadow is naturaly skipped if the directional light does not have that feature enabled. When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p. The separated light buffer is an extra 8MB allocated when in deferred. This only works with deferred for now (forward does not run the reflection/composite pass). Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line. r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled. r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded). Follow up: tile upsample, tile traceshadow, make it work with strata. Tested shooter and console. #rb Tiago.Costa, Kevin.Ortegren #preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424 [CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -04:00
}
{
UE5_MAIN: Multi-view-family scene renderer refactor, part 2. Move FSceneTextures singleton out of RDG blackboard and FSceneTexturesConfig global variable singleton, into FViewFamilyInfo. This is necessary to allow multiple view families to render in a single render graph and a single scene renderer call. * Existing calls to CreateSceneTextureShaderParameters and similar functions use "GetSceneTexturesChecked", which allows for the possibility that they are reached in a code path where scene textures haven't been initialized, and nullptr is returned instead of asserting. The shader parameter setup functions then fill in dummy defaults for that case. The goal was to precisely match the original behavior, which queried the RDG blackboard, and gracefully handled null if scene textures weren't there. This definitely appears to occur in FNiagaraGpuComputeDispatch::ProcessPendingTicksFlush, which can be called with a dummy scene with no scene textures. In the future, I may change this so dummy defaults are filled in for FSceneTextures at construction time, so the structure is never in an uninitialized state, but I would like to set up a test case for the Niagara code path before doing that, and the checks aren't harmful in the meantime. * I marked as deprecated global functions which query values from FSceneTexturesConfig, but they'll still work with the caveat that if you use multi-view-family rendering, the results will be indeterminate (whatever view family rendered last). There was only one case outside the scene renderer that accessed the globals (depth clear value), which I removed, noting that there is nowhere in the code where we modify the depth clear value from its global default. I would like to permanently deprecate or remove these at some point. Display Cluster is the only code that's currently using the multi-view-family code path, and as a new (still incomplete) feature, third party code can't be using it, and won't be affected. #jira NONE #rb chris.kulla zach.bethel mihnea.balta #preflight 6261aca76119a1a496bd2644 [CL 19873983 by jason hoerner in ue5-main branch]
2022-04-22 17:33:02 -04:00
const FIntPoint BufferSize = GetBufferSizeForDFShadows(View);
FRDGTextureDesc Desc(FRDGTextureDesc::Create2D(BufferSize, PF_G16R16F, FClearValueBinding::None, TexCreate_UAV));
Copying //UE4/Dev-Console to //UE4/Dev-Main (Source: //UE4/Dev-Console @ 3573247) #lockdown Nick.Penwarden #rb none ============================ MAJOR FEATURES & CHANGES ============================ Change 3517651 by Ben.Woodhouse Integrate from //UE4/Main/...@3517493 to //UE4/Dev-Console/... Change 3519614 by Ben.Woodhouse Disable XGE shader compile Change 3524092 by Ben.Woodhouse FastVRam configurability - expose cvars to control fast vram usage for many rendertargets and buffers so that licensees can configure and find good values. Add support for tweaking values at runtime Change 3530731 by Luke.Thatcher [CONSOLE] [STREAMS] [^] Merging //UE4/Dev-Main (CL 3530708) to Dev-Console (//UE4/Dev-Console) Change 3537544 by Daniel.Eldar [General] Fixed an issue where the level streamer would not stream in a level until it finished streaming out another one. #jira UE-46954 Change 3540227 by Ben.Woodhouse Integrate from //UE4/Main/...@3539942 to //UE4/Dev-Console/... Change 3548390 by Keith.Judge Edigrate 3547845 to Dev-Console. Fix for UE-46826 - Correct mismatching game content base directories when using the network file server layer #jira UE-47570 Change 3563801 by Luke.Thatcher [CONSOLE] [STREAMS] [^] Merging //UE4/Dev-Main (CL 3557944) to Dev-Console (//UE4/Dev-Console) Change 3566413 by Luke.Thatcher [CONSOLE] [~] Fix build warning from bad merge of NetworkFileServerConnection.cpp - CL 3512255 renamed GameDir to ProjectDir, but we lost this change in the merge. Change 3566420 by Daniel.Eldar [General] Added a toggle vibration option to ShooterGame. #jira UE-47776 Change 3570476 by Ben.Woodhouse Fix for static analysis failure (disable innoccuous warning) #jira UE-48003 Change 3571837 by Ben.Woodhouse Integrate from //UE4/Main/...@3571062 to //UE4/Dev-Console/... Change 3572554 by Ben.Woodhouse Fix static analysis warning (disabling the warning didn't work) #jira UE-48050 [CL 3573409 by Joe Barnes in Main branch]
2017-08-04 17:24:53 -04:00
Desc.Flags |= GFastVRamConfig.DistanceFieldShadows;
SDFShadowViewGPUData.RayTracedShadowsTexture = GraphBuilder.CreateTexture(Desc, TEXT("RayTracedShadows"));
}
RayTraceShadows(GraphBuilder, bAsyncCompute, SceneTextures, SDFShadowViewGPUData.RayTracedShadowsTexture, View, Scene->DistanceFieldSceneData, this, DFPT_SignedDistanceField, false, nullptr, ObjectBufferParameters, *SDFShadowViewGPUData.SDFCulledObjectBufferParameters, *SDFShadowViewGPUData.SDFLightTileIntersectionParameters);
}
}
if (bDirectionalLight
&& View.Family->EngineShowFlags.RayTracedDistanceFieldShadows
&& GHeightFieldTextureAtlas.HasAtlasTexture()
&& Scene->DistanceFieldSceneData.NumHeightFieldObjectsInBuffer > 0
&& bHFShadowSupported)
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_BeginRenderRayTracedHeightFieldShadows);
RDG_EVENT_SCOPE(GraphBuilder, "BeginRenderRayTracedHeightFieldShadows");
check(!Scene->DistanceFieldSceneData.HasPendingHeightFieldOperations());
FDistanceFieldObjectBufferParameters ObjectBufferParameters = DistanceField::SetupObjectBufferParameters(GraphBuilder, Scene->DistanceFieldSceneData);
Add support for distance field shadow on water. Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture. DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console. DFShadow is naturaly skipped if the directional light does not have that feature enabled. When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p. The separated light buffer is an extra 8MB allocated when in deferred. This only works with deferred for now (forward does not run the reflection/composite pass). Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line. r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled. r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded). Follow up: tile upsample, tile traceshadow, make it work with strata. Tested shooter and console. #rb Tiago.Costa, Kevin.Ortegren #preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424 [CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -04:00
if (SDFShadowViewGPUData.HeightFieldCulledObjectBufferParameters == nullptr)
{
const int32 NumPlanes = CascadeSettings.ShadowBoundsAccurate.Planes.Num();
const FPlane* PlaneData = CascadeSettings.ShadowBoundsAccurate.Planes.GetData();
FVector PrePlaneTranslation = FVector::ZeroVector;
const FVector4f ShadowBoundingSphere = FVector4f::Zero();
const FMatrix WorldToShadowValue = FTranslationMatrix(PreShadowTranslation) * FMatrix(TranslatedWorldToClipInnerMatrix);
Add support for distance field shadow on water. Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture. DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console. DFShadow is naturaly skipped if the directional light does not have that feature enabled. When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p. The separated light buffer is an extra 8MB allocated when in deferred. This only works with deferred for now (forward does not run the reflection/composite pass). Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line. r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled. r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded). Follow up: tile upsample, tile traceshadow, make it work with strata. Tested shooter and console. #rb Tiago.Costa, Kevin.Ortegren #preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424 [CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -04:00
SDFShadowViewGPUData.HeightFieldCulledObjectBufferParameters = GraphBuilder.AllocObject<FDistanceFieldCulledObjectBufferParameters>();
SDFShadowViewGPUData.HeightFieldLightTileIntersectionParameters = GraphBuilder.AllocObject<FLightTileIntersectionParameters>();
CullDistanceFieldObjectsForLight(
GraphBuilder,
View,
LightSceneInfo->Proxy,
DFPT_HeightField,
WorldToShadowValue,
NumPlanes,
PlaneData,
PrePlaneTranslation,
ShadowBoundingSphere,
ShadowBounds.W,
true,
ObjectBufferParameters,
*SDFShadowViewGPUData.HeightFieldCulledObjectBufferParameters,
*SDFShadowViewGPUData.HeightFieldLightTileIntersectionParameters
);
Add support for distance field shadow on water. Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture. DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console. DFShadow is naturaly skipped if the directional light does not have that feature enabled. When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p. The separated light buffer is an extra 8MB allocated when in deferred. This only works with deferred for now (forward does not run the reflection/composite pass). Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line. r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled. r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded). Follow up: tile upsample, tile traceshadow, make it work with strata. Tested shooter and console. #rb Tiago.Costa, Kevin.Ortegren #preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424 [CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -04:00
}
const bool bHasPrevOutput = !!SDFShadowViewGPUData.RayTracedShadowsTexture;
FRDGTextureRef PrevOutputTexture = nullptr;
if (!RHISupports4ComponentUAVReadWrite(View.GetShaderPlatform()))
{
PrevOutputTexture = SDFShadowViewGPUData.RayTracedShadowsTexture;
SDFShadowViewGPUData.RayTracedShadowsTexture = nullptr;
}
if (!SDFShadowViewGPUData.RayTracedShadowsTexture)
{
UE5_MAIN: Multi-view-family scene renderer refactor, part 2. Move FSceneTextures singleton out of RDG blackboard and FSceneTexturesConfig global variable singleton, into FViewFamilyInfo. This is necessary to allow multiple view families to render in a single render graph and a single scene renderer call. * Existing calls to CreateSceneTextureShaderParameters and similar functions use "GetSceneTexturesChecked", which allows for the possibility that they are reached in a code path where scene textures haven't been initialized, and nullptr is returned instead of asserting. The shader parameter setup functions then fill in dummy defaults for that case. The goal was to precisely match the original behavior, which queried the RDG blackboard, and gracefully handled null if scene textures weren't there. This definitely appears to occur in FNiagaraGpuComputeDispatch::ProcessPendingTicksFlush, which can be called with a dummy scene with no scene textures. In the future, I may change this so dummy defaults are filled in for FSceneTextures at construction time, so the structure is never in an uninitialized state, but I would like to set up a test case for the Niagara code path before doing that, and the checks aren't harmful in the meantime. * I marked as deprecated global functions which query values from FSceneTexturesConfig, but they'll still work with the caveat that if you use multi-view-family rendering, the results will be indeterminate (whatever view family rendered last). There was only one case outside the scene renderer that accessed the globals (depth clear value), which I removed, noting that there is nowhere in the code where we modify the depth clear value from its global default. I would like to permanently deprecate or remove these at some point. Display Cluster is the only code that's currently using the multi-view-family code path, and as a new (still incomplete) feature, third party code can't be using it, and won't be affected. #jira NONE #rb chris.kulla zach.bethel mihnea.balta #preflight 6261aca76119a1a496bd2644 [CL 19873983 by jason hoerner in ue5-main branch]
2022-04-22 17:33:02 -04:00
const FIntPoint BufferSize = GetBufferSizeForDFShadows(View);
FRDGTextureDesc Desc(FRDGTextureDesc::Create2D(BufferSize, PF_G16R16F, FClearValueBinding::None, TexCreate_UAV));
Desc.Flags |= GFastVRamConfig.DistanceFieldShadows;
SDFShadowViewGPUData.RayTracedShadowsTexture = GraphBuilder.CreateTexture(Desc, TEXT("RayTracedShadows"));
}
RayTraceShadows(GraphBuilder, bAsyncCompute, SceneTextures, SDFShadowViewGPUData.RayTracedShadowsTexture, View, Scene->DistanceFieldSceneData, this, DFPT_HeightField, bHasPrevOutput, PrevOutputTexture, ObjectBufferParameters, *SDFShadowViewGPUData.HeightFieldCulledObjectBufferParameters, *SDFShadowViewGPUData.HeightFieldLightTileIntersectionParameters);
}
return SDFShadowViewGPUData.RayTracedShadowsTexture;
}
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3304653) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3288774 on 2017/02/06 by Ben.Salem Added in min/max/avg values to table. Allow us to also set which stat groups we use explicitly to massively cut down on plugin overhead. #tests Several tests passes taken on ShooterGame. Change 3289887 on 2017/02/07 by David.Hill Eye Adaptation: Fix basic mode. The last step of the basic eye adaptation needs to know the correct down-sampled viewport size #jira: UE-29491 Change 3290281 on 2017/02/07 by Chris.Bunner Account for LogToLin approximation value offseting. Change 3290282 on 2017/02/07 by Chris.Bunner Fixed missing 2000 nit branch in tonemapper. Change 3290331 on 2017/02/07 by Chris.Bunner Minor optimization for BlendMaterialAttributes node compilation. Change 3291140 on 2017/02/07 by Daniel.Wright Fixed distance field temporal filter using Point filtering * Fixed the manual bilinear filter in the high quality reprojection path, still doesn't solve the streaking artifacts though Change 3292060 on 2017/02/08 by Rolando.Caloca DR - Some enums for max/num bits on RHI definitions Change 3292213 on 2017/02/08 by Benjamin.Hyder Updating TM-DistanceFields map in QAGame Change 3292291 on 2017/02/08 by Benjamin.Hyder small tweaks to TM-DistanceFields Change 3292399 on 2017/02/08 by Chris.Bunner Minor fix to HDR format type check. Change 3293560 on 2017/02/08 by Rolando.Caloca DR - vk - Events Change 3293562 on 2017/02/08 by Rolando.Caloca DR - vk - Disambiguate class name Change 3295346 on 2017/02/09 by Rolando.Caloca DR - Duplicate fix from 3295320 Change 3296930 on 2017/02/10 by Chris.Bunner Search keywords for pre-skinned position/normal nodes. Change 3297162 on 2017/02/10 by Daniel.Wright Distance field temporal filter stores a confidence value, which is used to track leaking of occlusion during the upsample, and flush those leaked values through the history faster. Reduces DFAO ghosting when the camera is moving. Change 3297345 on 2017/02/10 by Daniel.Wright Added 'r.CompressMeshDistanceFields' to rendering project settings, defaults to off to prevent hitches when streaming in levels Change 3297371 on 2017/02/10 by Chris.Bunner Custom vertex interpolator in/out node with auto-packing - Function support. Unified UV/CVI interpolator arrays for mixed custom UV support. Change 3298013 on 2017/02/10 by Daniel.Wright Ray Traced Distance Field shadowing is overlapped with the shadow depth pass, controlled by r.DFShadowAsyncCompute. * Didn't save any GPU time on PS4, so currently disabled until further investigation. * This change breaks RTDF shadows in splitscreen / stereo Change 3300028 on 2017/02/13 by Ben.Salem Adding GPU/Render/Game thread timers by default. Remove pointless flavor whitelisting on the plugin. Add sample usage in ShooterGame.ini config. #tests Ran half a dozen perf passes, and preflighted my changes in EC Change 3301571 on 2017/02/14 by Joe.Graf Deleted this plugin since it is no longer needed as an example Change 3301882 on 2017/02/14 by Daniel.Wright Fixed DistanceFieldAOConfidenceHistoryRT not getting released on RT Change 3304283 on 2017/02/15 by Daniel.Wright Variable shadowing fix Change 3304653 on 2017/02/15 by Ben.Salem Fix thread safety issues in Performance Monitor - deal with floating point bug in determining when to record frames. #tests Preflighted changes several times, ran several runs on Showdown [CL 3307957 by Marcus Wassmer in Main branch]
2017-02-16 17:52:21 -05:00
BEGIN_SHADER_PARAMETER_STRUCT(FDistanceFieldShadowingUpsample, )
SHADER_PARAMETER_STRUCT_INCLUDE(FDistanceFieldShadowingUpsamplePS::FParameters, PS)
SHADER_PARAMETER_STRUCT_INCLUDE(FShadowTileVS::FParameters, VS)
RDG_BUFFER_ACCESS(IndirectDrawParameter, ERHIAccess::IndirectArgs)
RENDER_TARGET_BINDING_SLOTS()
END_SHADER_PARAMETER_STRUCT()
void FProjectedShadowInfo::RenderRayTracedDistanceFieldProjection(
FRDGBuilder& GraphBuilder,
const FMinimalSceneTextures& SceneTextures,
FRDGTextureRef ScreenShadowMaskTexture,
const FViewInfo& View,
FIntRect ScissorRect,
Add support for distance field shadow on water. Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture. DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console. DFShadow is naturaly skipped if the directional light does not have that feature enabled. When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p. The separated light buffer is an extra 8MB allocated when in deferred. This only works with deferred for now (forward does not run the reflection/composite pass). Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line. r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled. r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded). Follow up: tile upsample, tile traceshadow, make it work with strata. Tested shooter and console. #rb Tiago.Costa, Kevin.Ortegren #preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424 [CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -04:00
bool bProjectingForForwardShading,
bool bForceRGBModulation,
FTiledShadowRendering* TiledShadowRendering)
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3304653) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3288774 on 2017/02/06 by Ben.Salem Added in min/max/avg values to table. Allow us to also set which stat groups we use explicitly to massively cut down on plugin overhead. #tests Several tests passes taken on ShooterGame. Change 3289887 on 2017/02/07 by David.Hill Eye Adaptation: Fix basic mode. The last step of the basic eye adaptation needs to know the correct down-sampled viewport size #jira: UE-29491 Change 3290281 on 2017/02/07 by Chris.Bunner Account for LogToLin approximation value offseting. Change 3290282 on 2017/02/07 by Chris.Bunner Fixed missing 2000 nit branch in tonemapper. Change 3290331 on 2017/02/07 by Chris.Bunner Minor optimization for BlendMaterialAttributes node compilation. Change 3291140 on 2017/02/07 by Daniel.Wright Fixed distance field temporal filter using Point filtering * Fixed the manual bilinear filter in the high quality reprojection path, still doesn't solve the streaking artifacts though Change 3292060 on 2017/02/08 by Rolando.Caloca DR - Some enums for max/num bits on RHI definitions Change 3292213 on 2017/02/08 by Benjamin.Hyder Updating TM-DistanceFields map in QAGame Change 3292291 on 2017/02/08 by Benjamin.Hyder small tweaks to TM-DistanceFields Change 3292399 on 2017/02/08 by Chris.Bunner Minor fix to HDR format type check. Change 3293560 on 2017/02/08 by Rolando.Caloca DR - vk - Events Change 3293562 on 2017/02/08 by Rolando.Caloca DR - vk - Disambiguate class name Change 3295346 on 2017/02/09 by Rolando.Caloca DR - Duplicate fix from 3295320 Change 3296930 on 2017/02/10 by Chris.Bunner Search keywords for pre-skinned position/normal nodes. Change 3297162 on 2017/02/10 by Daniel.Wright Distance field temporal filter stores a confidence value, which is used to track leaking of occlusion during the upsample, and flush those leaked values through the history faster. Reduces DFAO ghosting when the camera is moving. Change 3297345 on 2017/02/10 by Daniel.Wright Added 'r.CompressMeshDistanceFields' to rendering project settings, defaults to off to prevent hitches when streaming in levels Change 3297371 on 2017/02/10 by Chris.Bunner Custom vertex interpolator in/out node with auto-packing - Function support. Unified UV/CVI interpolator arrays for mixed custom UV support. Change 3298013 on 2017/02/10 by Daniel.Wright Ray Traced Distance Field shadowing is overlapped with the shadow depth pass, controlled by r.DFShadowAsyncCompute. * Didn't save any GPU time on PS4, so currently disabled until further investigation. * This change breaks RTDF shadows in splitscreen / stereo Change 3300028 on 2017/02/13 by Ben.Salem Adding GPU/Render/Game thread timers by default. Remove pointless flavor whitelisting on the plugin. Add sample usage in ShooterGame.ini config. #tests Ran half a dozen perf passes, and preflighted my changes in EC Change 3301571 on 2017/02/14 by Joe.Graf Deleted this plugin since it is no longer needed as an example Change 3301882 on 2017/02/14 by Daniel.Wright Fixed DistanceFieldAOConfidenceHistoryRT not getting released on RT Change 3304283 on 2017/02/15 by Daniel.Wright Variable shadowing fix Change 3304653 on 2017/02/15 by Ben.Salem Fix thread safety issues in Performance Monitor - deal with floating point bug in determining when to record frames. #tests Preflighted changes several times, ran several runs on Showdown [CL 3307957 by Marcus Wassmer in Main branch]
2017-02-16 17:52:21 -05:00
{
check(ScissorRect.Area() > 0);
const bool bRunTiled = UseShadowIndirectDraw(View.GetShaderPlatform()) && TiledShadowRendering != nullptr;
FRDGTextureRef RayTracedShadowsTexture = RenderRayTracedDistanceFieldProjection(GraphBuilder, false, SceneTextures, View);
if (RayTracedShadowsTexture)
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3304653) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3288774 on 2017/02/06 by Ben.Salem Added in min/max/avg values to table. Allow us to also set which stat groups we use explicitly to massively cut down on plugin overhead. #tests Several tests passes taken on ShooterGame. Change 3289887 on 2017/02/07 by David.Hill Eye Adaptation: Fix basic mode. The last step of the basic eye adaptation needs to know the correct down-sampled viewport size #jira: UE-29491 Change 3290281 on 2017/02/07 by Chris.Bunner Account for LogToLin approximation value offseting. Change 3290282 on 2017/02/07 by Chris.Bunner Fixed missing 2000 nit branch in tonemapper. Change 3290331 on 2017/02/07 by Chris.Bunner Minor optimization for BlendMaterialAttributes node compilation. Change 3291140 on 2017/02/07 by Daniel.Wright Fixed distance field temporal filter using Point filtering * Fixed the manual bilinear filter in the high quality reprojection path, still doesn't solve the streaking artifacts though Change 3292060 on 2017/02/08 by Rolando.Caloca DR - Some enums for max/num bits on RHI definitions Change 3292213 on 2017/02/08 by Benjamin.Hyder Updating TM-DistanceFields map in QAGame Change 3292291 on 2017/02/08 by Benjamin.Hyder small tweaks to TM-DistanceFields Change 3292399 on 2017/02/08 by Chris.Bunner Minor fix to HDR format type check. Change 3293560 on 2017/02/08 by Rolando.Caloca DR - vk - Events Change 3293562 on 2017/02/08 by Rolando.Caloca DR - vk - Disambiguate class name Change 3295346 on 2017/02/09 by Rolando.Caloca DR - Duplicate fix from 3295320 Change 3296930 on 2017/02/10 by Chris.Bunner Search keywords for pre-skinned position/normal nodes. Change 3297162 on 2017/02/10 by Daniel.Wright Distance field temporal filter stores a confidence value, which is used to track leaking of occlusion during the upsample, and flush those leaked values through the history faster. Reduces DFAO ghosting when the camera is moving. Change 3297345 on 2017/02/10 by Daniel.Wright Added 'r.CompressMeshDistanceFields' to rendering project settings, defaults to off to prevent hitches when streaming in levels Change 3297371 on 2017/02/10 by Chris.Bunner Custom vertex interpolator in/out node with auto-packing - Function support. Unified UV/CVI interpolator arrays for mixed custom UV support. Change 3298013 on 2017/02/10 by Daniel.Wright Ray Traced Distance Field shadowing is overlapped with the shadow depth pass, controlled by r.DFShadowAsyncCompute. * Didn't save any GPU time on PS4, so currently disabled until further investigation. * This change breaks RTDF shadows in splitscreen / stereo Change 3300028 on 2017/02/13 by Ben.Salem Adding GPU/Render/Game thread timers by default. Remove pointless flavor whitelisting on the plugin. Add sample usage in ShooterGame.ini config. #tests Ran half a dozen perf passes, and preflighted my changes in EC Change 3301571 on 2017/02/14 by Joe.Graf Deleted this plugin since it is no longer needed as an example Change 3301882 on 2017/02/14 by Daniel.Wright Fixed DistanceFieldAOConfidenceHistoryRT not getting released on RT Change 3304283 on 2017/02/15 by Daniel.Wright Variable shadowing fix Change 3304653 on 2017/02/15 by Ben.Salem Fix thread safety issues in Performance Monitor - deal with floating point bug in determining when to record frames. #tests Preflighted changes several times, ran several runs on Showdown [CL 3307957 by Marcus Wassmer in Main branch]
2017-02-16 17:52:21 -05:00
{
FDistanceFieldShadowingUpsample* PassParameters = GraphBuilder.AllocParameters<FDistanceFieldShadowingUpsample>();
PassParameters->RenderTargets[0] = FRenderTargetBinding(ScreenShadowMaskTexture, ERenderTargetLoadAction::ELoad);
PassParameters->RenderTargets.DepthStencil = FDepthStencilBinding(SceneTextures.Depth.Target, ERenderTargetLoadAction::ELoad, ERenderTargetLoadAction::ELoad, FExclusiveDepthStencil::DepthRead_StencilRead);
PassParameters->PS.View = GetShaderBinding(View.ViewUniformBuffer);
PassParameters->PS.SceneTextures = SceneTextures.GetSceneTextureShaderParameters(View.GetFeatureLevel());
PassParameters->PS.ShadowFactorsTexture = RayTracedShadowsTexture;
PassParameters->PS.ShadowFactorsSampler = TStaticSamplerState<SF_Bilinear>::GetRHI();
PassParameters->PS.ScissorRectMinAndSize = FIntRect(ScissorRect.Min, ScissorRect.Size());
if (bDirectionalLight && CascadeSettings.FadePlaneLength > 0)
{
PassParameters->PS.FadePlaneOffset = CascadeSettings.FadePlaneOffset;
PassParameters->PS.InvFadePlaneLength = 1.0f / FMath::Max(CascadeSettings.FadePlaneLength, .00001f);
}
else
{
PassParameters->PS.FadePlaneOffset = 0.0f;
PassParameters->PS.InvFadePlaneLength = 0.0f;
}
if (bDirectionalLight && CascadeSettings.SplitNearFadeRegion > 0)
{
PassParameters->PS.NearFadePlaneOffset = CascadeSettings.SplitNear - CascadeSettings.SplitNearFadeRegion;
PassParameters->PS.InvNearFadePlaneLength = 1.0f / FMath::Max(CascadeSettings.SplitNearFadeRegion, .00001f);
}
else
{
PassParameters->PS.NearFadePlaneOffset = -1.0f;
PassParameters->PS.InvNearFadePlaneLength = 1.0f;
}
if (bRunTiled)
{
PassParameters->IndirectDrawParameter = TiledShadowRendering->DrawIndirectParametersBuffer;
PassParameters->VS.ViewUniformBuffer = GetShaderBinding(View.ViewUniformBuffer);
PassParameters->VS.TileListData = TiledShadowRendering->TileListDataBufferSRV;
}
FDistanceFieldShadowingUpsamplePS::FPermutationDomain PermutationVector;
PermutationVector.Set< FDistanceFieldShadowingUpsamplePS::FUpsample >(GFullResolutionDFShadowing == 0);
auto PixelShader = View.ShaderMap->GetShader< FDistanceFieldShadowingUpsamplePS >(PermutationVector);
const bool bReverseCulling = View.bReverseCulling;
ClearUnusedGraphResources(PixelShader, &PassParameters->PS);
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3304653) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3288774 on 2017/02/06 by Ben.Salem Added in min/max/avg values to table. Allow us to also set which stat groups we use explicitly to massively cut down on plugin overhead. #tests Several tests passes taken on ShooterGame. Change 3289887 on 2017/02/07 by David.Hill Eye Adaptation: Fix basic mode. The last step of the basic eye adaptation needs to know the correct down-sampled viewport size #jira: UE-29491 Change 3290281 on 2017/02/07 by Chris.Bunner Account for LogToLin approximation value offseting. Change 3290282 on 2017/02/07 by Chris.Bunner Fixed missing 2000 nit branch in tonemapper. Change 3290331 on 2017/02/07 by Chris.Bunner Minor optimization for BlendMaterialAttributes node compilation. Change 3291140 on 2017/02/07 by Daniel.Wright Fixed distance field temporal filter using Point filtering * Fixed the manual bilinear filter in the high quality reprojection path, still doesn't solve the streaking artifacts though Change 3292060 on 2017/02/08 by Rolando.Caloca DR - Some enums for max/num bits on RHI definitions Change 3292213 on 2017/02/08 by Benjamin.Hyder Updating TM-DistanceFields map in QAGame Change 3292291 on 2017/02/08 by Benjamin.Hyder small tweaks to TM-DistanceFields Change 3292399 on 2017/02/08 by Chris.Bunner Minor fix to HDR format type check. Change 3293560 on 2017/02/08 by Rolando.Caloca DR - vk - Events Change 3293562 on 2017/02/08 by Rolando.Caloca DR - vk - Disambiguate class name Change 3295346 on 2017/02/09 by Rolando.Caloca DR - Duplicate fix from 3295320 Change 3296930 on 2017/02/10 by Chris.Bunner Search keywords for pre-skinned position/normal nodes. Change 3297162 on 2017/02/10 by Daniel.Wright Distance field temporal filter stores a confidence value, which is used to track leaking of occlusion during the upsample, and flush those leaked values through the history faster. Reduces DFAO ghosting when the camera is moving. Change 3297345 on 2017/02/10 by Daniel.Wright Added 'r.CompressMeshDistanceFields' to rendering project settings, defaults to off to prevent hitches when streaming in levels Change 3297371 on 2017/02/10 by Chris.Bunner Custom vertex interpolator in/out node with auto-packing - Function support. Unified UV/CVI interpolator arrays for mixed custom UV support. Change 3298013 on 2017/02/10 by Daniel.Wright Ray Traced Distance Field shadowing is overlapped with the shadow depth pass, controlled by r.DFShadowAsyncCompute. * Didn't save any GPU time on PS4, so currently disabled until further investigation. * This change breaks RTDF shadows in splitscreen / stereo Change 3300028 on 2017/02/13 by Ben.Salem Adding GPU/Render/Game thread timers by default. Remove pointless flavor whitelisting on the plugin. Add sample usage in ShooterGame.ini config. #tests Ran half a dozen perf passes, and preflighted my changes in EC Change 3301571 on 2017/02/14 by Joe.Graf Deleted this plugin since it is no longer needed as an example Change 3301882 on 2017/02/14 by Daniel.Wright Fixed DistanceFieldAOConfidenceHistoryRT not getting released on RT Change 3304283 on 2017/02/15 by Daniel.Wright Variable shadowing fix Change 3304653 on 2017/02/15 by Ben.Salem Fix thread safety issues in Performance Monitor - deal with floating point bug in determining when to record frames. #tests Preflighted changes several times, ran several runs on Showdown [CL 3307957 by Marcus Wassmer in Main branch]
2017-02-16 17:52:21 -05:00
if (bRunTiled)
Copying //UE4/Dev-Console to //UE4/Dev-Main (Source: //UE4/Dev-Console @ 3483086) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3389969 on 2017/04/12 by Guillaume.Abadie Implements FDebug::DumpStackTraceToLog() debugging utility. Change 3391579 on 2017/04/12 by Joe.Barnes Fix minor spacing issue. Change 3402629 on 2017/04/20 by Ben.Marsh Build: Remove job to populate the DDC. Trying out a new system for this. Change 3417501 on 2017/05/01 by Joe.Barnes IWYU - Missing #include files. Change 3419927 on 2017/05/02 by Joe.Barnes - Support custom LOD for shadow map generation only (r.ForceLODShadow) - New #define to expose forceLOD and forceLODShadow also in Test/Ship builds (#define EXPOSE_FORCE_LOD 1 in RenderCore.cpp). Not exposed by default. Change 3420964 on 2017/05/03 by Jonathan.Fitzpatrick Fixed null dereference of LineBatcher when using DrawDebugSphere and DrawDebugAltCone #jira UE-30213 Change 3423470 on 2017/05/04 by Luke.Thatcher [CONSOLE] [STREAMS] [^] Merging //UE4/Dev-Main (CL 3391974) to Dev-Console (//UE4/Dev-Console) - Compile errors in Switch, to be fixed after check-in. Change 3430410 on 2017/05/09 by Ben.Woodhouse Fix uninitialized local variable causing crashes in Test #jira UE-44832 Change 3430506 on 2017/05/09 by Josh.Adams - Fixed up the editor platforms' method of loading TargetSettings objects so that we don't need any manual parsing of .ini files to fill out the class defaults Change 3434035 on 2017/05/10 by Ben.Woodhouse Integrate updated FortGPUTestbed from Fortnite/Main Change 3437046 on 2017/05/12 by Joe.Barnes Fix for clang producing a warning when not all specializations of a templated function are marked FORCEINLINE. Also, switch a specialization of BlendTransform() from a function with a check to just a declaration so compiler will catch error instead of a runtime catch. Change 3437259 on 2017/05/12 by Joe.Barnes Fix for clang producing a warning when not all specializations of a templated function are marked FORCEINLINE. Also, switch a specialization of BlendTransform() from a function with a check to just a declaration so compiler will catch error instead of a runtime catch. Change 3440758 on 2017/05/16 by Ben.Woodhouse Simple threaded CSV Profiler To capture: - On the commandline, add -csvCaptureFrames=N to capture N frames from startup - On the console, use csvprofile start, csvprofile stop or csvprofile frames=N to capture a fixed number of frames - Instrument with CSV_SCOPED_STAT(statname), CSV_CUSTOM_STAT(statname,value). CSV capture is enabled in all builds except shipping - Please do not check in the instrumentation √ we don╞t want to pollute the engine with lots of additional instrumentation. We may add some minimal level of instrumentation at some point Change 3440954 on 2017/05/16 by Josh.Adams - Cleaned up some DeviceProfiles in BaseDP.ini Change 3443778 on 2017/05/17 by Ben.Woodhouse Aliasing for transient resources + new high level API Changelists integrated: 3368830 3368887 3377762 3377763 3379513 3381840 3382046 3382138 3385390 3385391 3385531 3396613 3388752 3396756 3397007 3397059 3397780 3397883 3401716 3415179 Change 3451460 on 2017/05/22 by Ben.Woodhouse Fix editor crash (NULL dereference of ScreenSpaceShadowTexture) when moving the camera around in tm-shadermodels, probably fallout from the VRAM aliasing merge. Not sure if this is the correct fix, but it prevents the crash for now Change 3451601 on 2017/05/22 by Josh.Adams - Track idle time from MaxTickRate, so that stat unit is accurate on Game: thread Change 3452025 on 2017/05/22 by Ben.Woodhouse Integrate (as edit) CL 3378734 (editor crash fix) Also add a check for null in LightFunctionRendering.cpp Change 3452389 on 2017/05/22 by Josh.Adams - Replaced POCulturePluralForms with a static array, instead of TMapBuilder (was blowing stack or similar on Switch Debug). Code courtesy of Jamie Dale. Change 3452758 on 2017/05/22 by Joe.Barnes Add FindFirstClearBit() and FindFirstSetBit() to TStaticBitArray. Change 3455889 on 2017/05/23 by Ben.Woodhouse Integrate from //UE4/Main/...@3453436 to //UE4/Dev-Console/... Change 3458654 on 2017/05/25 by Joe.Conley Attempting to fix Static Analysis warning. Change 3462710 on 2017/05/26 by Ben.Woodhouse Integrate from //UE4/Main/...@3461688 to //UE4/Dev-Console/... Change 3471711 on 2017/06/02 by Jonathan.Fitzpatrick Updating MallocProfiler to use the accessor for OnOutOfMemory delegate to conform with change made in CL 3415996. Change 3473813 on 2017/06/05 by Ben.Woodhouse Fix streaming visibility logic bug reported on UDN #jira UE-43892 Change 3475298 on 2017/06/06 by Luke.Thatcher [CONSOLE] [!] Fix RHITransitionResources crash with more than 16 textures. - Old command had a fixed sized array of 16 textures that would overflow. - New command allocates an array of texture pointers inline in the command list, so any number is supported. #jira UE-45625 Change 3476776 on 2017/06/06 by Ben.Woodhouse Integrate from //UE4/Main/...@3475908 Change 3479083 on 2017/06/07 by Ben.Woodhouse Integrate as edit CL 3467315 from dev-animphys: From Alexis Matte. Ensure SectionMap is fixed up for old entries that are no longer valid. #JIRA UE-45438 #jira UE-45735 Change 3480576 on 2017/06/08 by Ben.Woodhouse Integrate from //UE4/Main/...@3480024 to //UE4/Dev-Console/... [CL 3483258 by Luke Thatcher in Main branch]
2017-06-09 17:44:13 -04:00
{
check(TiledShadowRendering->TileSize == FShadowTileVS::GetTileSize());
auto VertexShader = View.ShaderMap->GetShader<FShadowTileVS>();
ClearUnusedGraphResources(VertexShader, &PassParameters->VS);
GraphBuilder.AddPass(
RDG_EVENT_NAME("TiledUpsample"),
PassParameters,
ERDGPassFlags::Raster,
[this, &View, VertexShader, PixelShader, ScissorRect, bProjectingForForwardShading, PassParameters, bForceRGBModulation](FRHICommandList& RHICmdList)
Add support for distance field shadow on water. Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture. DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console. DFShadow is naturaly skipped if the directional light does not have that feature enabled. When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p. The separated light buffer is an extra 8MB allocated when in deferred. This only works with deferred for now (forward does not run the reflection/composite pass). Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line. r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled. r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded). Follow up: tile upsample, tile traceshadow, make it work with strata. Tested shooter and console. #rb Tiago.Costa, Kevin.Ortegren #preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424 [CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -04:00
{
RHICmdList.SetViewport(ScissorRect.Min.X, ScissorRect.Min.Y, 0.0f, ScissorRect.Max.X, ScissorRect.Max.Y, 1.0f);
RHICmdList.SetScissorRect(true, ScissorRect.Min.X, ScissorRect.Min.Y, ScissorRect.Max.X, ScissorRect.Max.Y);
FGraphicsPipelineStateInitializer GraphicsPSOInit;
RHICmdList.ApplyCachedRenderTargets(GraphicsPSOInit);
GraphicsPSOInit.RasterizerState = TStaticRasterizerState<FM_Solid, CM_None>::GetRHI();
GraphicsPSOInit.DepthStencilState = TStaticDepthStencilState<false, CF_Always>::GetRHI();
if (bForceRGBModulation)
{
// This has the shadow contribution modulate all the channels, e.g. used for water rendering to apply distance field shadow on the main light RGB luminance for the updated depth buffer with water in it.
GraphicsPSOInit.BlendState = TStaticBlendState<CW_RGBA, BO_Add, BF_Zero, BF_SourceColor, BO_Add, BF_Zero, BF_One>::GetRHI();;
}
else
{
GraphicsPSOInit.BlendState = GetBlendStateForProjection(bProjectingForForwardShading, false);
}
GraphicsPSOInit.bDepthBounds = bDirectionalLight;
GraphicsPSOInit.PrimitiveType = GRHISupportsRectTopology ? PT_RectList : PT_TriangleList;
GraphicsPSOInit.BoundShaderState.VertexDeclarationRHI = GFilterVertexDeclaration.VertexDeclarationRHI;
GraphicsPSOInit.BoundShaderState.PixelShaderRHI = PixelShader.GetPixelShader();
GraphicsPSOInit.BoundShaderState.VertexShaderRHI = VertexShader.GetVertexShader();
SetGraphicsPipelineState(RHICmdList, GraphicsPSOInit, 0);
SetShaderParameters(RHICmdList, PixelShader, PixelShader.GetPixelShader(), PassParameters->PS);
SetShaderParameters(RHICmdList, VertexShader, VertexShader.GetVertexShader(), PassParameters->VS);
//@todo - depth bounds test for local lights
if (bDirectionalLight)
{
SetDepthBoundsTest(RHICmdList, CascadeSettings.SplitNear - CascadeSettings.SplitNearFadeRegion, CascadeSettings.SplitFar, View.ViewMatrices.GetProjectionMatrix());
}
PassParameters->IndirectDrawParameter->MarkResourceAsUsed();
RHICmdList.DrawPrimitiveIndirect(PassParameters->IndirectDrawParameter->GetIndirectRHICallBuffer(), 0);
RHICmdList.SetScissorRect(false, 0, 0, 0, 0);
});
}
else
{
GraphBuilder.AddPass(
RDG_EVENT_NAME("Upsample"),
PassParameters,
ERDGPassFlags::Raster,
[this, &View, PixelShader, ScissorRect, bProjectingForForwardShading, PassParameters, bForceRGBModulation](FRHICommandList& RHICmdList)
Add support for distance field shadow on water. Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture. DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console. DFShadow is naturaly skipped if the directional light does not have that feature enabled. When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p. The separated light buffer is an extra 8MB allocated when in deferred. This only works with deferred for now (forward does not run the reflection/composite pass). Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line. r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled. r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded). Follow up: tile upsample, tile traceshadow, make it work with strata. Tested shooter and console. #rb Tiago.Costa, Kevin.Ortegren #preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424 [CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -04:00
{
RHICmdList.SetViewport(ScissorRect.Min.X, ScissorRect.Min.Y, 0.0f, ScissorRect.Max.X, ScissorRect.Max.Y, 1.0f);
RHICmdList.SetScissorRect(true, ScissorRect.Min.X, ScissorRect.Min.Y, ScissorRect.Max.X, ScissorRect.Max.Y);
FGraphicsPipelineStateInitializer GraphicsPSOInit;
FPixelShaderUtils::InitFullscreenPipelineState(RHICmdList, View.ShaderMap, PixelShader, GraphicsPSOInit);
if (bForceRGBModulation)
{
// This has the shadow contribution modulate all the channels, e.g. used for water rendering to apply distance field shadow on the main light RGB luminance for the updated depth buffer with water in it.
GraphicsPSOInit.BlendState = TStaticBlendState<CW_RGBA, BO_Add, BF_Zero, BF_SourceColor, BO_Add, BF_Zero, BF_One>::GetRHI();;
}
else
{
GraphicsPSOInit.BlendState = GetBlendStateForProjection(bProjectingForForwardShading, false);
}
GraphicsPSOInit.bDepthBounds = bDirectionalLight;
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3304653) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3288774 on 2017/02/06 by Ben.Salem Added in min/max/avg values to table. Allow us to also set which stat groups we use explicitly to massively cut down on plugin overhead. #tests Several tests passes taken on ShooterGame. Change 3289887 on 2017/02/07 by David.Hill Eye Adaptation: Fix basic mode. The last step of the basic eye adaptation needs to know the correct down-sampled viewport size #jira: UE-29491 Change 3290281 on 2017/02/07 by Chris.Bunner Account for LogToLin approximation value offseting. Change 3290282 on 2017/02/07 by Chris.Bunner Fixed missing 2000 nit branch in tonemapper. Change 3290331 on 2017/02/07 by Chris.Bunner Minor optimization for BlendMaterialAttributes node compilation. Change 3291140 on 2017/02/07 by Daniel.Wright Fixed distance field temporal filter using Point filtering * Fixed the manual bilinear filter in the high quality reprojection path, still doesn't solve the streaking artifacts though Change 3292060 on 2017/02/08 by Rolando.Caloca DR - Some enums for max/num bits on RHI definitions Change 3292213 on 2017/02/08 by Benjamin.Hyder Updating TM-DistanceFields map in QAGame Change 3292291 on 2017/02/08 by Benjamin.Hyder small tweaks to TM-DistanceFields Change 3292399 on 2017/02/08 by Chris.Bunner Minor fix to HDR format type check. Change 3293560 on 2017/02/08 by Rolando.Caloca DR - vk - Events Change 3293562 on 2017/02/08 by Rolando.Caloca DR - vk - Disambiguate class name Change 3295346 on 2017/02/09 by Rolando.Caloca DR - Duplicate fix from 3295320 Change 3296930 on 2017/02/10 by Chris.Bunner Search keywords for pre-skinned position/normal nodes. Change 3297162 on 2017/02/10 by Daniel.Wright Distance field temporal filter stores a confidence value, which is used to track leaking of occlusion during the upsample, and flush those leaked values through the history faster. Reduces DFAO ghosting when the camera is moving. Change 3297345 on 2017/02/10 by Daniel.Wright Added 'r.CompressMeshDistanceFields' to rendering project settings, defaults to off to prevent hitches when streaming in levels Change 3297371 on 2017/02/10 by Chris.Bunner Custom vertex interpolator in/out node with auto-packing - Function support. Unified UV/CVI interpolator arrays for mixed custom UV support. Change 3298013 on 2017/02/10 by Daniel.Wright Ray Traced Distance Field shadowing is overlapped with the shadow depth pass, controlled by r.DFShadowAsyncCompute. * Didn't save any GPU time on PS4, so currently disabled until further investigation. * This change breaks RTDF shadows in splitscreen / stereo Change 3300028 on 2017/02/13 by Ben.Salem Adding GPU/Render/Game thread timers by default. Remove pointless flavor whitelisting on the plugin. Add sample usage in ShooterGame.ini config. #tests Ran half a dozen perf passes, and preflighted my changes in EC Change 3301571 on 2017/02/14 by Joe.Graf Deleted this plugin since it is no longer needed as an example Change 3301882 on 2017/02/14 by Daniel.Wright Fixed DistanceFieldAOConfidenceHistoryRT not getting released on RT Change 3304283 on 2017/02/15 by Daniel.Wright Variable shadowing fix Change 3304653 on 2017/02/15 by Ben.Salem Fix thread safety issues in Performance Monitor - deal with floating point bug in determining when to record frames. #tests Preflighted changes several times, ran several runs on Showdown [CL 3307957 by Marcus Wassmer in Main branch]
2017-02-16 17:52:21 -05:00
GraphicsPSOInit.BoundShaderState.PixelShaderRHI = PixelShader.GetPixelShader();
SetGraphicsPipelineState(RHICmdList, GraphicsPSOInit, 0);
SetShaderParameters(RHICmdList, PixelShader, PixelShader.GetPixelShader(), PassParameters->PS);
//@todo - depth bounds test for local lights
if (bDirectionalLight)
{
SetDepthBoundsTest(RHICmdList, CascadeSettings.SplitNear - CascadeSettings.SplitNearFadeRegion, CascadeSettings.SplitFar, View.ViewMatrices.GetProjectionMatrix());
}
FPixelShaderUtils::DrawFullscreenTriangle(RHICmdList);
RHICmdList.SetScissorRect(false, 0, 0, 0, 0);
});
}
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3304653) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3288774 on 2017/02/06 by Ben.Salem Added in min/max/avg values to table. Allow us to also set which stat groups we use explicitly to massively cut down on plugin overhead. #tests Several tests passes taken on ShooterGame. Change 3289887 on 2017/02/07 by David.Hill Eye Adaptation: Fix basic mode. The last step of the basic eye adaptation needs to know the correct down-sampled viewport size #jira: UE-29491 Change 3290281 on 2017/02/07 by Chris.Bunner Account for LogToLin approximation value offseting. Change 3290282 on 2017/02/07 by Chris.Bunner Fixed missing 2000 nit branch in tonemapper. Change 3290331 on 2017/02/07 by Chris.Bunner Minor optimization for BlendMaterialAttributes node compilation. Change 3291140 on 2017/02/07 by Daniel.Wright Fixed distance field temporal filter using Point filtering * Fixed the manual bilinear filter in the high quality reprojection path, still doesn't solve the streaking artifacts though Change 3292060 on 2017/02/08 by Rolando.Caloca DR - Some enums for max/num bits on RHI definitions Change 3292213 on 2017/02/08 by Benjamin.Hyder Updating TM-DistanceFields map in QAGame Change 3292291 on 2017/02/08 by Benjamin.Hyder small tweaks to TM-DistanceFields Change 3292399 on 2017/02/08 by Chris.Bunner Minor fix to HDR format type check. Change 3293560 on 2017/02/08 by Rolando.Caloca DR - vk - Events Change 3293562 on 2017/02/08 by Rolando.Caloca DR - vk - Disambiguate class name Change 3295346 on 2017/02/09 by Rolando.Caloca DR - Duplicate fix from 3295320 Change 3296930 on 2017/02/10 by Chris.Bunner Search keywords for pre-skinned position/normal nodes. Change 3297162 on 2017/02/10 by Daniel.Wright Distance field temporal filter stores a confidence value, which is used to track leaking of occlusion during the upsample, and flush those leaked values through the history faster. Reduces DFAO ghosting when the camera is moving. Change 3297345 on 2017/02/10 by Daniel.Wright Added 'r.CompressMeshDistanceFields' to rendering project settings, defaults to off to prevent hitches when streaming in levels Change 3297371 on 2017/02/10 by Chris.Bunner Custom vertex interpolator in/out node with auto-packing - Function support. Unified UV/CVI interpolator arrays for mixed custom UV support. Change 3298013 on 2017/02/10 by Daniel.Wright Ray Traced Distance Field shadowing is overlapped with the shadow depth pass, controlled by r.DFShadowAsyncCompute. * Didn't save any GPU time on PS4, so currently disabled until further investigation. * This change breaks RTDF shadows in splitscreen / stereo Change 3300028 on 2017/02/13 by Ben.Salem Adding GPU/Render/Game thread timers by default. Remove pointless flavor whitelisting on the plugin. Add sample usage in ShooterGame.ini config. #tests Ran half a dozen perf passes, and preflighted my changes in EC Change 3301571 on 2017/02/14 by Joe.Graf Deleted this plugin since it is no longer needed as an example Change 3301882 on 2017/02/14 by Daniel.Wright Fixed DistanceFieldAOConfidenceHistoryRT not getting released on RT Change 3304283 on 2017/02/15 by Daniel.Wright Variable shadowing fix Change 3304653 on 2017/02/15 by Ben.Salem Fix thread safety issues in Performance Monitor - deal with floating point bug in determining when to record frames. #tests Preflighted changes several times, ran several runs on Showdown [CL 3307957 by Marcus Wassmer in Main branch]
2017-02-16 17:52:21 -05:00
}
}