UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DepthCopy.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 DepthCopy.h: Depth copy utilities.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "RenderGraphUtils.h"
11#include "GlobalShader.h"
12
13class FViewInfo;
14
15namespace DepthCopy
16{
17
18// This is a temporary workaround while we get AddCopyTexturePass to do a proper copy of depth texture (with source texture HTile maintained).
19// On some platforms this is not the case: depth is decompressed so that the depth format can be read through SRV and HTile optimizations are thus lost on the source texture.
20// While we wait for such support, we do a simple copy from SRV to UAV.
22
24{
25public:
28
29 class FMSAASampleCount : SHADER_PERMUTATION_SPARSE_INT("MSAA_SAMPLE_COUNT", 1, 2, 4, 8);
31
33 SHADER_PARAMETER_RDG_TEXTURE(Texture2D, DepthTexture)
34 SHADER_PARAMETER_RDG_TEXTURE(Texture2DMS, DepthTextureMS)
37
38 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
39 {
40 return IsFeatureLevelSupported(Parameters.Platform, ERHIFeatureLevel::SM5) || MobileSupportsSM5MaterialNodes(Parameters.Platform);
41 }
42};
43
44// This is a temporary workaround while we get AddCopyTexturePass to do a proper copy of depth texture (with source texture HTile maintained).
45// This one does a depth buffer copy via pixel shader depth output. This is valid on some platform having moore complex HTile management.
47
48};
49
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
bool IsFeatureLevelSupported(const FStaticShaderPlatform InShaderPlatform, ERHIFeatureLevel::Type InFeatureLevel)
Definition DataDrivenShaderPlatformInfo.h:1047
const bool
Definition NetworkReplayStreaming.h:178
RENDERCORE_API bool MobileSupportsSM5MaterialNodes(const FStaticShaderPlatform Platform)
Definition RenderUtils.cpp:644
#define SHADER_PARAMETER_RDG_TEXTURE(ShaderType, MemberName)
Definition ShaderParameterMacros.h:1752
#define BEGIN_SHADER_PARAMETER_STRUCT(StructTypeName, DllStorage)
Definition ShaderParameterMacros.h:1482
#define RENDER_TARGET_BINDING_SLOTS()
Definition ShaderParameterMacros.h:1955
#define END_SHADER_PARAMETER_STRUCT()
Definition ShaderParameterMacros.h:1485
#define SHADER_PERMUTATION_SPARSE_INT(InDefineName,...)
Definition ShaderPermutation.h:506
Definition DepthCopy.h:24
SHADER_USE_PARAMETER_STRUCT(FCopyDepthPS, FGlobalShader)
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters)
Definition DepthCopy.h:38
DECLARE_GLOBAL_SHADER(FCopyDepthPS)
Definition GlobalShader.h:269
Definition RenderGraphBuilder.h:49
Definition RenderGraphResources.h:571
Definition SceneRendering.h:1132
Definition DepthCopy.cpp:13
void AddViewDepthCopyCSPass(FRDGBuilder &GraphBuilder, FViewInfo &View, FRDGTextureRef SourceSceneDepthTexture, FRDGTextureRef DestinationDepthTexture)
Definition DepthCopy.cpp:47
void AddViewDepthCopyPSPass(FRDGBuilder &GraphBuilder, FViewInfo &View, FRDGTextureRef SourceSceneDepthTexture, FRDGTextureRef DestinationDepthTexture)
Definition DepthCopy.cpp:67
@ SM5
Definition RHIFeatureLevel.h:42
Definition ShaderPermutation.h:229