You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* 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]
104 lines
3.8 KiB
C++
104 lines
3.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "../SceneTextures.h"
|
|
|
|
/*
|
|
* Stencil layout during basepass / deferred decals:
|
|
* BIT ID | USE
|
|
* [0] | sandbox bit (bit to be use by any rendering passes, but must be properly reset to 0 after using)
|
|
* [1] | unallocated
|
|
* [2] | Distance Field Representation
|
|
* [3] | Temporal AA mask for translucent object.
|
|
* [4] | Lighting channels
|
|
* [5] | Lighting channels
|
|
* [6] | Lighting channels
|
|
* [7] | primitive receive decal bit
|
|
*
|
|
* After deferred decals, stencil is cleared to 0 and no longer packed in this way, to ensure use of fast hardware clears and HiStencil.
|
|
*/
|
|
#define STENCIL_SANDBOX_BIT_ID 0
|
|
// Must match usf
|
|
#define STENCIL_DISTANCE_FIELD_REPRESENTATION_BIT_ID 2
|
|
#define STENCIL_TEMPORAL_RESPONSIVE_AA_BIT_ID 3
|
|
#define STENCIL_LIGHTING_CHANNELS_BIT_ID 4
|
|
#define STENCIL_RECEIVE_DECAL_BIT_ID 7
|
|
// Used only during the lighting pass - alias/reuse light channels (which copied from stencil to a texture prior to lighting pass)
|
|
#define STENCIL_STRATA_FASTPATH 4
|
|
#define STENCIL_STRATA_SINGLEPATH 5
|
|
#define STENCIL_STRATA_COMPLEX 6
|
|
|
|
// Outputs a compile-time constant stencil's bit mask ready to be used
|
|
// in TStaticDepthStencilState<> template parameter. It also takes care
|
|
// of masking the Value macro parameter to only keep the low significant
|
|
// bit to ensure to not overflow on other bits.
|
|
#define GET_STENCIL_BIT_MASK(BIT_NAME,Value) uint8((uint8(Value) & uint8(0x01)) << (STENCIL_##BIT_NAME##_BIT_ID))
|
|
|
|
#define STENCIL_SANDBOX_MASK GET_STENCIL_BIT_MASK(SANDBOX,1)
|
|
|
|
#define STENCIL_TEMPORAL_RESPONSIVE_AA_MASK GET_STENCIL_BIT_MASK(TEMPORAL_RESPONSIVE_AA,1)
|
|
|
|
#define STENCIL_LIGHTING_CHANNELS_MASK(Value) uint8(((Value) & 0x7) << STENCIL_LIGHTING_CHANNELS_BIT_ID)
|
|
|
|
// Mobile specific
|
|
// Store shading model into stencil [1-2] bits
|
|
#define GET_STENCIL_MOBILE_SM_MASK(Value) uint8(((Value) & 0x3) << 1)
|
|
// Sky material mask - bit 3
|
|
#define STENCIL_MOBILE_SKY_MASK uint8(1 << 3)
|
|
|
|
class FSceneRenderTargets
|
|
{
|
|
public:
|
|
UE_DEPRECATED(5.0, "FSceneRenderTargets is now deprecated from the RDG refactor. FSceneTextures should be used instead.")
|
|
static FSceneRenderTargets& Get()
|
|
{
|
|
static FSceneRenderTargets Instance;
|
|
return Instance;
|
|
}
|
|
|
|
UE_DEPRECATED(5.0, "FSceneRenderTargets is now deprecated from the RDG refactor. FSceneTextures should be used instead.")
|
|
static FSceneRenderTargets& Get(FRHICommandListImmediate&)
|
|
{
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS
|
|
return Get();
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
|
}
|
|
|
|
UE_DEPRECATED(5.0, "FSceneRenderTargets is now deprecated from the RDG refactor. FSceneTextures should be used instead.")
|
|
static FClearValueBinding GetDefaultColorClear()
|
|
{
|
|
return FSceneTexturesConfig::Get().ColorClearValue;
|
|
}
|
|
|
|
UE_DEPRECATED(5.0, "FSceneRenderTargets is now deprecated from the RDG refactor. FSceneTextures should be used instead.")
|
|
static FClearValueBinding GetDefaultDepthClear()
|
|
{
|
|
return FSceneTexturesConfig::Get().DepthClearValue;
|
|
}
|
|
|
|
UE_DEPRECATED(5.0, "FSceneRenderTargets is now deprecated from the RDG refactor. FSceneTextures should be used instead.")
|
|
static FIntPoint GetBufferSizeXY()
|
|
{
|
|
return FSceneTexturesConfig::Get().Extent;
|
|
}
|
|
|
|
UE_DEPRECATED(5.0, "FSceneRenderTargets is now deprecated from the RDG refactor. FSceneTextures should be used instead.")
|
|
static int32 GetMSAACount()
|
|
{
|
|
return FSceneTexturesConfig::Get().NumSamples;
|
|
}
|
|
|
|
UE_DEPRECATED(5.0, "FSceneRenderTargets is now deprecated from the RDG refactor. FSceneTextures should be used instead.")
|
|
static ERHIFeatureLevel::Type GetCurrentFeatureLevel()
|
|
{
|
|
return FSceneTexturesConfig::Get().FeatureLevel;
|
|
}
|
|
|
|
UE_DEPRECATED(5.0, "FSceneRenderTargets is now deprecated from the RDG refactor. FSceneTextures should be used instead.")
|
|
static TRefCountPtr<IPooledRenderTarget> GetSceneColor()
|
|
{
|
|
checkNoEntry();
|
|
return nullptr;
|
|
}
|
|
}; |