2019-12-26 14:45:42 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "PostProcess/PostProcessVisualizeBuffer.h"
|
2019-10-01 13:03:04 -04:00
|
|
|
#include "HighResScreenshot.h"
|
|
|
|
|
#include "PostProcessMaterial.h"
|
|
|
|
|
#include "PostProcessDownsample.h"
|
|
|
|
|
#include "ImagePixelData.h"
|
|
|
|
|
#include "ImageWriteStream.h"
|
|
|
|
|
#include "ImageWriteTask.h"
|
|
|
|
|
#include "ImageWriteQueue.h"
|
|
|
|
|
#include "HighResScreenshot.h"
|
2019-12-19 18:07:47 -05:00
|
|
|
#include "BufferVisualizationData.h"
|
2020-09-24 00:43:27 -04:00
|
|
|
#include "UnrealEngine.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
class FVisualizeBufferPS : public FGlobalShader
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2019-10-01 13:03:04 -04:00
|
|
|
public:
|
|
|
|
|
DECLARE_GLOBAL_SHADER(FVisualizeBufferPS);
|
|
|
|
|
SHADER_USE_PARAMETER_STRUCT(FVisualizeBufferPS, FGlobalShader);
|
|
|
|
|
|
|
|
|
|
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
|
|
|
|
|
SHADER_PARAMETER_STRUCT(FScreenPassTextureViewportParameters, Output)
|
|
|
|
|
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, InputTexture)
|
|
|
|
|
SHADER_PARAMETER_SAMPLER(SamplerState, InputSampler)
|
|
|
|
|
SHADER_PARAMETER(FLinearColor, SelectionColor)
|
|
|
|
|
RENDER_TARGET_BINDING_SLOTS()
|
|
|
|
|
END_SHADER_PARAMETER_STRUCT()
|
2014-03-14 14:13:41 -04:00
|
|
|
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3809756)
#rb None
#lockdown Nick.Penwarden
============================
MAJOR FEATURES & CHANGES
============================
Change 3629223 by Rolando.Caloca
DR - Rollback //UE4/Dev-Rendering/Engine/Source/Runtime/VulkanRHI to changelist 3627847
Change 3629708 by Rolando.Caloca
DR - vk - Redo some changes from DevMobile
3601439
3604186
3606672
3617383
3617474
3617483
Change 3761370 by Arne.Schober
DR - Added CityHash to use with conatiners and stuff. It provides good performance and high quallity across multiple platforms.
Change 3761437 by Guillaume.Abadie
Optimises motion blur compute shader for consoles.
Change 3761483 by Guillaume.Abadie
Fixes D3D11 RHI lying to dynamic resolution heuristic with t.MaxFPS.
Change 3761995 by Mark.Satterthwaite
Add the Metal compiler path to the local .pch filename to avoid problems when Xcode moves.
Change 3761996 by Mark.Satterthwaite
Emit more details when a pixel shader is found to have no outputs at all which Metal doesn't permit. More likely this is a bug in the shader compiler not configuring the in-out mask correctly...
#jira UE-52292
Change 3761999 by Mark.Satterthwaite
No need to avoid tessellation for FMetalRHICommandContext::RHIEndDrawIndexedPrimitiveUP anymore - that was from back when the tessellation logic was replicated in each RHI*Draw* implementation.
#jira UE-51937
Change 3762181 by Joe.Graf
Changed MaxShaderJobBatchSize to 25 on Mac as it reduced shader compile time by 21%
Change 3762607 by Mark.Satterthwaite
Remove accidentally included changes from 3761995.
Change 3762612 by Mark.Satterthwaite
Enable the explicit sincos intrinsic for Metal to avoid instances of UE-52477 that can cause shaders to compile incorrectly through hlslcc.
#jira UE-52477
Change 3762772 by Michael.Lentine
Move RHI calls to render thread.
Change 3763021 by Richard.Wallis
Remove shader cache tool project and implementation.
#jira UE-51613
Change 3763082 by Guillaume.Abadie
More SceneTexture, SceneColor and SceneDepth automated tests
Change 3763111 by Richard.Wallis
Clone of CL 3763033 (Release-4.18):
Fix for crash upon launching packaged game on Mac with Share Material Shader Code enabled.
#jira UE-52121
Change 3763657 by Michael.Lentine
Invalidate ddc for skeletal mesh render data so that the duplicated vertex render structures are properly serialized.
Change 3763727 by Jian.Ru
Fix Player Collision view mode. It is caused by checking an uninitialized vertex buffer so the check always fail.
#jira UE-52052
Change 3763738 by Guillaume.Abadie
Implements SSR input post process material location.
Change 3764271 by Mark.Satterthwaite
Allow ControlPointPatch lists to flow through MetalRHI as it was setup to handle this transparently - the VSHS compute shader will convert them to triangles to draw. Report the same warning as in the pipeline creation stage as this hasn't been formally validated.
#jira UE-52454
Change 3764316 by Daniel.Wright
Added AVolumetricLightmapDensityVolume - gives local control over Volumetric Lightmap density. Dropping the top mip outside of the play area in Monolith saves 20Mb (35Mb original).
Volumetric Lightmap no longer refines around static translucent geometry - saves 5Mb in Monolith
Reworked brick culling by error mechanism. Now compares error to interpolated parent lighting instead of the brick average - prevents dropping constant value bricks which are near a wall and cause leaking due to parent interpolation after being culled.
Change 3764318 by Daniel.Wright
Missing file
Change 3764321 by Daniel.Wright
Shader compiling memory optimizations
* Editor memory: Sharing uniform buffer includes and GeneratedInstancedStereo.ush per FShaderType (was previously duplicated per FShader job)
* SCW input size: Sharing uniform buffer includes and SharedEnvironment per batch
* 7.6Gb of shader job inputs in memory -> .5Gb (13x less) when doing a full shader compile of Paragon Editor
* 13.8Gb written into worker input files -> 2.9Gb (4.7x less). Global shaders are never batched when sent to SCW so unoptimized by these changes.
Change 3764595 by Daniel.Wright
Added VolumetricLightmapDensityVolume asset icons
Change 3764701 by Michael.Lentine
Add duplicated vertices merging for meshmerge.
Change 3766002 by Guillaume.Abadie
Fixes a crash in translucency.
Change 3766007 by Guillaume.Abadie
Oups.... Fixes compilation failure.
Change 3766697 by Guillaume.Abadie
Giant refactor of global shader interface for upcoming native support of permutation.
CL generated by python script.
Change 3767205 by Chris.Bunner
Deferring FMaterial::RenderingThreadShaderMap update to render-thread rather than assumption commands have been flushed.
#jira UE-50652
Change 3767207 by Chris.Bunner
Clamp fetched texture coordinates to those available on the mesh.
Change 3767209 by Chris.Bunner
PR #4203: Early-outs in UMaterialInstance parameter setters (Contributed by stefanzimecki)
#jira UE-52193
Change 3767772 by Mark.Satterthwaite
MetalShaderFormat will no longer fallback to text shaders when you ask it to compile to bytecode but the bytecode compiler is not available (either locally or remotely) - this ensures that the DDC can't be poisoned by incorrectly configured clients. The Editor is already setup such that if the remote shader compiler is not configured & Xcode is not available locally the shader-compiler will be invoked to generate text shaders.
#jira UE-52554
Change 3768604 by Guillaume.Abadie
Polish up with new global shader function signature.
Change 3768993 by Guillaume.Abadie
Fixes r.Upscale.Panini cvars
Change 3769478 by Mark.Satterthwaite
Move the ue4_stdlib.metal & PCH into a temporary directory that exists for the lifetime of the SCW on the remote side as well as the local one and add this path as an include directory.
#jira UE-52587
Change 3769703 by Mark.Satterthwaite
For all Metal platforms >= Metal v1.2 transform mul(a,b) into fma(a,b,0) to prevent the Apple compiler reordering operations differently between the base & depth passes which results in variance in the position output.
For iOS disable fast-math when the vertex-shader uses World-Position-Offset because there are additional problems on the iOS shader compiler that result in position variance even with the above fix - WPO performance will suffer but I don't have any alternatives.
Remove the depth-offset hack from the depth-only vertex shader again.
#jira UES-5651
Change 3769763 by Mark.Satterthwaite
Handle swizzle's in the hlslcc fma identification pass so that we reduce the number of instructions and the platform compiler can't break the instructions up.
Change 3769849 by Mark.Satterthwaite
Fix CIS error.
Change 3770517 by Richard.Wallis
Fix for crash when creating a new media texture (AppleIntelHD5000GraphicsMTLDriver!SamplerStage::bindSamplerToTexture()). Missing texture resource for binding. Old InitDynamicRHI() code has been refactored out into seperate functions which leaves us on Mac with a NULL resource initially after creation which Metal doesn't like. This fix puts InitDynamicRHI down the default setup/clear path which inits default resources - I don't think we should use a global dummy in this instance as this is a render target.
#jira UE-51940
Change 3770688 by Uriel.Doyon
Fixed texture resolution returning 0 when running blueprint construction scripts at cook time.
Change 3771115 by Mark.Satterthwaite
Report errors from failed attempts to compile global shaders or we can't see why things fail on non-Windows platforms.
Change 3771263 by Mark.Satterthwaite
Change the way ManualVertexFetch is enabled on Metal platforms so that it is enabled when targeting Metal v1.2 and higher (macOS 10.12+/iOS 10+). This brings iOS in the Desktop Forward renderer back into line with the Mac.
#jira UERNDR-300
Change 3773472 by Guillaume.Abadie
Fixes a crash on PIE of SimpleComposure project.
Change 3773475 by Guillaume.Abadie
Fixes bug in editor viewport caused by SSR input changes.
Change 3774677 by Arne.Schober
DR - Deprecated SetLocal from the RHICmdlist
Fixed some unnecessary PSO collisions.
Change 3777037 by Mark.Satterthwaite
Remove incorrect change that caused a reference to "accurate::sincos" to appear in some Metal shaders rather than "precise::sincos".
Change 3777122 by Mark.Satterthwaite
Back out changelist 3777037 - I'm blind and wasn't seeing the real problem was a stale shader cache...
Change 3777196 by Mark.Satterthwaite
Fix text-shader compilation on iOS 10 - maybe iOS 9 too (untested!).
We need our own make_scalar type-trait template for ue4_stdlib.metal so that we still compile with older iOS runtime compilers and we can't use as_type to directly implement the packHalf2x16/unpackHalf2x16 intrinsics for these older runtime compilers either.
Change 3779098 by Rolando.Caloca
DR - vk - Fix query index
Change 3779275 by Mark.Satterthwaite
Silence the Metal runtime compiler warning caused by use of a deprecated enum value when running text shaders compiled for Metal v1.0/1.1 on a Metal v1.2+ OS.
#jira UE-52554
Change 3779427 by Rolando.Caloca
DR - vk - Fix for allocator contention
Change 3779608 by Uriel.Doyon
Fixed invalid access in the resave package commantlet when building texture streaming material data for materials enabling tesselation.
Change 3784496 by Mark.Satterthwaite
Temporarily disable USE_OBJECT_COMPOSITING_TILE_CULLING for Metal shader compilation only - other platforms are unaffected - as it isn't working properly for some reason. need to work out what's up but don't want Distance Fields to be completely snookered in the interim.
#jira UE-52952
Change 3784608 by Rolando.Caloca
DR - Copy 3784588
- Fix for drivers returning out of date swapchains during resizes
Change 3784734 by Mark.Satterthwaite
Real fix for UE-52952 - MetalShaderFormat wasn't propagating the full thread-group value.
#jira UE-52952
Change 3784741 by Mark.Satterthwaite
More Metal debugging commandline options "-metalfastmath" & "-metalnofastmath" to force fast-math on or off for all shaders, must be using runtime-compiled shaders (i.e. -metalshaderdebug or r.Shaders.Optimise=0) to take effect.
Change 3787103 by Guillaume.Abadie
Kills BuiltinSamplers UB
Change 3787207 by Guillaume.Abadie
Sorry, compile fix that were fine with local changes...
Change 3787396 by Marcus.Wassmer
PR #4271: UE-52901: Set VIS_Max meta to hidden (Contributed by projectgheist)
Change 3788028 by Peter.Sumanaseni
Working linear HDR exr output from sequencer
Change 3788536 by Mark.Satterthwaite
Track whether the Metal shader uses the discard_fragment function as when this is used but without any other outputs we know we need to bind at least one render-target or a depth-stencil surface but we don't know which. This lets us correctly error when we encounter a shader with no outputs at all which Metal doesn't permit.
#jira UE-52292
Change 3788538 by Mark.Satterthwaite
Let's try mitigating UE-46604 on Nvidia by retaining resource references in the command-buffer. This shouldn't be necessary and isn't typically on other vendors but we haven't been able to reproduce this reliably enough to get to the bottom of it.
#jira UE-46604
Change 3789083 by Guillaume.Abadie
Implements global shader permutations. Example in ScreenSpaceReflections.cpp.
Change 3789090 by Guillaume.Abadie
Fixes linux build.
Change 3789106 by Guillaume.Abadie
Fixes compilation failure in niagara plugin.
Change 3789274 by Guillaume.Abadie
Avoid hit proxies to clobber TAA's hitsory.
#jira UE-52968
Change 3789380 by Guillaume.Abadie
Back out changelist 3789083: global shader permutation because compilation failure in clang.
Change 3789648 by Guillaume.Abadie
Relands global shader permutation, with clang support.
Change 3789712 by Guillaume.Abadie
Fixes TestImage show flag with TAAU on.
#jira UE-53061
Change 3791593 by Guillaume.Abadie
Reinvalidates shaders with shader permutations.
Change 3791884 by Daniel.Wright
Added BP setter for LowerHemisphereColor
Change 3791886 by Daniel.Wright
Added LightmapType to PrimitiveComponent
* ForceVolumetric allows forcing static geometry to use Volumetric Lightmaps, which can be useful on instanced foliage where seams are prevalent. Lightmass internal caching still requires lightmap UVs and reasonable lightmap resolution.
* ForceSurface replaces bLightAsIfStatic
Improvements to Volumetric Lightmap quality needed for static geometry
* Stationary light shadowing is now dilated inside geometry
* Now doing two dilation passes since samples near geometry see inside due to ray start bias
* Refinement around geometry uses an expanded cell bounds when the geometry is going to use Volumetric Lightmaps, since cross-resolution stitching causes leaking
Lightmass debug primitives are now tied to a swarm task instead of global - allows debugging of Volumetric Lightmap tasks
Change 3792256 by Guillaume.Abadie
Fixes a bug where permutation was not actually serialised in FShader, so was ending up recompiling shader at every load.
Change 3792884 by Marcus.Wassmer
Copying //UE4/Partner-AMD to Dev-Rendering (//UE4/Dev-Rendering)
Change 3793200 by Marcus.Wassmer
Copying //UE4/Partner-IDV-SpeedTree to Dev-Rendering (//UE4/Dev-Rendering)
Speedtree 8 support
Change 3793206 by Brian.Karis
Added color grading control BlueCorrection to correct for artifacts with "electric" blues due to the ACEScg color space. Bright blue desaturates instead of going to violet.
Added color grading control ExpandGamut which expands bright saturated colors outside the sRGB gamut to fake wide gamut rendering.
ACES changes.
Change 3793344 by Marcus.Wassmer
Fix editortest compile
Change 3794285 by Guillaume.Abadie
Serializes PermutationId according to archive rendering version to avoid issues with old material that were serializing a shader map into UObject.
Change 3794307 by Guillaume.Abadie
Resaves uassets that were modified between 3789648 and 3794285
Change 3794627 by Mark.Satterthwaite
Implement two components for MTLPP, an IMP cache for Objective-C selector implementations & an interposition framework for those same selectors:
- imp_SelectorCache & friends provide the IMP caching for each of the Metal protocols which constitute most of the API, so far I've not covered the Metal classes used for the various descriptor/initializer types. Each type has its own IMPTable which caches the selector's implementation pointer and provides the mechanism to hook that implementation. As Objective-C is runtime dynamic this look up must be performed on the actual Class value returned by an object at runtime - you can't do this at compile time. Even things like NSString which appear compile-time static are really not as NSString is an alias for a class-cluster (NSString, NSMutableString, __NSInlineString and more).
- The interpose directory contains MTI* files which are the framework for interposing all the functions in Metal's runtime API - I deliberately omit the descriptor classes & read-only functions as there's no benefit to interposing them - which I can build off to create a trace tool or a superior validation layer. Right now this is Mac only as there'll be some problems to solve for iOS/tvOS due to difference in linking requirements - not insurmountable.
- Rebuild MTLPP's implementation of the C++ wrapper classes around the IMPTable's - this means we avoid all the objc_msgSend overhead for all the classes and functions whose implementations are cached. Right now the IMPTable is going to incur a look-up for all non-copy/move constructors which is suboptimal - ideally the Metal IMPTables would be cached in the Device object as they will be consistent within a single Device.
- Sort out the MTLPP availability logic - it now exports the availability warnings to the caller and internally just blithely assumes it may call the functions, the caller is responsible for ensuring that calls are made only on appropriate devices & OSes. This reduces MTLPP complexity and better fits how MetalRHI works.
- Fix a number of retain/release bugs that were lying dormant in MTLPP but exposed by the switch to IMPTables.
- Add tvOS support.
Next up, put this into MetalRHI and start fixing all the fallout.
Change 3794631 by Mark.Satterthwaite
Missed updating mtlpp's build.cs for TVOS.
Change 3794651 by Uriel.Doyon
UPointLightComponent::GetUnitsConversionFactor() now takes the cone angle as parameter. This allows to fix spotlight unit conversion when using lumens.
Change 3794720 by Guillaume.Abadie
Fixes a bug in Global{Bilinear,Trilinear}ClampedSampler that was actually doing a Point sampling.
Change 3794749 by Mark.Satterthwaite
Fix mtlpp.build.cs paths.
Change 3794856 by Mark.Satterthwaite
Fix some shadowing warnings.
Change 3795484 by Daniel.Wright
Implemented the Spherical Harmonic windowing algorithm from 'Stupid Spherical Harmonics (SH) Tricks'
New WorldSettings Lightmass property VolumetricLightmapSphericalHarmonicSmoothing controls the global amount of smoothing applied
Change 3795590 by Brian.Karis
Area light fixes
Fixed order of operations. This helps mixing of SourceRadius, SourceLength, and SoftSourceRadius.
Change 3796832 by Marcus.Wassmer
Correct shouldcache condition for new resolve shader
Change 3796884 by Marcus.Wassmer
Doing it right this time.
Change 3797196 by Mark.Satterthwaite
More updates to MTLPP to make things simpler and reduce the number of spurious Objective-C warnings that are emitted because of the way we are using the runtime.
Change 3797200 by Daniel.Wright
Lightmass now uses the highest density VolumetricLightmapDensityVolume settings that affect any part of a cell
Change 3797221 by Daniel.Wright
Reduced default SphericalHarmonicSmoothing based on RoboRecall tests. Now only active with strong direct lighting from static lights by default.
Change 3797411 by Brian.Karis
Disable ExpandGamut for old tone mapper.
Change 3797462 by Mark.Satterthwaite
More build warnings silenced after changing to the lowest possible deployment target OS for each library.
Change 3797585 by Mark.Satterthwaite
Range-based-For support in the NSArray wrapper.
Change 3797836 by Mark.Satterthwaite
Even more forward-declarations to avoid system headers poking through to the including code from mtlpp.
Change 3798027 by Mark.Satterthwaite
Fix handling of nil objects, on which no functions may be called, command-buffer retention and IMP declaration.
Change 3798154 by Mark.Satterthwaite
Fix some egregious memory leaks that rewriting to use mtlpp exposed before we carry on - don't want these slipping into 4.19.
Change 3800990 by Mark.Satterthwaite
Typedef all the completion-handler callback types in mtlpp to make future me's life easier.
Change 3801400 by Chris.Bunner
Improving automated test errors on failure to generate report data.
Change 3801726 by Mark.Satterthwaite
Correct some function availability and the command-buffer error status in mtlpp.
Change 3801808 by Chris.Bunner
Added DefaultScalability.ini to EngineTest that forces all quality levels to Engine default Epic for now to improve consistency.
Change 3801862 by Marcus.Wassmer
Update automated tests with color gamut change
Change 3802214 by Chris.Bunner
When running automated tests in and editor-locked PIE viewport, skip resizing as the editor can't handle this.
Added bindable delegate called when ScreenshotRequest is processed - Useful to allow screenshots to override and restore settings per capture.
#jira UE-53188
Change 3802243 by Chris.Bunner
Added button to automated test screenshot browser to add or replace all outstanding test reports if appropriate.
DeleteAllReports button is now only enabled whilst there are reports in the list.
Change 3802372 by Chris.Bunner
Updating more test screenshots.
Change 3803683 by Chris.Bunner
Adding more logging and multiple attempts to automated test report network save.
Added small wait on repeated operations that are known to fail.
Change 3803826 by Rolando.Caloca
DR - vk - Fix merge issue
Change 3804181 by Chris.Bunner
Tentative fix for CIS test failure.
Change 3804236 by Chris.Bunner
Additional logging for case where file write silently fails, report platform-specific error.
Change 3804303 by zachary.wilson
Cleaning up assets in QAGame saved with empty engine versions to resolve warnings seen when launching on
Change 3804410 by Chris.Bunner
Added additional logging when automated screenshot test fails due to size mismatch.
Mismatched bounds are colored red in the delta.
Change 3804455 by Mark.Satterthwaite
Fix a small number of persistent memory leaks on the Mac build that slowly consume more and more memory as you use the Editor - interacting with menu's was particularly egregious as each NSMenu would leak after you move away.
#jira NA
Change 3804667 by Chris.Bunner
Speculative CIS fixes.
Change 3806008 by Chris.Bunner
Partially reimplementing backed-out CL 3804181 to improve consistency of how automated screenshot test settings are applied/restored.
#tests CIS preflight job 8174412
Change 3806909 by Mark.Satterthwaite
Use the vertex-shader's in-out mask to ensure that we only validate legitmate vertex-streams in Metal's DrawIndexedPrimitive implementation.
#jira UE-53046
Change 3807059 by laz.matech
Checking in QAGame Rendering Map, QA-PhysicalLightingUnits, for testing Physical Light Units.
Wanted to get this in before copy up.
#Jira none
Change 3807726 by Chris.Bunner
Removed a check that we can't fix up. The check hits unbound buffers which it assumes means a failure but is actually due to m.v.fetch. We don't have the information available to know which are which removed from the input without reading from the shader.
#jira UE-53046
Change 3807800 by Guillaume.Abadie
Fixes some warning in shader headers.
Change 3807804 by Guillaume.Abadie
Back out changelist 3807800
Change 3807807 by Guillaume.Abadie
Relands shader header warnings.
Change 3808046 by Chris.Bunner
Dropping a new automated test error back to a warning as this may lead to genuine issues being ignored in the short term.
Change 3809579 by Chris.Bunner
Back out changelist 3774677.
#jira UE-53483
Change 3809620 by Chris.Bunner
Updating animated cloth test screenshot.
Change 3803629 by Chris.Bunner
Rebuilt CornellBox and DistanceField test maps, updated screenshots.
Change 3787045 by Guillaume.Abadie
Moves some global samplers to Common.ush
Change 3809756 by Chris.Bunner
Updating animated cloth test screenshot.
[CL 3809764 by Chris Bunner in Main branch]
2017-12-15 12:47:47 -05:00
|
|
|
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3809756)
#rb None
#lockdown Nick.Penwarden
============================
MAJOR FEATURES & CHANGES
============================
Change 3629223 by Rolando.Caloca
DR - Rollback //UE4/Dev-Rendering/Engine/Source/Runtime/VulkanRHI to changelist 3627847
Change 3629708 by Rolando.Caloca
DR - vk - Redo some changes from DevMobile
3601439
3604186
3606672
3617383
3617474
3617483
Change 3761370 by Arne.Schober
DR - Added CityHash to use with conatiners and stuff. It provides good performance and high quallity across multiple platforms.
Change 3761437 by Guillaume.Abadie
Optimises motion blur compute shader for consoles.
Change 3761483 by Guillaume.Abadie
Fixes D3D11 RHI lying to dynamic resolution heuristic with t.MaxFPS.
Change 3761995 by Mark.Satterthwaite
Add the Metal compiler path to the local .pch filename to avoid problems when Xcode moves.
Change 3761996 by Mark.Satterthwaite
Emit more details when a pixel shader is found to have no outputs at all which Metal doesn't permit. More likely this is a bug in the shader compiler not configuring the in-out mask correctly...
#jira UE-52292
Change 3761999 by Mark.Satterthwaite
No need to avoid tessellation for FMetalRHICommandContext::RHIEndDrawIndexedPrimitiveUP anymore - that was from back when the tessellation logic was replicated in each RHI*Draw* implementation.
#jira UE-51937
Change 3762181 by Joe.Graf
Changed MaxShaderJobBatchSize to 25 on Mac as it reduced shader compile time by 21%
Change 3762607 by Mark.Satterthwaite
Remove accidentally included changes from 3761995.
Change 3762612 by Mark.Satterthwaite
Enable the explicit sincos intrinsic for Metal to avoid instances of UE-52477 that can cause shaders to compile incorrectly through hlslcc.
#jira UE-52477
Change 3762772 by Michael.Lentine
Move RHI calls to render thread.
Change 3763021 by Richard.Wallis
Remove shader cache tool project and implementation.
#jira UE-51613
Change 3763082 by Guillaume.Abadie
More SceneTexture, SceneColor and SceneDepth automated tests
Change 3763111 by Richard.Wallis
Clone of CL 3763033 (Release-4.18):
Fix for crash upon launching packaged game on Mac with Share Material Shader Code enabled.
#jira UE-52121
Change 3763657 by Michael.Lentine
Invalidate ddc for skeletal mesh render data so that the duplicated vertex render structures are properly serialized.
Change 3763727 by Jian.Ru
Fix Player Collision view mode. It is caused by checking an uninitialized vertex buffer so the check always fail.
#jira UE-52052
Change 3763738 by Guillaume.Abadie
Implements SSR input post process material location.
Change 3764271 by Mark.Satterthwaite
Allow ControlPointPatch lists to flow through MetalRHI as it was setup to handle this transparently - the VSHS compute shader will convert them to triangles to draw. Report the same warning as in the pipeline creation stage as this hasn't been formally validated.
#jira UE-52454
Change 3764316 by Daniel.Wright
Added AVolumetricLightmapDensityVolume - gives local control over Volumetric Lightmap density. Dropping the top mip outside of the play area in Monolith saves 20Mb (35Mb original).
Volumetric Lightmap no longer refines around static translucent geometry - saves 5Mb in Monolith
Reworked brick culling by error mechanism. Now compares error to interpolated parent lighting instead of the brick average - prevents dropping constant value bricks which are near a wall and cause leaking due to parent interpolation after being culled.
Change 3764318 by Daniel.Wright
Missing file
Change 3764321 by Daniel.Wright
Shader compiling memory optimizations
* Editor memory: Sharing uniform buffer includes and GeneratedInstancedStereo.ush per FShaderType (was previously duplicated per FShader job)
* SCW input size: Sharing uniform buffer includes and SharedEnvironment per batch
* 7.6Gb of shader job inputs in memory -> .5Gb (13x less) when doing a full shader compile of Paragon Editor
* 13.8Gb written into worker input files -> 2.9Gb (4.7x less). Global shaders are never batched when sent to SCW so unoptimized by these changes.
Change 3764595 by Daniel.Wright
Added VolumetricLightmapDensityVolume asset icons
Change 3764701 by Michael.Lentine
Add duplicated vertices merging for meshmerge.
Change 3766002 by Guillaume.Abadie
Fixes a crash in translucency.
Change 3766007 by Guillaume.Abadie
Oups.... Fixes compilation failure.
Change 3766697 by Guillaume.Abadie
Giant refactor of global shader interface for upcoming native support of permutation.
CL generated by python script.
Change 3767205 by Chris.Bunner
Deferring FMaterial::RenderingThreadShaderMap update to render-thread rather than assumption commands have been flushed.
#jira UE-50652
Change 3767207 by Chris.Bunner
Clamp fetched texture coordinates to those available on the mesh.
Change 3767209 by Chris.Bunner
PR #4203: Early-outs in UMaterialInstance parameter setters (Contributed by stefanzimecki)
#jira UE-52193
Change 3767772 by Mark.Satterthwaite
MetalShaderFormat will no longer fallback to text shaders when you ask it to compile to bytecode but the bytecode compiler is not available (either locally or remotely) - this ensures that the DDC can't be poisoned by incorrectly configured clients. The Editor is already setup such that if the remote shader compiler is not configured & Xcode is not available locally the shader-compiler will be invoked to generate text shaders.
#jira UE-52554
Change 3768604 by Guillaume.Abadie
Polish up with new global shader function signature.
Change 3768993 by Guillaume.Abadie
Fixes r.Upscale.Panini cvars
Change 3769478 by Mark.Satterthwaite
Move the ue4_stdlib.metal & PCH into a temporary directory that exists for the lifetime of the SCW on the remote side as well as the local one and add this path as an include directory.
#jira UE-52587
Change 3769703 by Mark.Satterthwaite
For all Metal platforms >= Metal v1.2 transform mul(a,b) into fma(a,b,0) to prevent the Apple compiler reordering operations differently between the base & depth passes which results in variance in the position output.
For iOS disable fast-math when the vertex-shader uses World-Position-Offset because there are additional problems on the iOS shader compiler that result in position variance even with the above fix - WPO performance will suffer but I don't have any alternatives.
Remove the depth-offset hack from the depth-only vertex shader again.
#jira UES-5651
Change 3769763 by Mark.Satterthwaite
Handle swizzle's in the hlslcc fma identification pass so that we reduce the number of instructions and the platform compiler can't break the instructions up.
Change 3769849 by Mark.Satterthwaite
Fix CIS error.
Change 3770517 by Richard.Wallis
Fix for crash when creating a new media texture (AppleIntelHD5000GraphicsMTLDriver!SamplerStage::bindSamplerToTexture()). Missing texture resource for binding. Old InitDynamicRHI() code has been refactored out into seperate functions which leaves us on Mac with a NULL resource initially after creation which Metal doesn't like. This fix puts InitDynamicRHI down the default setup/clear path which inits default resources - I don't think we should use a global dummy in this instance as this is a render target.
#jira UE-51940
Change 3770688 by Uriel.Doyon
Fixed texture resolution returning 0 when running blueprint construction scripts at cook time.
Change 3771115 by Mark.Satterthwaite
Report errors from failed attempts to compile global shaders or we can't see why things fail on non-Windows platforms.
Change 3771263 by Mark.Satterthwaite
Change the way ManualVertexFetch is enabled on Metal platforms so that it is enabled when targeting Metal v1.2 and higher (macOS 10.12+/iOS 10+). This brings iOS in the Desktop Forward renderer back into line with the Mac.
#jira UERNDR-300
Change 3773472 by Guillaume.Abadie
Fixes a crash on PIE of SimpleComposure project.
Change 3773475 by Guillaume.Abadie
Fixes bug in editor viewport caused by SSR input changes.
Change 3774677 by Arne.Schober
DR - Deprecated SetLocal from the RHICmdlist
Fixed some unnecessary PSO collisions.
Change 3777037 by Mark.Satterthwaite
Remove incorrect change that caused a reference to "accurate::sincos" to appear in some Metal shaders rather than "precise::sincos".
Change 3777122 by Mark.Satterthwaite
Back out changelist 3777037 - I'm blind and wasn't seeing the real problem was a stale shader cache...
Change 3777196 by Mark.Satterthwaite
Fix text-shader compilation on iOS 10 - maybe iOS 9 too (untested!).
We need our own make_scalar type-trait template for ue4_stdlib.metal so that we still compile with older iOS runtime compilers and we can't use as_type to directly implement the packHalf2x16/unpackHalf2x16 intrinsics for these older runtime compilers either.
Change 3779098 by Rolando.Caloca
DR - vk - Fix query index
Change 3779275 by Mark.Satterthwaite
Silence the Metal runtime compiler warning caused by use of a deprecated enum value when running text shaders compiled for Metal v1.0/1.1 on a Metal v1.2+ OS.
#jira UE-52554
Change 3779427 by Rolando.Caloca
DR - vk - Fix for allocator contention
Change 3779608 by Uriel.Doyon
Fixed invalid access in the resave package commantlet when building texture streaming material data for materials enabling tesselation.
Change 3784496 by Mark.Satterthwaite
Temporarily disable USE_OBJECT_COMPOSITING_TILE_CULLING for Metal shader compilation only - other platforms are unaffected - as it isn't working properly for some reason. need to work out what's up but don't want Distance Fields to be completely snookered in the interim.
#jira UE-52952
Change 3784608 by Rolando.Caloca
DR - Copy 3784588
- Fix for drivers returning out of date swapchains during resizes
Change 3784734 by Mark.Satterthwaite
Real fix for UE-52952 - MetalShaderFormat wasn't propagating the full thread-group value.
#jira UE-52952
Change 3784741 by Mark.Satterthwaite
More Metal debugging commandline options "-metalfastmath" & "-metalnofastmath" to force fast-math on or off for all shaders, must be using runtime-compiled shaders (i.e. -metalshaderdebug or r.Shaders.Optimise=0) to take effect.
Change 3787103 by Guillaume.Abadie
Kills BuiltinSamplers UB
Change 3787207 by Guillaume.Abadie
Sorry, compile fix that were fine with local changes...
Change 3787396 by Marcus.Wassmer
PR #4271: UE-52901: Set VIS_Max meta to hidden (Contributed by projectgheist)
Change 3788028 by Peter.Sumanaseni
Working linear HDR exr output from sequencer
Change 3788536 by Mark.Satterthwaite
Track whether the Metal shader uses the discard_fragment function as when this is used but without any other outputs we know we need to bind at least one render-target or a depth-stencil surface but we don't know which. This lets us correctly error when we encounter a shader with no outputs at all which Metal doesn't permit.
#jira UE-52292
Change 3788538 by Mark.Satterthwaite
Let's try mitigating UE-46604 on Nvidia by retaining resource references in the command-buffer. This shouldn't be necessary and isn't typically on other vendors but we haven't been able to reproduce this reliably enough to get to the bottom of it.
#jira UE-46604
Change 3789083 by Guillaume.Abadie
Implements global shader permutations. Example in ScreenSpaceReflections.cpp.
Change 3789090 by Guillaume.Abadie
Fixes linux build.
Change 3789106 by Guillaume.Abadie
Fixes compilation failure in niagara plugin.
Change 3789274 by Guillaume.Abadie
Avoid hit proxies to clobber TAA's hitsory.
#jira UE-52968
Change 3789380 by Guillaume.Abadie
Back out changelist 3789083: global shader permutation because compilation failure in clang.
Change 3789648 by Guillaume.Abadie
Relands global shader permutation, with clang support.
Change 3789712 by Guillaume.Abadie
Fixes TestImage show flag with TAAU on.
#jira UE-53061
Change 3791593 by Guillaume.Abadie
Reinvalidates shaders with shader permutations.
Change 3791884 by Daniel.Wright
Added BP setter for LowerHemisphereColor
Change 3791886 by Daniel.Wright
Added LightmapType to PrimitiveComponent
* ForceVolumetric allows forcing static geometry to use Volumetric Lightmaps, which can be useful on instanced foliage where seams are prevalent. Lightmass internal caching still requires lightmap UVs and reasonable lightmap resolution.
* ForceSurface replaces bLightAsIfStatic
Improvements to Volumetric Lightmap quality needed for static geometry
* Stationary light shadowing is now dilated inside geometry
* Now doing two dilation passes since samples near geometry see inside due to ray start bias
* Refinement around geometry uses an expanded cell bounds when the geometry is going to use Volumetric Lightmaps, since cross-resolution stitching causes leaking
Lightmass debug primitives are now tied to a swarm task instead of global - allows debugging of Volumetric Lightmap tasks
Change 3792256 by Guillaume.Abadie
Fixes a bug where permutation was not actually serialised in FShader, so was ending up recompiling shader at every load.
Change 3792884 by Marcus.Wassmer
Copying //UE4/Partner-AMD to Dev-Rendering (//UE4/Dev-Rendering)
Change 3793200 by Marcus.Wassmer
Copying //UE4/Partner-IDV-SpeedTree to Dev-Rendering (//UE4/Dev-Rendering)
Speedtree 8 support
Change 3793206 by Brian.Karis
Added color grading control BlueCorrection to correct for artifacts with "electric" blues due to the ACEScg color space. Bright blue desaturates instead of going to violet.
Added color grading control ExpandGamut which expands bright saturated colors outside the sRGB gamut to fake wide gamut rendering.
ACES changes.
Change 3793344 by Marcus.Wassmer
Fix editortest compile
Change 3794285 by Guillaume.Abadie
Serializes PermutationId according to archive rendering version to avoid issues with old material that were serializing a shader map into UObject.
Change 3794307 by Guillaume.Abadie
Resaves uassets that were modified between 3789648 and 3794285
Change 3794627 by Mark.Satterthwaite
Implement two components for MTLPP, an IMP cache for Objective-C selector implementations & an interposition framework for those same selectors:
- imp_SelectorCache & friends provide the IMP caching for each of the Metal protocols which constitute most of the API, so far I've not covered the Metal classes used for the various descriptor/initializer types. Each type has its own IMPTable which caches the selector's implementation pointer and provides the mechanism to hook that implementation. As Objective-C is runtime dynamic this look up must be performed on the actual Class value returned by an object at runtime - you can't do this at compile time. Even things like NSString which appear compile-time static are really not as NSString is an alias for a class-cluster (NSString, NSMutableString, __NSInlineString and more).
- The interpose directory contains MTI* files which are the framework for interposing all the functions in Metal's runtime API - I deliberately omit the descriptor classes & read-only functions as there's no benefit to interposing them - which I can build off to create a trace tool or a superior validation layer. Right now this is Mac only as there'll be some problems to solve for iOS/tvOS due to difference in linking requirements - not insurmountable.
- Rebuild MTLPP's implementation of the C++ wrapper classes around the IMPTable's - this means we avoid all the objc_msgSend overhead for all the classes and functions whose implementations are cached. Right now the IMPTable is going to incur a look-up for all non-copy/move constructors which is suboptimal - ideally the Metal IMPTables would be cached in the Device object as they will be consistent within a single Device.
- Sort out the MTLPP availability logic - it now exports the availability warnings to the caller and internally just blithely assumes it may call the functions, the caller is responsible for ensuring that calls are made only on appropriate devices & OSes. This reduces MTLPP complexity and better fits how MetalRHI works.
- Fix a number of retain/release bugs that were lying dormant in MTLPP but exposed by the switch to IMPTables.
- Add tvOS support.
Next up, put this into MetalRHI and start fixing all the fallout.
Change 3794631 by Mark.Satterthwaite
Missed updating mtlpp's build.cs for TVOS.
Change 3794651 by Uriel.Doyon
UPointLightComponent::GetUnitsConversionFactor() now takes the cone angle as parameter. This allows to fix spotlight unit conversion when using lumens.
Change 3794720 by Guillaume.Abadie
Fixes a bug in Global{Bilinear,Trilinear}ClampedSampler that was actually doing a Point sampling.
Change 3794749 by Mark.Satterthwaite
Fix mtlpp.build.cs paths.
Change 3794856 by Mark.Satterthwaite
Fix some shadowing warnings.
Change 3795484 by Daniel.Wright
Implemented the Spherical Harmonic windowing algorithm from 'Stupid Spherical Harmonics (SH) Tricks'
New WorldSettings Lightmass property VolumetricLightmapSphericalHarmonicSmoothing controls the global amount of smoothing applied
Change 3795590 by Brian.Karis
Area light fixes
Fixed order of operations. This helps mixing of SourceRadius, SourceLength, and SoftSourceRadius.
Change 3796832 by Marcus.Wassmer
Correct shouldcache condition for new resolve shader
Change 3796884 by Marcus.Wassmer
Doing it right this time.
Change 3797196 by Mark.Satterthwaite
More updates to MTLPP to make things simpler and reduce the number of spurious Objective-C warnings that are emitted because of the way we are using the runtime.
Change 3797200 by Daniel.Wright
Lightmass now uses the highest density VolumetricLightmapDensityVolume settings that affect any part of a cell
Change 3797221 by Daniel.Wright
Reduced default SphericalHarmonicSmoothing based on RoboRecall tests. Now only active with strong direct lighting from static lights by default.
Change 3797411 by Brian.Karis
Disable ExpandGamut for old tone mapper.
Change 3797462 by Mark.Satterthwaite
More build warnings silenced after changing to the lowest possible deployment target OS for each library.
Change 3797585 by Mark.Satterthwaite
Range-based-For support in the NSArray wrapper.
Change 3797836 by Mark.Satterthwaite
Even more forward-declarations to avoid system headers poking through to the including code from mtlpp.
Change 3798027 by Mark.Satterthwaite
Fix handling of nil objects, on which no functions may be called, command-buffer retention and IMP declaration.
Change 3798154 by Mark.Satterthwaite
Fix some egregious memory leaks that rewriting to use mtlpp exposed before we carry on - don't want these slipping into 4.19.
Change 3800990 by Mark.Satterthwaite
Typedef all the completion-handler callback types in mtlpp to make future me's life easier.
Change 3801400 by Chris.Bunner
Improving automated test errors on failure to generate report data.
Change 3801726 by Mark.Satterthwaite
Correct some function availability and the command-buffer error status in mtlpp.
Change 3801808 by Chris.Bunner
Added DefaultScalability.ini to EngineTest that forces all quality levels to Engine default Epic for now to improve consistency.
Change 3801862 by Marcus.Wassmer
Update automated tests with color gamut change
Change 3802214 by Chris.Bunner
When running automated tests in and editor-locked PIE viewport, skip resizing as the editor can't handle this.
Added bindable delegate called when ScreenshotRequest is processed - Useful to allow screenshots to override and restore settings per capture.
#jira UE-53188
Change 3802243 by Chris.Bunner
Added button to automated test screenshot browser to add or replace all outstanding test reports if appropriate.
DeleteAllReports button is now only enabled whilst there are reports in the list.
Change 3802372 by Chris.Bunner
Updating more test screenshots.
Change 3803683 by Chris.Bunner
Adding more logging and multiple attempts to automated test report network save.
Added small wait on repeated operations that are known to fail.
Change 3803826 by Rolando.Caloca
DR - vk - Fix merge issue
Change 3804181 by Chris.Bunner
Tentative fix for CIS test failure.
Change 3804236 by Chris.Bunner
Additional logging for case where file write silently fails, report platform-specific error.
Change 3804303 by zachary.wilson
Cleaning up assets in QAGame saved with empty engine versions to resolve warnings seen when launching on
Change 3804410 by Chris.Bunner
Added additional logging when automated screenshot test fails due to size mismatch.
Mismatched bounds are colored red in the delta.
Change 3804455 by Mark.Satterthwaite
Fix a small number of persistent memory leaks on the Mac build that slowly consume more and more memory as you use the Editor - interacting with menu's was particularly egregious as each NSMenu would leak after you move away.
#jira NA
Change 3804667 by Chris.Bunner
Speculative CIS fixes.
Change 3806008 by Chris.Bunner
Partially reimplementing backed-out CL 3804181 to improve consistency of how automated screenshot test settings are applied/restored.
#tests CIS preflight job 8174412
Change 3806909 by Mark.Satterthwaite
Use the vertex-shader's in-out mask to ensure that we only validate legitmate vertex-streams in Metal's DrawIndexedPrimitive implementation.
#jira UE-53046
Change 3807059 by laz.matech
Checking in QAGame Rendering Map, QA-PhysicalLightingUnits, for testing Physical Light Units.
Wanted to get this in before copy up.
#Jira none
Change 3807726 by Chris.Bunner
Removed a check that we can't fix up. The check hits unbound buffers which it assumes means a failure but is actually due to m.v.fetch. We don't have the information available to know which are which removed from the input without reading from the shader.
#jira UE-53046
Change 3807800 by Guillaume.Abadie
Fixes some warning in shader headers.
Change 3807804 by Guillaume.Abadie
Back out changelist 3807800
Change 3807807 by Guillaume.Abadie
Relands shader header warnings.
Change 3808046 by Chris.Bunner
Dropping a new automated test error back to a warning as this may lead to genuine issues being ignored in the short term.
Change 3809579 by Chris.Bunner
Back out changelist 3774677.
#jira UE-53483
Change 3809620 by Chris.Bunner
Updating animated cloth test screenshot.
Change 3803629 by Chris.Bunner
Rebuilt CornellBox and DistanceField test maps, updated screenshots.
Change 3787045 by Guillaume.Abadie
Moves some global samplers to Common.ush
Change 3809756 by Chris.Bunner
Updating animated cloth test screenshot.
[CL 3809764 by Chris Bunner in Main branch]
2017-12-15 12:47:47 -05:00
|
|
|
return IsFeatureLevelSupported(Parameters.Platform, ERHIFeatureLevel::ES3_1);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
IMPLEMENT_GLOBAL_SHADER(FVisualizeBufferPS, "/Engine/Private/PostProcessVisualizeBuffer.usf", "MainPS", SF_Pixel);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
struct FVisualizeBufferTile
|
|
|
|
|
{
|
|
|
|
|
// The input texture to visualize.
|
|
|
|
|
FScreenPassTexture Input;
|
|
|
|
|
|
|
|
|
|
// The label of the tile shown on the visualizer.
|
|
|
|
|
FString Label;
|
|
|
|
|
|
|
|
|
|
// Whether the tile is shown as selected.
|
|
|
|
|
bool bSelected = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct FVisualizeBufferInputs
|
|
|
|
|
{
|
|
|
|
|
FScreenPassRenderTarget OverrideOutput;
|
|
|
|
|
|
|
|
|
|
// The scene color input to propagate.
|
|
|
|
|
FScreenPassTexture SceneColor;
|
|
|
|
|
|
|
|
|
|
// The array of tiles to render onto the scene color texture.
|
|
|
|
|
TArrayView<const FVisualizeBufferTile> Tiles;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FScreenPassTexture AddVisualizeBufferPass(FRDGBuilder& GraphBuilder, const FViewInfo& View, const FVisualizeBufferInputs& Inputs)
|
|
|
|
|
{
|
|
|
|
|
check(Inputs.SceneColor.IsValid());
|
|
|
|
|
|
|
|
|
|
FScreenPassRenderTarget Output = Inputs.OverrideOutput;
|
|
|
|
|
|
|
|
|
|
RDG_EVENT_SCOPE(GraphBuilder, "VisualizeBuffer");
|
|
|
|
|
|
|
|
|
|
// Re-use the scene color as the output if no override was provided.
|
|
|
|
|
if (Output.IsValid())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2019-10-01 13:03:04 -04:00
|
|
|
AddDrawTexturePass(GraphBuilder, View, Inputs.SceneColor, Output);
|
|
|
|
|
|
|
|
|
|
// All remaining passes are load.
|
|
|
|
|
Output.LoadAction = ERenderTargetLoadAction::ELoad;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2019-10-01 13:03:04 -04:00
|
|
|
// Otherwise, reuse the scene color as the output.
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Output = FScreenPassRenderTarget(Inputs.SceneColor, ERenderTargetLoadAction::ELoad);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct FTileLabel
|
|
|
|
|
{
|
|
|
|
|
FString Label;
|
|
|
|
|
FIntPoint Location;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TArray<FTileLabel> TileLabels;
|
|
|
|
|
TileLabels.Reserve(Inputs.Tiles.Num());
|
|
|
|
|
|
|
|
|
|
const int32 MaxTilesX = 4;
|
|
|
|
|
const int32 MaxTilesY = 4;
|
|
|
|
|
const int32 TileWidth = Output.ViewRect.Width() / MaxTilesX;
|
|
|
|
|
const int32 TileHeight = Output.ViewRect.Height() / MaxTilesY;
|
|
|
|
|
|
|
|
|
|
FRHISamplerState* BilinearClampSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
|
|
|
|
|
|
|
|
|
|
for (int32 TileIndex = 0; TileIndex < Inputs.Tiles.Num(); ++TileIndex)
|
|
|
|
|
{
|
|
|
|
|
const FVisualizeBufferTile& Tile = Inputs.Tiles[TileIndex];
|
|
|
|
|
|
|
|
|
|
// The list can contain invalid entries to keep the indices static.
|
|
|
|
|
if (!Tile.Input.IsValid())
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const int32 TileX = TileIndex % MaxTilesX;
|
|
|
|
|
const int32 TileY = TileIndex / MaxTilesX;
|
|
|
|
|
|
|
|
|
|
FScreenPassTextureViewport OutputViewport(Output);
|
|
|
|
|
OutputViewport.Rect.Min = FIntPoint(TileX * TileWidth, TileY * TileHeight);
|
|
|
|
|
OutputViewport.Rect.Max = OutputViewport.Rect.Min + FIntPoint(TileWidth, TileHeight);
|
|
|
|
|
|
|
|
|
|
const FLinearColor SelectionColor = Tile.bSelected ? FLinearColor::Yellow : FLinearColor::Transparent;
|
|
|
|
|
|
|
|
|
|
FVisualizeBufferPS::FParameters* PassParameters = GraphBuilder.AllocParameters<FVisualizeBufferPS::FParameters>();
|
|
|
|
|
PassParameters->Output = GetScreenPassTextureViewportParameters(OutputViewport);
|
|
|
|
|
PassParameters->RenderTargets[0] = Output.GetRenderTargetBinding();
|
|
|
|
|
PassParameters->InputTexture = Tile.Input.Texture;
|
|
|
|
|
PassParameters->InputSampler = BilinearClampSampler;
|
|
|
|
|
PassParameters->SelectionColor = SelectionColor;
|
|
|
|
|
|
2020-09-24 00:43:27 -04:00
|
|
|
const FScreenPassTextureViewport InputViewport(Tile.Input);
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
TShaderMapRef<FScreenPassVS> VertexShader(View.ShaderMap);
|
|
|
|
|
TShaderMapRef<FVisualizeBufferPS> PixelShader(View.ShaderMap);
|
|
|
|
|
FRHIBlendState* BlendState = TStaticBlendState<CW_RGB, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha>::GetRHI();
|
|
|
|
|
|
2020-09-24 00:43:27 -04:00
|
|
|
AddDrawScreenPass(GraphBuilder, RDG_EVENT_NAME("Tile: %s", *Tile.Label), View, OutputViewport, InputViewport, VertexShader, PixelShader, BlendState, PassParameters);
|
2019-10-01 13:03:04 -04:00
|
|
|
|
|
|
|
|
FTileLabel TileLabel;
|
|
|
|
|
TileLabel.Label = Tile.Label;
|
|
|
|
|
TileLabel.Location.X = 8 + TileX * TileWidth;
|
|
|
|
|
TileLabel.Location.Y = (TileY + 1) * TileHeight - 19;
|
|
|
|
|
TileLabels.Add(TileLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AddDrawCanvasPass(GraphBuilder, RDG_EVENT_NAME("Labels"), View, Output, [LocalTileLabels = MoveTemp(TileLabels)](FCanvas& Canvas)
|
|
|
|
|
{
|
|
|
|
|
const FLinearColor LabelColor(1, 1, 0);
|
|
|
|
|
for (const FTileLabel& TileLabel : LocalTileLabels)
|
|
|
|
|
{
|
|
|
|
|
Canvas.DrawShadowedString(TileLabel.Location.X, TileLabel.Location.Y, *TileLabel.Label, GetStatsFont(), LabelColor);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return MoveTemp(Output);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsVisualizeGBufferOverviewEnabled(const FViewInfo& View)
|
|
|
|
|
{
|
|
|
|
|
return View.Family->EngineShowFlags.VisualizeBuffer && View.CurrentBufferVisualizationMode == NAME_None;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsVisualizeGBufferDumpToFileEnabled(const FViewInfo& View)
|
|
|
|
|
{
|
|
|
|
|
static const auto CVarDumpFrames = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.BufferVisualizationDumpFrames"));
|
|
|
|
|
|
|
|
|
|
const bool bDumpHighResolutionScreenshot = GIsHighResScreenshot && GetHighResScreenshotConfig().bDumpBufferVisualizationTargets;
|
|
|
|
|
|
|
|
|
|
const bool bFrameDumpAllowed = CVarDumpFrames->GetValueOnRenderThread() != 0 || bDumpHighResolutionScreenshot;
|
|
|
|
|
|
|
|
|
|
const bool bFrameDumpRequested = View.FinalPostProcessSettings.bBufferVisualizationDumpRequired;
|
|
|
|
|
|
|
|
|
|
return (bFrameDumpRequested && bFrameDumpAllowed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsVisualizeGBufferDumpToPipeEnabled(const FViewInfo& View)
|
|
|
|
|
{
|
|
|
|
|
return View.FinalPostProcessSettings.BufferVisualizationPipes.Num() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TUniquePtr<FImagePixelData> ReadbackPixelData(FRHICommandListImmediate& RHICmdList, FRHITexture* Texture, FIntRect SourceRect)
|
|
|
|
|
{
|
|
|
|
|
check(Texture);
|
|
|
|
|
check(Texture->GetTexture2D());
|
|
|
|
|
|
|
|
|
|
const int32 MSAAXSamples = Texture->GetNumSamples();
|
|
|
|
|
SourceRect.Min.X *= MSAAXSamples;
|
|
|
|
|
SourceRect.Max.X *= MSAAXSamples;
|
|
|
|
|
|
2022-03-25 10:31:55 -04:00
|
|
|
// todo: SourceRect is not clipped to Texture bounds
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
switch (Texture->GetFormat())
|
|
|
|
|
{
|
|
|
|
|
case PF_FloatRGBA:
|
|
|
|
|
{
|
2019-11-07 19:43:29 -05:00
|
|
|
TArray<FFloat16Color> RawPixels;
|
|
|
|
|
RawPixels.SetNum(SourceRect.Width() * SourceRect.Height());
|
|
|
|
|
RHICmdList.ReadSurfaceFloatData(Texture, SourceRect, RawPixels, (ECubeFace)0, 0, 0);
|
|
|
|
|
TUniquePtr<TImagePixelData<FFloat16Color>> PixelData = MakeUnique<TImagePixelData<FFloat16Color>>(SourceRect.Size(), TArray64<FFloat16Color>(MoveTemp(RawPixels)));
|
2019-10-01 13:03:04 -04:00
|
|
|
|
|
|
|
|
check(PixelData->IsDataWellFormed());
|
|
|
|
|
return PixelData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case PF_A32B32G32R32F:
|
|
|
|
|
{
|
|
|
|
|
FReadSurfaceDataFlags ReadDataFlags(RCM_MinMax);
|
|
|
|
|
ReadDataFlags.SetLinearToGamma(false);
|
|
|
|
|
|
2019-11-07 19:43:29 -05:00
|
|
|
TArray<FLinearColor> RawPixels;
|
|
|
|
|
RawPixels.SetNum(SourceRect.Width() * SourceRect.Height());
|
|
|
|
|
RHICmdList.ReadSurfaceData(Texture, SourceRect, RawPixels, ReadDataFlags);
|
|
|
|
|
TUniquePtr<TImagePixelData<FLinearColor>> PixelData = MakeUnique<TImagePixelData<FLinearColor>>(SourceRect.Size(), TArray64<FLinearColor>(MoveTemp(RawPixels)));
|
2019-10-01 13:03:04 -04:00
|
|
|
|
|
|
|
|
check(PixelData->IsDataWellFormed());
|
|
|
|
|
return PixelData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case PF_R8G8B8A8:
|
|
|
|
|
case PF_B8G8R8A8:
|
|
|
|
|
{
|
|
|
|
|
FReadSurfaceDataFlags ReadDataFlags;
|
|
|
|
|
ReadDataFlags.SetLinearToGamma(false);
|
|
|
|
|
|
2019-11-07 19:43:29 -05:00
|
|
|
TArray<FColor> RawPixels;
|
|
|
|
|
RawPixels.SetNum(SourceRect.Width() * SourceRect.Height());
|
|
|
|
|
RHICmdList.ReadSurfaceData(Texture, SourceRect, RawPixels, ReadDataFlags);
|
|
|
|
|
TUniquePtr<TImagePixelData<FColor>> PixelData = MakeUnique<TImagePixelData<FColor>>(SourceRect.Size(), TArray64<FColor>(MoveTemp(RawPixels)));
|
2019-10-01 13:03:04 -04:00
|
|
|
|
|
|
|
|
check(PixelData->IsDataWellFormed());
|
|
|
|
|
return PixelData;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddDumpToPipePass(FRDGBuilder& GraphBuilder, FScreenPassTexture Input, FImagePixelPipe* OutputPipe)
|
|
|
|
|
{
|
|
|
|
|
check(Input.IsValid());
|
|
|
|
|
check(OutputPipe);
|
2020-09-24 00:43:27 -04:00
|
|
|
AddReadbackTexturePass(GraphBuilder, RDG_EVENT_NAME("DumpToPipe(%s)", Input.Texture->Name), Input.Texture,
|
2019-10-01 13:03:04 -04:00
|
|
|
[Input, OutputPipe](FRHICommandListImmediate& RHICmdList)
|
|
|
|
|
{
|
|
|
|
|
OutputPipe->Push(ReadbackPixelData(RHICmdList, Input.Texture->GetRHI(), Input.ViewRect));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddDumpToFilePass(FRDGBuilder& GraphBuilder, FScreenPassTexture Input, const FString& Filename)
|
|
|
|
|
{
|
|
|
|
|
check(Input.IsValid());
|
|
|
|
|
|
|
|
|
|
FHighResScreenshotConfig& HighResScreenshotConfig = GetHighResScreenshotConfig();
|
|
|
|
|
|
|
|
|
|
if (!ensureMsgf(HighResScreenshotConfig.ImageWriteQueue, TEXT("Unable to write images unless FHighResScreenshotConfig::Init has been called.")))
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
if (GIsHighResScreenshot && HighResScreenshotConfig.CaptureRegion.Area())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2022-03-25 10:31:55 -04:00
|
|
|
// todo: CaptureRegion is not clipped to Texture bounds
|
2019-10-01 13:03:04 -04:00
|
|
|
Input.ViewRect = HighResScreenshotConfig.CaptureRegion;
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2020-09-24 00:43:27 -04:00
|
|
|
AddReadbackTexturePass(GraphBuilder, RDG_EVENT_NAME("DumpToFile(%s)", Input.Texture->Name), Input.Texture,
|
2019-10-01 13:03:04 -04:00
|
|
|
[&HighResScreenshotConfig, Input, Filename](FRHICommandListImmediate& RHICmdList)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2022-03-25 10:31:55 -04:00
|
|
|
// this is where HighResShot bDumpBufferVisualizationTargets are written to EXRs
|
|
|
|
|
|
|
|
|
|
// @todo Oodle alternative : use the exact same pixelformat that this buffer would have in the renderer
|
|
|
|
|
// use the DDS writer which can output arbitrary pixel formats
|
|
|
|
|
// do no format conversions so we dump the exact same bits the game renderer would see
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
TUniquePtr<FImagePixelData> PixelData = ReadbackPixelData(RHICmdList, Input.Texture->GetRHI(), Input.ViewRect);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
if (!PixelData.IsValid())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2019-10-01 13:03:04 -04:00
|
|
|
return;
|
2018-10-26 19:28:13 -04:00
|
|
|
}
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
TUniquePtr<FImageWriteTask> ImageTask = MakeUnique<FImageWriteTask>();
|
|
|
|
|
ImageTask->PixelData = MoveTemp(PixelData);
|
2018-10-26 19:28:13 -04:00
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
HighResScreenshotConfig.PopulateImageTaskParams(*ImageTask);
|
|
|
|
|
ImageTask->Filename = Filename;
|
2018-10-26 19:28:13 -04:00
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
if (ImageTask->PixelData->GetType() == EImagePixelType::Color)
|
2018-10-26 19:28:13 -04:00
|
|
|
{
|
2019-10-01 13:03:04 -04:00
|
|
|
// Always write full alpha
|
|
|
|
|
ImageTask->PixelPreProcessors.Add(TAsyncAlphaWrite<FColor>(255));
|
2018-10-26 19:28:13 -04:00
|
|
|
|
2022-03-15 18:29:37 -04:00
|
|
|
// ImageTask->PixelData should be sRGB
|
|
|
|
|
// it will gamma correct automatically if written to EXR
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
HighResScreenshotConfig.ImageWriteQueue->Enqueue(MoveTemp(ImageTask));
|
|
|
|
|
});
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-02-24 23:44:16 -05:00
|
|
|
void AddDumpToColorArrayPass(FRDGBuilder& GraphBuilder, FScreenPassTexture Input, TArray<FColor>* OutputColorArray, FIntPoint* OutputExtents)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2019-10-01 13:03:04 -04:00
|
|
|
check(Input.IsValid());
|
|
|
|
|
check(OutputColorArray);
|
2020-09-24 00:43:27 -04:00
|
|
|
AddReadbackTexturePass(GraphBuilder, RDG_EVENT_NAME("DumpToPipe(%s)", Input.Texture->Name), Input.Texture,
|
2022-02-24 23:44:16 -05:00
|
|
|
[Input, OutputColorArray, OutputExtents](FRHICommandListImmediate& RHICmdList)
|
2019-10-01 13:03:04 -04:00
|
|
|
{
|
2021-10-27 15:14:40 -04:00
|
|
|
// By design, we want the whole surface, not the view rectangle, as this code is used for generating a screenshot
|
|
|
|
|
// mask surface that needs to match the corresponding screenshot color surface. The scene may render as a viewport
|
|
|
|
|
// inside a larger surface, but the screenshot logic emits the entire surface, not just the viewport, and we must
|
|
|
|
|
// do the same for correct results (also to prevent an assert in FHighResScreenshotConfig::MergeMaskIntoAlpha).
|
|
|
|
|
// See FSceneView, UnscaledViewRect versus UnconstrainedViewRect.
|
|
|
|
|
FIntRect WholeSurfaceRect;
|
|
|
|
|
WholeSurfaceRect.Min = FIntPoint(0, 0);
|
|
|
|
|
WholeSurfaceRect.Max = Input.Texture->Desc.Extent;
|
|
|
|
|
|
|
|
|
|
RHICmdList.ReadSurfaceData(Input.Texture->GetRHI(), WholeSurfaceRect, *OutputColorArray, FReadSurfaceDataFlags());
|
2022-02-24 23:44:16 -05:00
|
|
|
*OutputExtents = Input.Texture->Desc.Extent;
|
2019-10-01 13:03:04 -04:00
|
|
|
});
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2019-10-01 13:03:04 -04:00
|
|
|
|
2021-01-21 16:22:06 -04:00
|
|
|
EPixelFormat OverridePostProcessingColorFormat(const EPixelFormat InFormat)
|
|
|
|
|
{
|
|
|
|
|
EPixelFormat OutputFormat = InFormat;
|
|
|
|
|
|
|
|
|
|
static const auto CVarPostProcessingColorFormat = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PostProcessingColorFormat"));
|
|
|
|
|
|
|
|
|
|
if (CVarPostProcessingColorFormat && CVarPostProcessingColorFormat->GetValueOnRenderThread() == 1)
|
|
|
|
|
{
|
|
|
|
|
if (OutputFormat == PF_FloatRGBA)
|
|
|
|
|
{
|
|
|
|
|
OutputFormat = PF_A32B32G32R32F;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return OutputFormat;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
FScreenPassTexture AddVisualizeGBufferOverviewPass(
|
|
|
|
|
FRDGBuilder& GraphBuilder,
|
|
|
|
|
const FViewInfo& View,
|
|
|
|
|
const FVisualizeGBufferOverviewInputs& Inputs)
|
|
|
|
|
{
|
|
|
|
|
const FFinalPostProcessSettings& PostProcessSettings = View.FinalPostProcessSettings;
|
|
|
|
|
|
2019-11-13 16:04:08 -05:00
|
|
|
check(Inputs.SceneColor.IsValid());
|
|
|
|
|
check(Inputs.bDumpToFile || Inputs.bOverview || PostProcessSettings.BufferVisualizationPipes.Num() > 0);
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
FScreenPassTexture Output;
|
2021-01-21 16:22:06 -04:00
|
|
|
|
|
|
|
|
// Respect the r.PostProcessingColorFormat cvar just like the main rendering path
|
|
|
|
|
const EPixelFormat OutputFormat = OverridePostProcessingColorFormat(Inputs.bOutputInHDR ? PF_FloatRGBA : PF_Unknown);
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
TArray<FVisualizeBufferTile> Tiles;
|
|
|
|
|
|
|
|
|
|
RDG_EVENT_SCOPE(GraphBuilder, "VisualizeGBufferOverview");
|
|
|
|
|
|
|
|
|
|
const FString& BaseFilename = PostProcessSettings.BufferVisualizationDumpBaseFilename;
|
|
|
|
|
|
|
|
|
|
for (UMaterialInterface* MaterialInterface : PostProcessSettings.BufferVisualizationOverviewMaterials)
|
|
|
|
|
{
|
|
|
|
|
if (!MaterialInterface)
|
|
|
|
|
{
|
|
|
|
|
// Add an empty tile to keep the location of each static on the grid.
|
|
|
|
|
Tiles.Emplace();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FString MaterialName = MaterialInterface->GetName();
|
|
|
|
|
|
|
|
|
|
RDG_EVENT_SCOPE(GraphBuilder, "%s", *MaterialName);
|
|
|
|
|
|
|
|
|
|
FPostProcessMaterialInputs PostProcessMaterialInputs;
|
|
|
|
|
PostProcessMaterialInputs.SetInput(EPostProcessMaterialInput::SceneColor, Inputs.SceneColor);
|
|
|
|
|
PostProcessMaterialInputs.SetInput(EPostProcessMaterialInput::SeparateTranslucency, Inputs.SeparateTranslucency);
|
2019-11-05 17:04:34 -05:00
|
|
|
PostProcessMaterialInputs.SetInput(EPostProcessMaterialInput::PreTonemapHDRColor, Inputs.SceneColorBeforeTonemap);
|
|
|
|
|
PostProcessMaterialInputs.SetInput(EPostProcessMaterialInput::PostTonemapHDRColor, Inputs.SceneColorAfterTonemap);
|
2019-10-01 13:03:04 -04:00
|
|
|
PostProcessMaterialInputs.SetInput(EPostProcessMaterialInput::Velocity, Inputs.Velocity);
|
2020-09-24 00:43:27 -04:00
|
|
|
PostProcessMaterialInputs.SceneTextures = Inputs.SceneTextures;
|
2019-10-01 13:03:04 -04:00
|
|
|
PostProcessMaterialInputs.OutputFormat = OutputFormat;
|
|
|
|
|
|
|
|
|
|
Output = AddPostProcessMaterialPass(GraphBuilder, View, PostProcessMaterialInputs, MaterialInterface);
|
|
|
|
|
|
|
|
|
|
const TSharedPtr<FImagePixelPipe, ESPMode::ThreadSafe>* OutputPipe = PostProcessSettings.BufferVisualizationPipes.Find(MaterialInterface->GetFName());
|
|
|
|
|
|
|
|
|
|
if (OutputPipe && OutputPipe->IsValid())
|
|
|
|
|
{
|
|
|
|
|
AddDumpToPipePass(GraphBuilder, Output, OutputPipe->Get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Inputs.bDumpToFile)
|
|
|
|
|
{
|
|
|
|
|
// First off, allow the user to specify the pass as a format arg (using {material})
|
|
|
|
|
TMap<FString, FStringFormatArg> FormatMappings;
|
|
|
|
|
FormatMappings.Add(TEXT("material"), MaterialName);
|
|
|
|
|
|
|
|
|
|
FString MaterialFilename = FString::Format(*BaseFilename, FormatMappings);
|
|
|
|
|
|
|
|
|
|
// If the format made no change to the string, we add the name of the material to ensure uniqueness
|
|
|
|
|
if (MaterialFilename == BaseFilename)
|
|
|
|
|
{
|
|
|
|
|
MaterialFilename = BaseFilename + TEXT("_") + MaterialName;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-25 10:31:55 -04:00
|
|
|
// always makes a .png filename even when bCaptureHDR was set, which will actually save an EXR
|
2019-10-01 13:03:04 -04:00
|
|
|
MaterialFilename.Append(TEXT(".png"));
|
|
|
|
|
|
|
|
|
|
AddDumpToFilePass(GraphBuilder, Output, MaterialFilename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Inputs.bOverview)
|
|
|
|
|
{
|
|
|
|
|
FDownsamplePassInputs DownsampleInputs;
|
|
|
|
|
DownsampleInputs.Name = TEXT("MaterialHalfSize");
|
|
|
|
|
DownsampleInputs.SceneColor = Output;
|
|
|
|
|
DownsampleInputs.Flags = EDownsampleFlags::ForceRaster;
|
|
|
|
|
DownsampleInputs.Quality = EDownsampleQuality::Low;
|
|
|
|
|
|
|
|
|
|
FScreenPassTexture HalfSize = AddDownsamplePass(GraphBuilder, View, DownsampleInputs);
|
|
|
|
|
|
|
|
|
|
DownsampleInputs.Name = TEXT("MaterialQuarterSize");
|
|
|
|
|
DownsampleInputs.SceneColor = HalfSize;
|
|
|
|
|
|
|
|
|
|
FVisualizeBufferTile Tile;
|
|
|
|
|
Tile.Input = AddDownsamplePass(GraphBuilder, View, DownsampleInputs);
|
2019-12-19 18:07:47 -05:00
|
|
|
Tile.Label = GetBufferVisualizationData().GetMaterialDisplayName(FName(*MaterialName)).ToString();
|
2019-10-01 13:03:04 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
|
|
|
Tile.bSelected =
|
|
|
|
|
PostProcessSettings.bBufferVisualizationOverviewTargetIsSelected &&
|
|
|
|
|
PostProcessSettings.BufferVisualizationOverviewSelectedTargetMaterialName == MaterialName;
|
|
|
|
|
#endif
|
|
|
|
|
Tiles.Add(Tile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Inputs.bOverview)
|
|
|
|
|
{
|
|
|
|
|
FVisualizeBufferInputs PassInputs;
|
|
|
|
|
PassInputs.OverrideOutput = Inputs.OverrideOutput;
|
|
|
|
|
PassInputs.SceneColor = Inputs.SceneColor;
|
|
|
|
|
PassInputs.Tiles = Tiles;
|
|
|
|
|
|
|
|
|
|
return AddVisualizeBufferPass(GraphBuilder, View, PassInputs);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-09-24 00:43:27 -04:00
|
|
|
if (Inputs.OverrideOutput.IsValid())
|
|
|
|
|
{
|
|
|
|
|
AddDrawTexturePass(GraphBuilder, View, Inputs.SceneColor, Inputs.OverrideOutput);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 13:03:04 -04:00
|
|
|
return Inputs.SceneColor;
|
|
|
|
|
}
|
|
|
|
|
}
|