UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RenderGraphResources.inl
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6
8{
9 FirstPass = {};
10 LastPass = {};
11 FirstPass[Pipeline] = PassHandle;
12 LastPass[Pipeline] = PassHandle;
13}
14
16{
17#if RDG_ENABLE_DEBUG
19 {
20 checkf(FirstPass[Pipeline].IsValid() == LastPass[Pipeline].IsValid(), TEXT("Subresource state has unset first or last pass on '%s."), *GetRHIPipelineName(Pipeline));
21 }
22#endif
23}
24
30
35
40
48
50{
51 check(InDesc.IsValid());
52
54 OutDesc.ClearValue = InDesc.ClearValue;
55 OutDesc.Flags = InDesc.Flags;
56 OutDesc.Format = InDesc.Format;
57 OutDesc.UAVFormat = InDesc.UAVFormat;
58 OutDesc.Extent.X = InDesc.Extent.X;
59 OutDesc.Extent.Y = InDesc.Extent.Y;
60 OutDesc.Depth = InDesc.Dimension == ETextureDimension::Texture3D ? InDesc.Depth : 0;
61 OutDesc.ArraySize = InDesc.ArraySize;
62 OutDesc.NumMips = InDesc.NumMips;
63 OutDesc.NumSamples = InDesc.NumSamples;
64 OutDesc.bIsArray = InDesc.IsTextureArray();
65 OutDesc.bIsCubemap = InDesc.IsTextureCube();
66 OutDesc.FastVRAMPercentage = InDesc.FastVRAMPercentage;
67 OutDesc.AliasableFormats = InDesc.AliasableFormats;
68
69 check(OutDesc.IsValid());
70 return OutDesc;
71}
72
74{
75 FRHIBufferCreateInfo CreateInfo;
76 CreateInfo.Size = InDesc.GetSize();
77
79 {
80 CreateInfo.Stride = 0;
81 CreateInfo.Usage = InDesc.Usage | BUF_VertexBuffer;
82 }
84 {
85 CreateInfo.Stride = InDesc.BytesPerElement;
86 CreateInfo.Usage = InDesc.Usage | BUF_StructuredBuffer;
87 }
88 else
89 {
90 check(0);
91 }
92
93 return CreateInfo;
94}
95
97{
98 check(InDesc.IsValid());
99
101 OutDesc.ClearValue = InDesc.ClearValue;
102 OutDesc.Format = InDesc.Format;
103 OutDesc.UAVFormat = InDesc.UAVFormat;
104 OutDesc.Extent = InDesc.Extent;
105 OutDesc.ArraySize = InDesc.ArraySize;
106 OutDesc.NumMips = InDesc.NumMips;
107 OutDesc.NumSamples = InDesc.NumSamples;
108
109 if (InDesc.Depth > 0)
110 {
111 OutDesc.Depth = InDesc.Depth;
113 }
114 else if (InDesc.bIsCubemap)
115 {
117 }
118 else if (InDesc.bIsArray)
119 {
121 }
122
123 OutDesc.Flags = InDesc.Flags;
124 // UE-TODO: UE-188415 fix flags that we force in Render Target Pool
125 //OutDesc.Flags |= ETextureCreateFlags::ForceIntoNonStreamingMemoryTracking;
126 OutDesc.FastVRAMPercentage = InDesc.FastVRAMPercentage;
127 OutDesc.AliasableFormats = InDesc.AliasableFormats;
128 check(OutDesc.IsValid());
129
130 return OutDesc;
131}
132
134{
136 Range.MipIndex = Desc.MipLevel;
137 Range.ArraySlice = Desc.FirstArraySlice;
139
140 if (Desc.MetaData == ERDGTextureMetaDataAccess::None && Desc.Texture && Desc.Texture->Desc.Format == PF_DepthStencil)
141 {
142 // PF_X24_G8 is used to indicate that this is a view on the stencil plane. Otherwise, it is a view on the depth plane
144 Range.NumPlaneSlices = 1;
145 }
146
147 if (Desc.NumMipLevels != 0)
148 {
149 Range.NumMips = Desc.NumMipLevels;
150 }
151
152 if (Desc.NumArraySlices != 0)
153 {
154 Range.NumArraySlices = Desc.NumArraySlices;
155 }
156
157 if (Desc.MetaData != ERDGTextureMetaDataAccess::None)
158 {
159 Range.NumPlaneSlices = 1;
160 }
161
162 return Range;
163}
164
166{
168 Range.MipIndex = Desc.MipLevel;
169 Range.ArraySlice = Desc.FirstArraySlice;
170 Range.NumMips = 1;
172
173 if (Desc.NumArraySlices != 0)
174 {
175 Range.NumArraySlices = Desc.NumArraySlices;
176 }
177
178 if (Desc.MetaData != ERDGTextureMetaDataAccess::None)
179 {
180 Range.NumPlaneSlices = 1;
181 }
182
183 return Range;
184}
185
198
207
212
214{
217
219
221 {
222 FRDGTextureRef Texture = RenderTarget.GetTexture();
223
225 RenderTargetsInfo.RenderTargetFlags[RenderTargetIndex] = Texture->Desc.Flags;
226 RenderTargetsInfo.NumSamples |= Texture->Desc.NumSamples;
228 });
229
230 RenderTargetsInfo.RenderTargetsEnabled = RenderTargetIndex;
232 {
233 RenderTargetsInfo.RenderTargetFormats[RenderTargetIndex] = PF_Unknown;
234 }
235
236 const FDepthStencilBinding& DepthStencil = RenderTargets.DepthStencil;
237 if (FRDGTextureRef DepthTexture = DepthStencil.GetTexture())
238 {
239 RenderTargetsInfo.DepthStencilTargetFormat = DepthTexture->Desc.Format;
240 RenderTargetsInfo.DepthStencilTargetFlag = DepthTexture->Desc.Flags;
241 RenderTargetsInfo.NumSamples |= DepthTexture->Desc.NumSamples;
242
243 RenderTargetsInfo.DepthTargetLoadAction = DepthStencil.GetDepthLoadAction();
244 RenderTargetsInfo.StencilTargetLoadAction = DepthStencil.GetStencilLoadAction();
245
246 RenderTargetsInfo.DepthStencilAccess = DepthStencil.GetDepthStencilAccess();
248 if (DepthStencil.GetResolveTexture())
249 {
251 }
252 RenderTargetsInfo.DepthTargetStoreAction = RenderTargetsInfo.DepthStencilAccess.IsUsingDepth() ? StoreAction : ERenderTargetStoreAction::ENoAction;
253 RenderTargetsInfo.StencilTargetStoreAction = RenderTargetsInfo.DepthStencilAccess.IsUsingStencil() ? StoreAction : ERenderTargetStoreAction::ENoAction;
254 }
255 else
256 {
257 RenderTargetsInfo.DepthStencilTargetFormat = PF_Unknown;
258 }
259
260 RenderTargetsInfo.MultiViewCount = RenderTargets.MultiViewCount;
261 RenderTargetsInfo.bHasFragmentDensityAttachment = RenderTargets.ShadingRateTexture != nullptr;
262
263 return RenderTargetsInfo;
264}
265
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:35
UE::EnumFlags::Private::TRange< EnumType > MakeFlagsRange(EnumType Flags)
Definition EnumRange.h:285
#define PGO_LINK_DISABLE_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:71
#define PGO_LINK_ENABLE_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:75
@ PF_Unknown
Definition PixelFormat.h:17
@ PF_DepthStencil
Definition PixelFormat.h:28
@ PF_R32_UINT
Definition PixelFormat.h:45
@ PF_X24_G8
Definition PixelFormat.h:61
#define BUF_VertexBuffer
Definition RHIDefinitions.h:995
#define TexCreate_Memoryless
Definition RHIDefinitions.h:1204
@ MaxSimultaneousRenderTargets
Definition RHIDefinitions.h:287
ERenderTargetStoreAction
Definition RHIDefinitions.h:1272
#define BUF_StructuredBuffer
Definition RHIDefinitions.h:997
ERHIPipeline
Definition RHIPipeline.h:13
FString GetRHIPipelineName(ERHIPipeline Pipeline)
Definition RHIStrings.cpp:512
int32 GetResourceTransitionPlaneForMetadataAccess(ERDGTextureMetaDataAccess Metadata)
Definition RenderGraphDefinitions.h:321
FGraphicsPipelineRenderTargetsInfo ExtractRenderTargetsInfo(const FRDGParameterStruct &ParameterStruct)
Definition RenderGraphResources.inl:208
FPooledRenderTargetDesc Translate(const FRHITextureDesc &InDesc)
Definition RenderGraphResources.inl:49
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition RenderGraphResources.h:1321
FRDGBufferDesc Desc
Definition RenderGraphResources.h:1325
Definition RenderGraphParameter.h:213
const FRenderTargetBindingSlots & GetRenderTargets() const
Definition RenderGraphParameter.h:253
FRDGTextureRef Texture
Definition RenderGraphResources.h:833
FRDGTextureSubresourceRange GetSubresourceRange() const
Definition RenderGraphResources.inl:133
const FRDGTextureSRVDesc Desc
Definition RenderGraphResources.h:844
FRDGTextureRef GetParent() const override
Definition RenderGraphResources.h:846
FRDGTextureSubresourceRange GetSubresourceRange() const
Definition RenderGraphResources.inl:165
FRDGTextureRef GetParent() const override
Definition RenderGraphResources.h:912
const FRDGTextureUAVDesc Desc
Definition RenderGraphResources.h:910
Definition RenderGraphResources.h:571
FRDGTextureSubresourceRange GetSubresourceRange() const
Definition RenderGraphResources.h:599
const FRDGTextureDesc Desc
Definition RenderGraphResources.h:575
static TRDGHandle Min(TRDGHandle A, TRDGHandle B)
Definition RenderGraphDefinitions.h:412
static TRDGHandle Max(TRDGHandle A, TRDGHandle B)
Definition RenderGraphDefinitions.h:419
Definition ShaderParameterMacros.h:630
ERenderTargetLoadAction GetDepthLoadAction() const
Definition ShaderParameterMacros.h:700
Definition RHIResources.h:4547
uint16 NumSamples
Definition RHIResources.h:4565
Definition RendererInterface.h:81
FClearValueBinding ClearValue
Definition RendererInterface.h:412
Definition RenderGraphResources.h:940
EBufferUsageFlags Usage
Definition RenderGraphResources.h:1114
FRDGBufferSRVDesc()=default
FRDGBufferRef Buffer
Definition RenderGraphResources.h:1158
FRDGBufferRef Buffer
Definition RenderGraphResources.h:1188
FRDGBufferUAVDesc()=default
FRDGPassHandle GetFirstPass() const
Definition RenderGraphResources.inl:36
FRDGPassHandlesByPipeline LastPass
Definition RenderGraphResources.h:112
FRDGPassHandlesByPipeline FirstPass
Definition RenderGraphResources.h:109
bool IsUsedBy(ERHIPipeline Pipeline) const
Definition RenderGraphResources.inl:25
ERHIPipeline GetPipelines() const
Definition RenderGraphResources.inl:41
void Validate()
Definition RenderGraphResources.inl:15
FRDGPassHandle GetLastPass() const
Definition RenderGraphResources.inl:31
void SetPass(ERHIPipeline Pipeline, FRDGPassHandle PassHandle)
Definition RenderGraphResources.inl:7
Definition RenderGraphDefinitions.h:627
Definition RenderGraphTextureSubresource.h:130
Definition RHIResources.h:1321
uint32 Size
Definition RHIResources.h:1323
EBufferUsageFlags Usage
Definition RHIResources.h:1329
uint32 Stride
Definition RHIResources.h:1326
EPixelFormat Format
Definition RHIResources.h:5741
EPixelFormat Format
Definition RHIResources.h:5777
static const uint16 kStencilPlaneSlice
Definition RHITransition.h:23
static const uint16 kDepthPlaneSlice
Definition RHITransition.h:22
Definition RHIResources.h:1689
EPixelFormat Format
Definition RHIResources.h:1874
FClearValueBinding ClearValue
Definition RHIResources.h:1847
ERHITextureMetaDataAccess MetaData
Definition RHIResources.h:5608
uint16 NumArraySlices
Definition RHIResources.h:5605
EPixelFormat Format
Definition RHIResources.h:5590
uint16 FirstArraySlice
Definition RHIResources.h:5602
uint8 NumMipLevels
Definition RHIResources.h:5596
uint8 MipLevel
Definition RHIResources.h:5593
ERHITextureMetaDataAccess MetaData
Definition RHIResources.h:5690
uint8 MipLevel
Definition RHIResources.h:5687
uint16 FirstArraySlice
Definition RHIResources.h:5688
uint16 NumArraySlices
Definition RHIResources.h:5689
Definition ShaderParameterMacros.h:770
FRDGTexture * ShadingRateTexture
Definition ShaderParameterMacros.h:777
uint8 MultiViewCount
Definition ShaderParameterMacros.h:776
FDepthStencilBinding DepthStencil
Definition ShaderParameterMacros.h:772
void Enumerate(TFunction Function)
Definition ShaderParameterMacros.h:796
Definition ShaderParameterMacros.h:525