UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RenderGraphTextureSubresource.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "RHI.h"
6
7template <typename InElementType, typename InAllocatorType = FDefaultAllocator>
9
11{
13 : MipIndex(0)
14 , PlaneSlice(0)
15 , ArraySlice(0)
16 {}
17
23
24 inline bool operator == (const FRDGTextureSubresource& RHS) const
25 {
26 return MipIndex == RHS.MipIndex
27 && PlaneSlice == RHS.PlaneSlice
28 && ArraySlice == RHS.ArraySlice;
29 }
30
31 inline bool operator != (const FRDGTextureSubresource& RHS) const
32 {
33 return !(*this == RHS);
34 }
35
36 inline bool operator < (const FRDGTextureSubresource& RHS) const
37 {
38 return MipIndex < RHS.MipIndex
39 && PlaneSlice < RHS.PlaneSlice
40 && ArraySlice < RHS.ArraySlice;
41 }
42
43 inline bool operator <= (const FRDGTextureSubresource& RHS) const
44 {
45 return MipIndex <= RHS.MipIndex
46 && PlaneSlice <= RHS.PlaneSlice
47 && ArraySlice <= RHS.ArraySlice;
48 }
49
50 inline bool operator > (const FRDGTextureSubresource& RHS) const
51 {
52 return MipIndex > RHS.MipIndex
53 && PlaneSlice > RHS.PlaneSlice
54 && ArraySlice > RHS.ArraySlice;
55 }
56
57 inline bool operator >= (const FRDGTextureSubresource& RHS) const
58 {
59 return MipIndex >= RHS.MipIndex
60 && PlaneSlice >= RHS.PlaneSlice
61 && ArraySlice >= RHS.ArraySlice;
62 }
63
67};
68
70{
76
82
84 : FRDGTextureSubresourceLayout(Desc.NumMips, Desc.ArraySize * (Desc.IsTextureCube() ? 6 : 1), IsStencilFormat(Desc.Format) ? 2 : 1)
85 {}
86
88 {
90 }
91
93 {
94 check(Subresource < GetMaxSubresource());
95 return Subresource.MipIndex + (Subresource.ArraySlice * NumMips) + (Subresource.PlaneSlice * NumMips * NumArraySlices);
96 }
97
99 {
100 FRDGTextureSubresource Subresource;
101 Subresource.MipIndex = Index % NumMips;
102 Subresource.ArraySlice = (Index / NumMips) % NumArraySlices;
103 Subresource.PlaneSlice = Index / (NumMips * NumArraySlices);
104 return Subresource;
105 }
106
111
112 inline bool operator == (FRDGTextureSubresourceLayout const& RHS) const
113 {
114 return NumMips == RHS.NumMips
117 }
118
119 inline bool operator != (FRDGTextureSubresourceLayout const& RHS) const
120 {
121 return !(*this == RHS);
122 }
123
127};
128
130{
132 : MipIndex(0)
133 , PlaneSlice(0)
134 , ArraySlice(0)
135 , NumMips(0)
136 , NumPlaneSlices(0)
137 , NumArraySlices(0)
138 {}
139
148
150 {
151 return MipIndex == RHS.MipIndex
152 && PlaneSlice == RHS.PlaneSlice
153 && ArraySlice == RHS.ArraySlice
154 && NumMips == RHS.NumMips
157 }
158
160 {
161 return !(*this == RHS);
162 }
163
165 {
167 }
168
173
178
179 template <typename TFunction>
196
198 {
199 return MipIndex == 0
200 && PlaneSlice == 0
201 && ArraySlice == 0
202 && NumMips == Layout.NumMips
203 && NumPlaneSlices == Layout.NumPlaneSlices
204 && NumArraySlices == Layout.NumArraySlices;
205 }
206
208 {
209 return MipIndex + NumMips <= Layout.NumMips
210 && PlaneSlice + NumPlaneSlices <= Layout.NumPlaneSlices
211 && ArraySlice + NumArraySlices <= Layout.NumArraySlices;
212 }
213
220};
221
222template <typename ElementType, typename AllocatorType>
224{
225 checkf(Layout.GetSubresourceCount() > 0, TEXT("Subresource layout has no subresources."));
226 checkf(SubresourceArray.Num() == Layout.GetSubresourceCount(), TEXT("Subresource array does not match the subresource layout."));
227}
228
229template <typename ElementType, typename AllocatorType>
231{
232 const uint32 SubresourceCount = Layout.GetSubresourceCount();
233 SubresourceArray.SetNumUninitialized(SubresourceCount, EAllowShrinking::No);
234 for (uint32 SubresourceIndex = 0; SubresourceIndex < SubresourceCount; ++SubresourceIndex)
235 {
237 }
238}
239
240template <typename ElementType, typename AllocatorType>
246
247template <typename ElementType, typename AllocatorType>
253
254template <typename ElementType, typename AllocatorType, typename FunctionType>
263
264template <typename ElementType, typename AllocatorType, typename FunctionType>
#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
bool IsStencilFormat(EPixelFormat Format)
Definition PixelFormat.h:409
void EnumerateSubresourceRange(TRDGTextureSubresourceArray< ElementType, AllocatorType > &SubresourceArray, const FRDGTextureSubresourceLayout &Layout, const FRDGTextureSubresourceRange &Range, FunctionType Function)
Definition RenderGraphTextureSubresource.h:255
const ElementType & GetSubresource(const TRDGTextureSubresourceArray< ElementType, AllocatorType > &SubresourceArray, const FRDGTextureSubresourceLayout &Layout, FRDGTextureSubresource Subresource)
Definition RenderGraphTextureSubresource.h:241
void VerifyLayout(const TRDGTextureSubresourceArray< ElementType, AllocatorType > &SubresourceArray, const FRDGTextureSubresourceLayout &Layout)
Definition RenderGraphTextureSubresource.h:223
void InitTextureSubresources(TRDGTextureSubresourceArray< ElementType, AllocatorType > &SubresourceArray, const FRDGTextureSubresourceLayout &Layout, const ElementType &Element={})
Definition RenderGraphTextureSubresource.h:230
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Array.h:670
Definition AndroidPlatformMisc.h:14
@ Element
Definition Visu.h:18
U16 Index
Definition radfft.cpp:71
Definition RenderGraphTextureSubresource.h:70
FRDGTextureSubresourceLayout()
Definition RenderGraphTextureSubresource.h:71
uint32 NumMips
Definition RenderGraphTextureSubresource.h:124
uint32 NumArraySlices
Definition RenderGraphTextureSubresource.h:126
FRDGTextureSubresource GetMaxSubresource() const
Definition RenderGraphTextureSubresource.h:107
FRDGTextureSubresourceLayout(uint32 InNumMips, uint32 InNumArraySlices, uint32 InNumPlaneSlices)
Definition RenderGraphTextureSubresource.h:77
FRDGTextureSubresourceLayout(const FRHITextureDesc &Desc)
Definition RenderGraphTextureSubresource.h:83
uint32 GetSubresourceCount() const
Definition RenderGraphTextureSubresource.h:87
uint32 NumPlaneSlices
Definition RenderGraphTextureSubresource.h:125
bool operator!=(FRDGTextureSubresourceLayout const &RHS) const
Definition RenderGraphTextureSubresource.h:119
bool operator==(FRDGTextureSubresourceLayout const &RHS) const
Definition RenderGraphTextureSubresource.h:112
FRDGTextureSubresource GetSubresource(uint32 Index) const
Definition RenderGraphTextureSubresource.h:98
uint32 GetSubresourceIndex(FRDGTextureSubresource Subresource) const
Definition RenderGraphTextureSubresource.h:92
Definition RenderGraphTextureSubresource.h:130
uint32 ArraySlice
Definition RenderGraphTextureSubresource.h:216
bool operator==(FRDGTextureSubresourceRange const &RHS) const
Definition RenderGraphTextureSubresource.h:149
uint32 NumMips
Definition RenderGraphTextureSubresource.h:217
FRDGTextureSubresourceRange(FRDGTextureSubresourceLayout Layout)
Definition RenderGraphTextureSubresource.h:140
uint32 MipIndex
Definition RenderGraphTextureSubresource.h:214
uint32 GetSubresourceCount() const
Definition RenderGraphTextureSubresource.h:164
uint32 NumArraySlices
Definition RenderGraphTextureSubresource.h:219
FRDGTextureSubresource GetMaxSubresource() const
Definition RenderGraphTextureSubresource.h:174
uint32 NumPlaneSlices
Definition RenderGraphTextureSubresource.h:218
FRDGTextureSubresource GetMinSubresource() const
Definition RenderGraphTextureSubresource.h:169
bool IsValid(const FRDGTextureSubresourceLayout &Layout) const
Definition RenderGraphTextureSubresource.h:207
void EnumerateSubresources(TFunction Function) const
Definition RenderGraphTextureSubresource.h:180
bool IsWholeResource(const FRDGTextureSubresourceLayout &Layout) const
Definition RenderGraphTextureSubresource.h:197
FRDGTextureSubresourceRange()
Definition RenderGraphTextureSubresource.h:131
bool operator!=(FRDGTextureSubresourceRange const &RHS) const
Definition RenderGraphTextureSubresource.h:159
uint32 PlaneSlice
Definition RenderGraphTextureSubresource.h:215
Definition RenderGraphTextureSubresource.h:11
FRDGTextureSubresource(uint32 InMipIndex, uint32 InArraySlice, uint32 InPlaneSlice)
Definition RenderGraphTextureSubresource.h:18
uint32 PlaneSlice
Definition RenderGraphTextureSubresource.h:65
bool operator!=(const FRDGTextureSubresource &RHS) const
Definition RenderGraphTextureSubresource.h:31
bool operator>(const FRDGTextureSubresource &RHS) const
Definition RenderGraphTextureSubresource.h:50
FRDGTextureSubresource()
Definition RenderGraphTextureSubresource.h:12
bool operator<=(const FRDGTextureSubresource &RHS) const
Definition RenderGraphTextureSubresource.h:43
bool operator==(const FRDGTextureSubresource &RHS) const
Definition RenderGraphTextureSubresource.h:24
bool operator<(const FRDGTextureSubresource &RHS) const
Definition RenderGraphTextureSubresource.h:36
uint32 MipIndex
Definition RenderGraphTextureSubresource.h:64
bool operator>=(const FRDGTextureSubresource &RHS) const
Definition RenderGraphTextureSubresource.h:57
uint32 ArraySlice
Definition RenderGraphTextureSubresource.h:66
Definition RHIResources.h:1689