UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DebugViewModeRendering.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4DebugViewModeRendering.h: Contains definitions for rendering debug viewmodes.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "ShaderParameters.h"
11#include "Shader.h"
13#include "GlobalShader.h"
16#include "MeshMaterialShader.h"
17#include "ShaderBaseClasses.h"
18#include "MeshPassProcessor.h"
21
26class FViewFamilyInfo;
27
28static const int32 NumStreamingAccuracyColors = 5;
29static const int32 NumLODColorationColors = 8;
30static const float UndefinedStreamingAccuracyIntensity = .015f;
31
33 SHADER_PARAMETER_ARRAY(FLinearColor, AccuracyColors, [NumStreamingAccuracyColors])
34 SHADER_PARAMETER_ARRAY(FLinearColor, LODColors, [NumLODColorationColors])
36
42
43#if WITH_DEBUG_VIEW_MODES
44
47
50
52{
53public:
54
57 const FMaterial& InMaterial,
59 const FVector& InViewOrigin,
64 : MaterialRenderProxy(InMaterialRenderProxy)
67 , ViewOrigin(InViewOrigin)
68 , VisualizeLODIndex(InVisualizeLODIndex)
69 , SkinCacheDebugColor(InSkinCacheDebugColor)
70 , ViewModeParam(InViewModeParam)
71 , ViewModeParamName(InViewModeParamName)
78 {}
79
80 const FMaterialRenderProxy& MaterialRenderProxy;
81 const FMaterial& Material;
82
84 FVector ViewOrigin;
85 int32 VisualizeLODIndex;
86 FColor SkinCacheDebugColor;
87 int32 ViewModeParam;
88 FName ViewModeParamName;
89
93
97};
98
103{
105protected:
106
109
110public:
111
113
115 const FScene* Scene,
116 ERHIFeatureLevel::Type FeatureLevel,
117 const FPrimitiveSceneProxy* PrimitiveSceneProxy,
118 const FMaterialRenderProxy& MaterialRenderProxy,
119 const FMaterial& Material,
121 FMeshDrawSingleShaderBindings& ShaderBindings) const;
122
125};
126
128{
129public:
131
134
137
139 const FShaderMapPointerTable& PointerTable,
140 const FScene* Scene,
141 const FSceneView* ViewIfDynamicMeshCommand,
142 const FVertexFactory* VertexFactory,
144 ERHIFeatureLevel::Type FeatureLevel,
145 const FPrimitiveSceneProxy* PrimitiveSceneProxy,
146 const FMeshBatch& MeshBatch,
149 FMeshDrawSingleShaderBindings& ShaderBindings,
150 FVertexInputStreamArray& VertexStreams) const;
151
167};
168
169class FDebugViewModeMeshProcessor : public FSceneRenderingAllocatorObject<FDebugViewModeMeshProcessor>, public FMeshPassProcessor
170{
171public:
173 virtual void AddMeshBatch(const FMeshBatch& RESTRICT MeshBatch, uint64 BatchElementMask, const FPrimitiveSceneProxy* RESTRICT PrimitiveSceneProxy, int32 StaticMeshId = -1) override final;
174
175private:
176
178
179 EDebugViewShaderMode DebugViewMode;
180 int32 ViewModeParam;
181 FName ViewModeParamName;
182
184};
185
187{
188public:
190
191 virtual void AddShaderTypes(ERHIFeatureLevel::Type InFeatureLevel,
193 FMaterialShaderTypes& OutShaderTypes) const override;
194
195 virtual void GetDebugViewModeShaderBindings(
197 const FPrimitiveSceneProxy* RESTRICT PrimitiveSceneProxy,
198 const FMaterialRenderProxy& RESTRICT MaterialRenderProxy,
200 EDebugViewShaderMode DebugViewMode,
201 const FVector& ViewOrigin,
202 int32 VisualizeLODIndex,
203 const FColor& SkinCacheDebugColor,
204 int32 VisualizeElementIndex,
209 int32 ViewModeParam,
210 FName ViewModeParamName,
211 FMeshDrawSingleShaderBindings& ShaderBindings
212 ) const override;
213};
214
215#endif // WITH_DEBUG_VIEW_MODES
216
217void ClearDebugAux(FRDGBuilder& GraphBuilder, const FViewFamilyInfo& ViewFamily, FRDGTextureRef DebugAuxTexture);
218
220 FRDGBuilder& GraphBuilder,
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define RESTRICT
Definition Platform.h:706
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EDebugViewShaderMode
Definition DebugViewModeHelpers.h:23
void RenderDebugViewMode(FRDGBuilder &GraphBuilder, TArrayView< FViewInfo > Views, FRDGTextureRef DebugAuxTexture, const FRenderTargetBinding &SceneColorRTBinding, const FDepthStencilBinding &SceneDepthBinding)
Definition DebugViewModeRendering.cpp:762
void ClearDebugAux(FRDGBuilder &GraphBuilder, const FViewFamilyInfo &ViewFamily, FRDGTextureRef DebugAuxTexture)
Definition DebugViewModeRendering.cpp:759
#define LAYOUT_FIELD(T, Name,...)
Definition MemoryLayout.h:471
EShaderPlatform
Definition RHIShaderPlatform.h:11
#define END_GLOBAL_SHADER_PARAMETER_STRUCT
Definition ShaderParameterMacros.h:1669
#define SHADER_PARAMETER_ARRAY(MemberType, MemberName, ArrayDecl)
Definition ShaderParameterMacros.h:1696
#define SHADER_PARAMETER_RDG_TEXTURE_UAV(ShaderType, MemberName)
Definition ShaderParameterMacros.h:1788
#define BEGIN_GLOBAL_SHADER_PARAMETER_STRUCT
Definition ShaderParameterMacros.h:1663
#define SHADER_PARAMETER_STRUCT(StructType, MemberName)
Definition ShaderParameterMacros.h:1847
#define DECLARE_SHADER_TYPE(ShaderClass, ShaderMetaTypeShortcut,...)
Definition Shader.h:1688
EVertexInputStreamType
Definition VertexFactory.h:128
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition DebugViewModeInterface.h:28
Definition MaterialRenderProxy.h:102
Definition MaterialShared.h:2058
Definition MeshDrawShaderBindings.h:104
Definition MeshMaterialShader.h:22
Definition MeshMaterialShader.h:68
RENDERER_API void GetShaderBindings(const FScene *Scene, ERHIFeatureLevel::Type FeatureLevel, const FPrimitiveSceneProxy *PrimitiveSceneProxy, const FMaterialRenderProxy &MaterialRenderProxy, const FMaterial &Material, const FMeshMaterialShaderElementData &ShaderElementData, FMeshDrawSingleShaderBindings &ShaderBindings) const
Definition ShaderBaseClasses.cpp:457
RENDERER_API void GetElementShaderBindings(const FShaderMapPointerTable &PointerTable, const FScene *Scene, const FSceneView *ViewIfDynamicMeshCommand, const FVertexFactory *VertexFactory, const EVertexInputStreamType InputStreamType, const FStaticFeatureLevel FeatureLevel, const FPrimitiveSceneProxy *PrimitiveSceneProxy, const FMeshBatch &MeshBatch, const FMeshBatchElement &BatchElement, const FMeshMaterialShaderElementData &ShaderElementData, FMeshDrawSingleShaderBindings &ShaderBindings, FVertexInputStreamArray &VertexStreams) const
Definition ShaderBaseClasses.cpp:471
Definition MeshPassProcessor.h:1670
Definition MeshPassProcessor.h:2199
virtual void AddMeshBatch(const FMeshBatch &RESTRICT MeshBatch, uint64 BatchElementMask, const FPrimitiveSceneProxy *RESTRICT PrimitiveSceneProxy, int32 StaticMeshId=-1)=0
Definition NameTypes.h:617
Definition PrimitiveSceneProxy.h:296
Definition RenderGraphBuilder.h:49
Definition RenderGraphResources.h:571
Definition SceneView.h:1425
Definition ScenePrivate.h:2875
Definition Shader.h:637
Definition ShaderParameters.h:56
Definition ShaderParameters.h:87
static void ModifyCompilationEnvironment(const FShaderPermutationParameters &, FShaderCompilerEnvironment &)
Definition Shader.h:854
static bool ShouldCompilePermutation(const FShaderPermutationParameters &)
Definition Shader.h:860
Definition VertexFactory.h:314
Definition VertexFactory.h:661
Definition SceneRendering.h:1970
Definition SceneRendering.h:1132
Definition ArrayView.h:139
Definition ConcurrentLinearAllocator.h:571
Definition RenderGraphResources.h:251
@ DebugViewMode
Definition MeshPassProcessor.h:61
Type
Definition RHIFeatureLevel.h:20
Definition Color.h:486
Definition ShaderParameterMacros.h:630
Definition Color.h:48
Definition MaterialShader.h:45
Definition MaterialShaderType.h:198
Definition MeshBatch.h:232
Definition MeshBatch.h:371
Definition MeshMaterialShader.h:33
Definition MeshMaterialShaderType.h:29
Definition ShaderParameterMacros.h:525
Definition ShaderCore.h:544