UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RHIResources.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
7#include "HAL/UnrealMemory.h"
8#include "Containers/Array.h"
9#include "Misc/Crc.h"
11#include "UObject/NameTypes.h"
12#include "Math/Color.h"
16#include "PixelFormat.h"
17#include "Async/TaskGraphFwd.h"
18#include "RHIFwd.h"
20#include "RHITransition.h"
21#include "MultiGPU.h"
22#include "Math/IntPoint.h"
23#include "Math/IntRect.h"
24#include "Math/IntVector.h"
25#include "Misc/SecureHash.h"
26
27#include <atomic>
28
38
40struct FRHIResourceInfo;
42enum class EClearBinding;
43
45
51
54{
55public:
57
58protected:
59 // RHI resources should only be destructed via the deletion queue,
60 // so this is protected to prevent others from 'delete'ing these directly.
61 RHI_API virtual ~FRHIResource();
62
63private:
64 // Separate function to avoid force inlining this everywhere. Helps both for code size and performance.
65 RHI_API void MarkForDelete() const;
66
67 friend class FDynamicRHI;
69 static RHI_API void DeleteResources(TArray<FRHIResource*> const& Resources);
70 static RHI_API void GatherResourcesToDelete(TArray<FRHIResource*>& OutResources, bool bIncludeExtendedLifetimeResources);
71
72public:
73 inline uint32 AddRef() const
74 {
75 int32 NewValue = AtomicFlags.AddRef(std::memory_order_acquire);
76 checkSlow(NewValue > 0);
77 return uint32(NewValue);
78 }
79
80 inline uint32 Release() const
81 {
82 int32 NewValue = AtomicFlags.Release(std::memory_order_release);
83 check(NewValue >= 0);
84
85 if (NewValue == 0)
86 {
87 MarkForDelete();
88 }
89 checkSlow(NewValue >= 0);
90 return uint32(NewValue);
91 }
92
93 inline uint32 GetRefCount() const
94 {
95 int32 CurrentValue = AtomicFlags.GetNumRefs(std::memory_order_relaxed);
96 checkSlow(CurrentValue >= 0);
97 return uint32(CurrentValue);
98 }
99
100 bool IsValid() const
101 {
102 return AtomicFlags.IsValid(std::memory_order_relaxed);
103 }
104
106 {
107 ensureMsgf(IsValid(), TEXT("Resource is already marked for deletion. This call is a no-op. DisableLifetimeExtension must be called while still holding a live reference."));
108 bAllowExtendLifetime = false;
109 }
110
111 inline ERHIResourceType GetType() const { return ResourceType; }
112
113 inline FName GetOwnerName() const
114 {
115#if RHI_ENABLE_RESOURCE_INFO
116 return OwnerName;
117#else
118 return NAME_None;
119#endif
120 }
121
123 {
124#if RHI_ENABLE_RESOURCE_INFO
125 OwnerName = InOwnerName;
126#endif
127 }
128
129#if RHI_ENABLE_RESOURCE_INFO
130 // Get resource info if available.
131 // Should return true if the ResourceInfo was filled with data.
133
136 static void StartTrackingAllResources();
137 static void StopTrackingAllResources();
138#endif
139
140private:
141 class FAtomicFlags
142 {
143 static constexpr uint32 MarkedForDeleteBit = 1 << 30;
144 static constexpr uint32 DeletingBit = 1 << 31;
145 static constexpr uint32 NumRefsMask = ~(MarkedForDeleteBit | DeletingBit);
146
147 std::atomic_uint Packed = { 0 };
148
149 public:
150 int32 AddRef(std::memory_order MemoryOrder)
151 {
152 uint32 OldPacked = Packed.fetch_add(1, MemoryOrder);
153 checkf((OldPacked & DeletingBit) == 0, TEXT("Resource is being deleted."));
154 int32 NumRefs = (OldPacked & NumRefsMask) + 1;
155 checkf(NumRefs < NumRefsMask, TEXT("Reference count has overflowed."));
156 return NumRefs;
157 }
158
159 int32 Release(std::memory_order MemoryOrder)
160 {
161 uint32 OldPacked = Packed.fetch_sub(1, MemoryOrder);
162 checkf((OldPacked & DeletingBit) == 0, TEXT("Resource is being deleted."));
163 int32 NumRefs = (OldPacked & NumRefsMask) - 1;
164 checkf(NumRefs >= 0, TEXT("Reference count has underflowed."));
165 return NumRefs;
166 }
167
168 bool MarkForDelete(std::memory_order MemoryOrder)
169 {
170 uint32 OldPacked = Packed.fetch_or(MarkedForDeleteBit, MemoryOrder);
171 check((OldPacked & DeletingBit) == 0);
172 return (OldPacked & MarkedForDeleteBit) != 0;
173 }
174
175 bool UnmarkForDelete(std::memory_order MemoryOrder)
176 {
177 uint32 OldPacked = Packed.fetch_xor(MarkedForDeleteBit, MemoryOrder);
178 check((OldPacked & DeletingBit) == 0);
179 bool OldMarkedForDelete = (OldPacked & MarkedForDeleteBit) != 0;
180 check(OldMarkedForDelete == true);
181 return OldMarkedForDelete;
182 }
183
184 bool Deleting()
185 {
186 uint32 LocalPacked = Packed.load(std::memory_order_acquire);
187 check((LocalPacked & MarkedForDeleteBit) != 0);
188 check((LocalPacked & DeletingBit) == 0);
189 uint32 NumRefs = LocalPacked & NumRefsMask;
190
191 if (NumRefs == 0) // caches can bring dead objects back to life
192 {
193#if DO_CHECK
194 Packed.fetch_or(DeletingBit, std::memory_order_acquire);
195#endif
196 return true;
197 }
198 else
199 {
200 UnmarkForDelete(std::memory_order_release);
201 return false;
202 }
203 }
204
205 bool IsValid(std::memory_order MemoryOrder)
206 {
207 uint32 LocalPacked = Packed.load(MemoryOrder);
208 return (LocalPacked & MarkedForDeleteBit) == 0 && (LocalPacked & NumRefsMask) != 0;
209 }
210
211 bool IsMarkedForDelete(std::memory_order MemoryOrder)
212 {
213 return (Packed.load(MemoryOrder) & MarkedForDeleteBit) != 0;
214 }
215
216 int32 GetNumRefs(std::memory_order MemoryOrder)
217 {
218 return Packed.load(MemoryOrder) & NumRefsMask;
219 }
220 };
221 mutable FAtomicFlags AtomicFlags;
222
223 const ERHIResourceType ResourceType;
224 uint8 bCommitted : 1;
225 uint8 bAllowExtendLifetime : 1;
226#if RHI_ENABLE_RESOURCE_INFO
228 FName OwnerName;
229#endif
230
231#if DO_CHECK
232 static thread_local FRHIResource const* CurrentlyDeleting;
233#endif
234
236};
237
239{
240 ENoneBound, //no clear color associated with this target. Target will not do hardware clears on most platforms
241 EColorBound, //target has a clear color bound. Clears will use the bound color, and do hardware clears.
242 EDepthStencilBound, //target has a depthstencil value bound. Clears will use the bound values and do hardware clears.
243};
244
246{
247 struct DSVAlue
248 {
249 float Depth;
251 };
252
255 {
256 Value.Color[0] = 0.0f;
257 Value.Color[1] = 0.0f;
258 Value.Color[2] = 0.0f;
259 Value.Color[3] = 0.0f;
260 }
261
264 {
266
267 Value.Color[0] = 0.0f;
268 Value.Color[1] = 0.0f;
269 Value.Color[2] = 0.0f;
270 Value.Color[3] = 0.0f;
271
272 Value.DSValue.Depth = 0.0f;
274 }
275
284
285 explicit FClearValueBinding(float DepthClearValue, uint32 StencilClearValue = 0)
287 {
288 Value.DSValue.Depth = DepthClearValue;
290 }
291
297
304
306 {
307 if (ColorBinding == Other.ColorBinding)
308 {
310 {
311 return
312 Value.Color[0] == Other.Value.Color[0] &&
313 Value.Color[1] == Other.Value.Color[1] &&
314 Value.Color[2] == Other.Value.Color[2] &&
315 Value.Color[3] == Other.Value.Color[3];
316
317 }
319 {
320 return
321 Value.DSValue.Depth == Other.Value.DSValue.Depth &&
322 Value.DSValue.Stencil == Other.Value.DSValue.Stencil;
323 }
324 return true;
325 }
326 return false;
327 }
328
330 {
331 uint32 Hash = GetTypeHash(Binding.ColorBinding);
332
333 if (Binding.ColorBinding == EClearBinding::EColorBound)
334 {
335 Hash = HashCombine(Hash, GetTypeHash(Binding.Value.Color[0]));
336 Hash = HashCombine(Hash, GetTypeHash(Binding.Value.Color[1]));
337 Hash = HashCombine(Hash, GetTypeHash(Binding.Value.Color[2]));
338 Hash = HashCombine(Hash, GetTypeHash(Binding.Value.Color[3]));
339 }
340 else if (Binding.ColorBinding == EClearBinding::EDepthStencilBound)
341 {
342 Hash = HashCombine(Hash, GetTypeHash(Binding.Value.DSValue.Depth ));
343 Hash = HashCombine(Hash, GetTypeHash(Binding.Value.DSValue.Stencil));
344 }
345
346 return Hash;
347 }
348
350
356
357 // common clear values
369};
370
371struct UE_DEPRECATED(5.6, "FRHIResourceCreateInfo is no longer used. Please use FRHIBufferCreateDesc or FRHITextureCreateDesc.") FRHIResourceCreateInfo
372{
374 FRHIResourceCreateInfo() = default;
375
377 : DebugName(InDebugName)
378 {
380 }
381
382 // for CreateBuffer calls
385 {
387 }
389
390 FName GetTraceClassName() const { const static FLazyName FRHIBufferName(TEXT("FRHIBuffer")); return (ClassName == NAME_None) ? FRHIBufferName : ClassName; }
391
392 // for CreateBuffer calls
393 UE_DEPRECATED(5.6, "Please use FRHIBufferCreateDesc for creating buffers with Resource Arrays")
395
396 // set of GPUs on which to create the resource
397 FRHIGPUMask GPUMask = FRHIGPUMask::All();
398
399 // whether to create an RHI object with no underlying resource
401
402 const TCHAR* DebugName;
403
404 FName ClassName = NAME_None; // The owner class of FRHIBuffer used for Insight asset metadata tracing
405 FName OwnerName = NAME_None; // The owner name used for Insight asset metadata tracing
406};
407
409{
410public:
411 enum Type
412 {
413 // don't use those directly, use the combined versions below
414 // 4 bits are used for depth and 4 for stencil to make the hex value readable and non overlapping
415 DepthNop = 0x00,
416 DepthRead = 0x01,
417 DepthWrite = 0x02,
418 DepthMask = 0x0f,
419 StencilNop = 0x00,
420 StencilRead = 0x10,
421 StencilWrite = 0x20,
422 StencilMask = 0xf0,
423
424 // use those:
425 DepthNop_StencilNop = DepthNop + StencilNop,
426 DepthRead_StencilNop = DepthRead + StencilNop,
427 DepthWrite_StencilNop = DepthWrite + StencilNop,
428 DepthNop_StencilRead = DepthNop + StencilRead,
429 DepthRead_StencilRead = DepthRead + StencilRead,
430 DepthWrite_StencilRead = DepthWrite + StencilRead,
431 DepthNop_StencilWrite = DepthNop + StencilWrite,
432 DepthRead_StencilWrite = DepthRead + StencilWrite,
433 DepthWrite_StencilWrite = DepthWrite + StencilWrite,
434 };
435
436private:
437 Type Value;
438
439public:
440 // constructor
441 FExclusiveDepthStencil(Type InValue = DepthNop_StencilNop)
442 : Value(InValue)
443 {
444 }
445
446 inline bool IsUsingDepthStencil() const
447 {
448 return Value != DepthNop_StencilNop;
449 }
450 inline bool IsUsingDepth() const
451 {
452 return (ExtractDepth() != DepthNop);
453 }
454 inline bool IsUsingStencil() const
455 {
456 return (ExtractStencil() != StencilNop);
457 }
458 inline bool IsDepthWrite() const
459 {
460 return ExtractDepth() == DepthWrite;
461 }
462 inline bool IsDepthRead() const
463 {
464 return ExtractDepth() == DepthRead;
465 }
466 inline bool IsStencilWrite() const
467 {
468 return ExtractStencil() == StencilWrite;
469 }
470 inline bool IsStencilRead() const
471 {
472 return ExtractStencil() == StencilRead;
473 }
474
475 inline bool IsAnyWrite() const
476 {
477 return IsDepthWrite() || IsStencilWrite();
478 }
479
480 inline void SetDepthWrite()
481 {
482 Value = (Type)(ExtractStencil() | DepthWrite);
483 }
484 inline void SetStencilWrite()
485 {
486 Value = (Type)(ExtractDepth() | StencilWrite);
487 }
488 inline void SetDepthStencilWrite(bool bDepth, bool bStencil)
489 {
490 Value = DepthNop_StencilNop;
491
492 if (bDepth)
493 {
494 SetDepthWrite();
495 }
496 if (bStencil)
497 {
498 SetStencilWrite();
499 }
500 }
502 {
503 return Value == rhs.Value;
504 }
505
507 {
508 return Value != RHS.Value;
509 }
510
512 {
513 Type Depth = ExtractDepth();
514
515 if (Depth != DepthNop && Depth != Current.ExtractDepth())
516 {
517 return false;
518 }
519
520 Type Stencil = ExtractStencil();
521
522 if (Stencil != StencilNop && Stencil != Current.ExtractStencil())
523 {
524 return false;
525 }
526
527 return true;
528 }
529
531 {
533
534 // SRV access is allowed whilst a depth stencil target is "readable".
535 constexpr ERHIAccess DSVReadOnlyMask =
537
538 // If write access is required, only the depth block can access the resource.
539 constexpr ERHIAccess DSVReadWriteMask =
542
543 if (IsUsingDepth())
544 {
545 DepthAccess = IsDepthWrite() ? DSVReadWriteMask : DSVReadOnlyMask;
546 }
547
549
550 if (IsUsingStencil())
551 {
552 StencilAccess = IsStencilWrite() ? DSVReadWriteMask : DSVReadOnlyMask;
553 }
554 }
555
556 template <typename TFunction>
558 {
559 if (!IsUsingDepthStencil())
560 {
561 return;
562 }
563
566 GetAccess(DepthAccess, StencilAccess);
567
568 // Same depth / stencil state; single subresource.
570 {
572 }
573 // Separate subresources for depth / stencil.
574 else
575 {
577 {
579 }
581 {
583 }
584 }
585 }
586
604
622
624 {
625 // Note: The array to index has views created in that specific order.
626
627 // we don't care about the Nop versions so less views are needed
628 // we combine Nop and Write
629 switch (Value)
630 {
631 case DepthWrite_StencilNop:
632 case DepthNop_StencilWrite:
633 case DepthWrite_StencilWrite:
634 case DepthNop_StencilNop:
635 return 0; // old DSAT_Writable
636
637 case DepthRead_StencilNop:
638 case DepthRead_StencilWrite:
639 return 1; // old DSAT_ReadOnlyDepth
640
641 case DepthNop_StencilRead:
642 case DepthWrite_StencilRead:
643 return 2; // old DSAT_ReadOnlyStencil
644
645 case DepthRead_StencilRead:
646 return 3; // old DSAT_ReadOnlyDepthAndStencil
647 }
648 // should never happen
649 check(0);
650 return -1;
651 }
652 static const uint32 MaxIndex = 4;
653
654private:
655 inline Type ExtractDepth() const
656 {
657 return (Type)(Value & DepthMask);
658 }
659 inline Type ExtractStencil() const
660 {
661 return (Type)(Value & StencilMask);
662 }
663 friend uint32 GetTypeHash(const FExclusiveDepthStencil& Ds);
664};
665
666//
667// State blocks
668//
669
671{
672public:
674 virtual bool IsImmutable() const { return false; }
676};
677
684
686{
687public:
689#if ENABLE_RHI_VALIDATION
691#endif
692 virtual bool GetInitializer(struct FDepthStencilStateInitializerRHI& Init) { return false; }
693};
694
696{
697public:
699 virtual bool GetInitializer(class FBlendStateInitializerRHI& Init) { return false; }
700};
701
702template <typename RHIState, typename RHIStateInitializer>
703static bool MatchRHIState(RHIState* LHSState, RHIState* RHSState)
704{
707 if (LHSState)
708 {
709 LHSState->GetInitializer(LHSStateInitializerRHI);
710 }
711 if (RHSState)
712 {
713 RHSState->GetInitializer(RHSStateInitializerRHI);
714 }
716}
717
718//
719// Shader bindings
720//
721
723
725{
726public:
728 virtual bool GetInitializer(FVertexDeclarationElementList& Init) { return false; }
729 virtual uint32 GetPrecachePSOHash() const { return 0; }
730};
731
737
738//
739// Shaders
740//
741
742#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
743 #define RHI_INCLUDE_SHADER_DEBUG_DATA 1
744#else
745 #define RHI_INCLUDE_SHADER_DEBUG_DATA 0
746#endif
747
748#if RHI_INCLUDE_SHADER_DEBUG_DATA
749 #define RHI_IF_SHADER_DEBUG_DATA(...) __VA_ARGS__
750#else
751 #define RHI_IF_SHADER_DEBUG_DATA(...)
752#endif
753
755{
757 uint32 ResourceTableBits = 0;
758
761
764
767
770
773
776
777 friend bool operator == (const FShaderResourceTable& A, const FShaderResourceTable& B)
778 {
779 bool bEqual = true;
780 bEqual &= (A.ResourceTableBits == B.ResourceTableBits);
781 bEqual &= (A.ShaderResourceViewMap .Num() == B.ShaderResourceViewMap .Num());
782 bEqual &= (A.SamplerMap .Num() == B.SamplerMap .Num());
783 bEqual &= (A.UnorderedAccessViewMap .Num() == B.UnorderedAccessViewMap .Num());
784 bEqual &= (A.ResourceTableLayoutHashes.Num() == B.ResourceTableLayoutHashes.Num());
785 bEqual &= (A.TextureMap .Num() == B.TextureMap .Num());
786 bEqual &= (A.ResourceCollectionMap .Num() == B.ResourceCollectionMap .Num());
787
788 if (!bEqual)
789 {
790 return false;
791 }
792
793 bEqual &= (FMemory::Memcmp(A.ShaderResourceViewMap .GetData(), B.ShaderResourceViewMap .GetData(), A.ShaderResourceViewMap .GetTypeSize() * A.ShaderResourceViewMap .Num()) == 0);
794 bEqual &= (FMemory::Memcmp(A.SamplerMap .GetData(), B.SamplerMap .GetData(), A.SamplerMap .GetTypeSize() * A.SamplerMap .Num()) == 0);
795 bEqual &= (FMemory::Memcmp(A.UnorderedAccessViewMap .GetData(), B.UnorderedAccessViewMap .GetData(), A.UnorderedAccessViewMap .GetTypeSize() * A.UnorderedAccessViewMap .Num()) == 0);
796 bEqual &= (FMemory::Memcmp(A.ResourceTableLayoutHashes.GetData(), B.ResourceTableLayoutHashes.GetData(), A.ResourceTableLayoutHashes.GetTypeSize() * A.ResourceTableLayoutHashes.Num()) == 0);
797 bEqual &= (FMemory::Memcmp(A.TextureMap .GetData(), B.TextureMap .GetData(), A.TextureMap .GetTypeSize() * A.TextureMap .Num()) == 0);
798 bEqual &= (FMemory::Memcmp(A.ResourceCollectionMap .GetData(), B.ResourceCollectionMap .GetData(), A.ResourceCollectionMap .GetTypeSize() * A.ResourceCollectionMap .Num()) == 0);
799 return bEqual;
800 }
801
803 {
804 Ar << SRT.ResourceTableBits;
805 Ar << SRT.ShaderResourceViewMap;
806 Ar << SRT.SamplerMap;
807 Ar << SRT.UnorderedAccessViewMap;
808 Ar << SRT.ResourceTableLayoutHashes;
809 Ar << SRT.TextureMap;
810 Ar << SRT.ResourceCollectionMap;
811
812 return Ar;
813 }
814};
815
816namespace UE
817{
818 namespace RHICore
819 {
820 // Workaround for layering issue. FShaderParametersMetadata is in RenderCore,
821 // so we can't move the logic for initializing the StaticSlots array to the RHI module.
823 }
824}
825
827{
828public:
830 {
831 return ShaderResourceTable;
832 }
833
835 {
836 return StaticSlots;
837 }
838
840 {
841 Ar << ShaderResourceTable;
842 }
843
844protected:
847
848 // Workaround for layering issue. FShaderParametersMetadata is in RenderCore,
849 // so we can't move the logic for initializing the StaticSlots array to the RHI module.
851};
852
854{
855public:
856 void SetHash(const FSHAHash& InHash) { Hash = InHash; }
857 const FSHAHash& GetHash() const { return Hash; }
858
859#if RHI_INCLUDE_SHADER_DEBUG_DATA
860
861 // for debugging only e.g. MaterialName:ShaderFile.usf or ShaderFile.usf/EntryFunc
862 struct
863 {
864 FString ShaderName;
867
868 bool HasShaderName() const { return !Debug.ShaderName.IsEmpty(); }
869
870 const TCHAR* GetShaderName() const
871 {
872 return Debug.ShaderName.Len()
873 ? *Debug.ShaderName
874 : TEXT("<unknown>");
875 }
876
878 {
879 return Debug.UniformBufferNames.IsValidIndex(Index)
880 ? Debug.UniformBufferNames[Index].ToString()
881 : TEXT("<unknown>");
882 }
883
888
889#else
890
891 bool HasShaderName() const { return false; }
892 const TCHAR* GetShaderName() const { return TEXT("<unknown>"); }
893 FString GetUniformBufferName(uint32 Index) const { return TEXT("<unknown>"); }
894
895#endif
896
897 FRHIShader() = delete;
901 , bNoDerivativeOps(false)
902 , bHasShaderBundleUsage(false)
903 {
904 }
905
906#if PLATFORM_WINDOWS
907 RHI_API virtual ~FRHIShader();
908 RHI_API void SetInUseByPSOCompilation(bool bInUse);
909#endif // PLATFORM_WINDOWS
910
912 {
913 return Frequency;
914 }
915
916 inline void SetNoDerivativeOps(bool bValue)
917 {
918 bNoDerivativeOps = bValue;
919 }
920
921 inline bool HasNoDerivativeOps() const
922 {
923 return bNoDerivativeOps;
924 }
925
926 inline void SetShaderBundleUsage(bool bValue)
927 {
928 bHasShaderBundleUsage = bValue;
929 }
930
931 inline bool HasShaderBundleUsage() const
932 {
933 return bHasShaderBundleUsage;
934 }
935
936private:
939 uint8 bNoDerivativeOps : 1;
940 uint8 bHasShaderBundleUsage : 1;
941#if PLATFORM_WINDOWS
942 volatile int16 InUseByPSOCompilation = 0;
943#endif // PLATFORM_WINDOWS
944};
945
952
958
964
970
976
982
984{
985public:
987
988 uint32 RayTracingPayloadType = 0; // This corresponds to the ERayTracingPayloadType enum associated with the shader
989 uint32 RayTracingPayloadSize = 0; // The (maximum) size of the payload associated with this shader
990 uint32 LocalBindingDataSize = 0; // Size of the local shader binding data needed for this shader
991};
992
998
1004
1010
1016
1018{
1019public:
1021 , Stats(nullptr)
1022 {
1023 }
1024
1025 inline void SetStats(struct FPipelineStateStats* Ptr) { Stats = Ptr; }
1026 RHI_API void UpdateStats();
1027
1028private:
1029 struct FPipelineStateStats* Stats;
1030};
1031
1040
1046
1052
1053//
1054// Pipeline States
1055//
1056
1058{
1059public:
1061
1062 inline void SetSortKey(uint64 InSortKey) { SortKey = InSortKey; }
1063 inline uint64 GetSortKey() const { return SortKey; }
1064
1066
1067private:
1068 uint64 SortKey = 0;
1069
1070#if ENABLE_RHI_VALIDATION
1071 friend class FValidationContext;
1072 friend class FValidationRHI;
1074#endif
1075};
1076
1078{
1079public:
1086
1087 inline void SetValid(bool InIsValid) { bIsValid = InIsValid; }
1088 inline bool IsValid() const { return bIsValid; }
1089 virtual void MarkUsed() { bUsed = true; }
1090 bool IsUsed() { return bUsed; }
1091
1093 {
1094 return ComputeShader;
1095 }
1096
1097protected:
1099
1100private:
1101 bool bIsValid = true;
1102 bool bUsed = false;
1103};
1104
1110
1112#if ENABLE_RHI_VALIDATION
1113 , public RHIValidation::FRayTracingPipelineState
1114#endif
1115{
1116public:
1122};
1123
1124//
1125// Buffers
1126//
1127
1129{
1132
1135
1138 {
1139 return A.MemberOffset == B.MemberOffset
1140 && A.MemberType == B.MemberType;
1141 }
1142};
1143
1145
1147
1150{
1152
1154
1155 inline const FString& GetDebugName() const
1156 {
1157 return Name;
1158 }
1159
1160 inline uint32 GetHash() const
1161 {
1162 checkSlow(Hash != 0);
1163 return Hash;
1164 }
1165
1166 inline bool HasRenderTargets() const
1167 {
1168 return RenderTargetsOffset != kUniformBufferInvalidOffset;
1169 }
1170
1175
1176 inline bool HasStaticSlot() const
1177 {
1178 return IsUniformBufferStaticSlotValid(StaticSlot);
1179 }
1180
1181 const FString Name;
1182
1185
1188
1191
1194
1197
1200
1202
1205
1208
1211
1214
1217
1220 {
1221 return A.ConstantBufferSize == B.ConstantBufferSize
1222 && A.StaticSlot == B.StaticSlot
1223 && A.BindingFlags == B.BindingFlags
1224 && A.Resources == B.Resources;
1225 }
1226};
1227
1229#if ENABLE_RHI_VALIDATION
1230 , public RHIValidation::FUniformBufferResource
1231#endif
1232{
1233public:
1235
1239 , Layout(InLayout)
1240 , LayoutConstantBufferSize(InLayout->ConstantBufferSize)
1241 {}
1242
1245 {
1246 check(LayoutConstantBufferSize == Layout->ConstantBufferSize);
1247 return LayoutConstantBufferSize;
1248 }
1249 const FRHIUniformBufferLayout& GetLayout() const { return *Layout; }
1251
1252 const TArray<TRefCountPtr<FRHIResource>>& GetResourceTable() const { return ResourceTable; }
1253
1254protected:
1256
1257private:
1260
1261 uint32 LayoutConstantBufferSize;
1262};
1263
1265{
1266public:
1268 {
1269 return TrackedAccess.Access;
1270 }
1271
1273 {
1274 return Name;
1275 }
1276
1277#if ENABLE_RHI_VALIDATION
1278 virtual RHIValidation::FResource* GetValidationTrackerResource() = 0;
1279#endif
1280
1281protected:
1284 , TrackedAccess(InAccess)
1285 {
1286#if RHI_ENABLE_RESOURCE_INFO
1287 if (InName)
1288 {
1289 Name = FName(InName);
1290 }
1291 SetOwnerName(InOwnerName);
1292#endif
1293 }
1294
1296 {
1297 TrackedAccess = InTrackedAccess;
1298 }
1299
1301 {
1302 TrackedAccess = Other.TrackedAccess;
1303 }
1304
1306 {
1307 TrackedAccess = ERHIAccess::Unknown;
1308 }
1309
1311
1312private:
1313 FRHITrackedAccess TrackedAccess;
1314
1318};
1319
1321{
1324
1326 uint32 Stride = 0;
1327
1330
1331 /* A mask representing which GPUs to create the resource on, in a multi-GPU system. */
1333
1334 FRHIBufferDesc() = default;
1336 : Size (InSize)
1337 , Stride(InStride)
1338 , Usage (InUsage)
1339 {
1340 }
1342 : Size (InSize)
1343 , Stride (InStride)
1344 , Usage (InUsage)
1345 , GPUMask(InGPUMask)
1346 {
1347 }
1348
1350 {
1352 }
1353
1354 bool IsNull() const
1355 {
1357 {
1358 // The null resource descriptor should have its other fields zeroed, and no additional flags.
1359 check(Size == 0 && Stride == 0 && Usage == EBufferUsageFlags::NullResource);
1360 return true;
1361 }
1362
1363 return false;
1364 }
1365
1367 {
1368 uint32 Hash = GetTypeHash(Desc.Size);
1369 Hash = HashCombine(Hash, GetTypeHash(Desc.Stride));
1370 Hash = HashCombine(Hash, GetTypeHash(Desc.Usage));
1371 Hash = HashCombine(Hash, GetTypeHash(Desc.GPUMask.GetNative()));
1372 return Hash;
1373 }
1374
1376 {
1377 return Size == Other.Size
1378 && Stride == Other.Stride
1379 && Usage == Other.Usage
1380 && GPUMask == Other.GPUMask;
1381 }
1382
1384 {
1385 return !(*this == Other);
1386 }
1387
1389 {
1390 Size = Other.Size;
1391 Stride = Other.Stride;
1392 Usage = Other.Usage;
1393 GPUMask = Other.GPUMask;
1394
1395 return *this;
1396 }
1397};
1398
1400
1402{
1403 // Default for the RHI, data can be "undefined"
1404 Default,
1405
1406 // Zero all buffer data
1407 Zeroed,
1408
1409 // Upload data from a provided FResourceArrayUploadInterface. This data will be discarded after it's used.
1411
1412 // Caller will use FRHIBufferInitializer to set the initial buffer contents.
1414};
1415
1417{
1422
1427
1432
1437
1442
1447
1448 template<typename TVertexType>
1453
1458
1463
1464 template<typename TIndexType>
1469
1474
1479
1480 template<typename TStructureType>
1485
1490
1495
1500
1502
1504 : DebugName(InDebugName)
1505 {
1506 Usage = InUsage;
1507 }
1508
1514
1520
1526
1527 FRHIBufferCreateDesc& SetDebugName(const TCHAR* InDebugName) { DebugName = InDebugName; return *this; }
1529 FRHIBufferCreateDesc& DetermineInitialState() { if (InitialState == ERHIAccess::Unknown) InitialState = RHIGetDefaultResourceState(Usage, false); return *this; }
1533
1535 {
1536 return SetInitAction(ERHIBufferInitAction::Default);
1537 }
1551
1553 {
1554 const static FLazyName FRHIBufferName(TEXT("FRHIBuffer"));
1555 return (ClassName == NAME_None) ? FRHIBufferName : ClassName;
1556 }
1557
1558 /* A friendly name for the resource. */
1559 const TCHAR* DebugName = nullptr;
1560
1561 /* Provider of initial data for the buffer. InitialData->Discard() will be called after the data is read. */
1562 FResourceArrayUploadInterface* InitialData = nullptr;
1563
1564 /* The RHI access state that the resource will be created in. */
1566
1567 /* Tells how to initialize (or not) the buffer's data. */
1569
1570 /* The owner class of FRHIBuffer used for Insight asset metadata tracing */
1571 FName ClassName = NAME_None;
1572
1573 /* The owner name used for Insight asset metadata tracing */
1574 FName OwnerName = NAME_None;
1575};
1576
1578#if ENABLE_RHI_VALIDATION
1579 , public RHIValidation::FBufferResource
1580#endif
1581{
1582protected:
1583 FRHIBuffer() = delete;
1584
1586 RHI_API FRHIBuffer(const FRHIBufferCreateDesc& CreateDesc);
1587
1588public:
1590 {
1591 return Desc;
1592 }
1593
1596 {
1597 return Desc.Size;
1598 }
1599
1602 {
1603 return Desc.Stride;
1604 }
1605
1608 {
1609 return Desc.Usage;
1610 }
1611
1612 void SetName(FName InName)
1613 {
1614 Name = InName;
1615 }
1616
1617#if ENABLE_RHI_VALIDATION
1618 virtual RHIValidation::FResource* GetValidationTrackerResource() final override
1619 {
1620 return this;
1621 }
1622#endif
1623
1624protected:
1626 {
1628 Desc = Other.Desc;
1629 }
1630
1636
1637private:
1638 FRHIBufferDesc Desc;
1639};
1640
1643{
1644 friend FRHICommandListBase;
1645 friend FRHICommandList;
1646public:
1651
1652private:
1655 , Buffer(InBuffer)
1656 {}
1657
1659};
1660
1661//
1662// Textures
1663//
1664
1666{
1667public:
1668 FLastRenderTimeContainer() : LastRenderTime(-FLT_MAX) {}
1669
1670 double GetLastRenderTime() const { return LastRenderTime; }
1671
1673 {
1674 // avoid dirty caches from redundant writes
1675 if (LastRenderTime != InLastRenderTime)
1676 {
1677 LastRenderTime = InLastRenderTime;
1678 }
1679 }
1680
1681private:
1683 double LastRenderTime;
1684};
1685
1686
1689{
1690 FRHITextureDesc() = default;
1691
1693 {
1694 *this = Other;
1695 }
1696
1700
1707 , uint16 InDepth
1712 )
1713 : Flags (InFlags )
1714 , ClearValue(InClearValue)
1715 , ExtData (InExtData )
1716 , Extent (InExtent )
1717 , Depth (InDepth )
1718 , ArraySize (InArraySize )
1719 , NumMips (InNumMips )
1720 , NumSamples(InNumSamples)
1722 , Format (InFormat )
1723 {}
1724
1726 {
1727 uint32 Hash = GetTypeHash(Desc.Dimension);
1728 Hash = HashCombine(Hash, GetTypeHash(Desc.Flags ));
1729 Hash = HashCombine(Hash, GetTypeHash(Desc.Format ));
1730 Hash = HashCombine(Hash, GetTypeHash(Desc.UAVFormat ));
1731 Hash = HashCombine(Hash, GetTypeHash(Desc.Extent ));
1732 Hash = HashCombine(Hash, GetTypeHash(Desc.Depth ));
1733 Hash = HashCombine(Hash, GetTypeHash(Desc.ArraySize ));
1734 Hash = HashCombine(Hash, GetTypeHash(Desc.NumMips ));
1735 Hash = HashCombine(Hash, GetTypeHash(Desc.NumSamples));
1736 Hash = HashCombine(Hash, GetTypeHash(Desc.FastVRAMPercentage));
1737 Hash = HashCombine(Hash, GetTypeHash(Desc.ClearValue));
1738 Hash = HashCombine(Hash, GetTypeHash(Desc.ExtData ));
1739 Hash = HashCombine(Hash, GetTypeHash(Desc.GPUMask.GetNative()));
1740 Hash = HashCombine(Hash, GetTypeHash(Desc.AliasableFormats));
1741 // Add BlockBytes to the hash computation to handle cases where PixelFormat changes at runtime (e.g., PF_SceneDepth).
1742 // This ensures the hash correctly reflects changes in block size, preventing potential mismatches or incorrect caching when the pixel format varies dynamically.
1743 Hash = HashCombine(Hash, GetTypeHash(GPixelFormats[Desc.Format].BlockBytes));
1744 return Hash;
1745 }
1746
1747 bool operator == (const FRHITextureDesc& Other) const
1748 {
1749 return Dimension == Other.Dimension
1750 && Flags == Other.Flags
1751 && Format == Other.Format
1752 && UAVFormat == Other.UAVFormat
1753 && Extent == Other.Extent
1754 && Depth == Other.Depth
1755 && ArraySize == Other.ArraySize
1756 && NumMips == Other.NumMips
1757 && NumSamples == Other.NumSamples
1758 && FastVRAMPercentage == Other.FastVRAMPercentage
1759 && ClearValue == Other.ClearValue
1760 && ExtData == Other.ExtData
1761 && GPUMask == Other.GPUMask
1762 && AliasableFormats == Other.AliasableFormats;
1763 }
1764
1766 {
1767 return !(*this == Other);
1768 }
1769
1771 {
1773 Flags = Other.Flags;
1774 Format = Other.Format;
1775 UAVFormat = Other.UAVFormat;
1776 Extent = Other.Extent;
1777 Depth = Other.Depth;
1778 ArraySize = Other.ArraySize;
1779 NumMips = Other.NumMips;
1780 NumSamples = Other.NumSamples;
1781 ClearValue = Other.ClearValue;
1782 ExtData = Other.ExtData;
1783 FastVRAMPercentage = Other.FastVRAMPercentage;
1784 GPUMask = Other.GPUMask;
1785 AliasableFormats = Other.AliasableFormats;
1786
1787 return *this;
1788 }
1789
1794
1795 bool IsTexture3D() const
1796 {
1798 }
1799
1804
1809
1810 bool IsMipChain() const
1811 {
1812 return NumMips > 1;
1813 }
1814
1815 bool IsMultisample() const
1816 {
1817 return NumSamples > 1;
1818 }
1819
1821 {
1822 return FIntVector(Extent.X, Extent.Y, Depth);
1823 }
1824
1825 void Reset()
1826 {
1827 // Usually we don't want to propagate MSAA samples.
1828 NumSamples = 1;
1829
1830 // Remove UAV flag for textures that don't need it (some formats are incompatible).
1833
1834 AliasableFormats.Empty();
1835 }
1836
1838 bool IsValid() const
1839 {
1840 return FRHITextureDesc::Validate(*this, /* Name = */ TEXT(""), /* bFatal = */ false);
1841 }
1842
1845
1848
1849 /* A mask representing which GPUs to create the resource on, in a multi-GPU system. */
1851
1853 uint32 ExtData = 0;
1854
1856 FIntPoint Extent = FIntPoint(1, 1);
1857
1860
1862 uint16 ArraySize = 1;
1863
1865 uint8 NumMips = 1;
1866
1868 uint8 NumSamples = 1;
1869
1872
1875
1878
1880 uint8 FastVRAMPercentage = 0xFF;
1881
1884
1886 static bool CheckValidity(const FRHITextureDesc& Desc, const TCHAR* Name)
1887 {
1888 return FRHITextureDesc::Validate(Desc, Name, /* bFatal = */ true);
1889 }
1890
1901 RHI_API uint64 CalcMemorySizeEstimate(uint32 FirstMipIndex, uint32 LastMipIndex) const;
1902
1903 uint64 CalcMemorySizeEstimate(uint32 FirstMipIndex = 0) const
1904 {
1905 return CalcMemorySizeEstimate(FirstMipIndex, NumMips - 1);
1906 }
1907
1909 {
1911 uint16 NumPlanes = (IsStencilFormat(Format) || Format == PF_D24) ? 2 : 1;
1912
1913 return (ArraySize * (NumMips * NumFaces) * NumPlanes);
1914 }
1915
1916private:
1917 RHI_API static bool Validate(const FRHITextureDesc& Desc, const TCHAR* Name, bool bFatal);
1918};
1919
1920// @todo deprecate
1922
1924
1926{
1927 // Default for the RHI, data can be "undefined" after creation.
1928 Default,
1929
1930 // Upload data from a provided FResourceBulkDataInterface. This data will be discarded after it's used.
1931 BulkData,
1932
1933 // Caller will use FRHITextureInitializer to set the initial texture contents.
1935};
1936
1938{
1943
1948
1953
1958
1963
1968
1970 {
1971 return Create2D(DebugName)
1972 .SetExtent(Size)
1973 .SetFormat(Format);
1974 }
1975
1976 static FRHITextureCreateDesc Create2D(const TCHAR* DebugName, int32 SizeX, int32 SizeY, EPixelFormat Format)
1977 {
1978 return Create2D(DebugName)
1979 .SetExtent(SizeX, SizeY)
1980 .SetFormat(Format);
1981 }
1982
1984 {
1985 return Create2DArray(DebugName)
1986 .SetExtent(Size)
1988 .SetArraySize((uint16)ArraySize);
1989 }
1990
1991 static FRHITextureCreateDesc Create2DArray(const TCHAR* DebugName, int32 SizeX, int32 SizeY, int32 ArraySize, EPixelFormat Format)
1992 {
1993 return Create2DArray(DebugName)
1994 .SetExtent(SizeX, SizeY)
1996 .SetArraySize((uint16)ArraySize);
1997 }
1998
2000 {
2001 return Create3D(DebugName)
2002 .SetExtent(Size.X, Size.Y)
2003 .SetDepth((uint16)Size.Z)
2004 .SetFormat(Format);
2005 }
2006
2007 static FRHITextureCreateDesc Create3D(const TCHAR* DebugName, int32 SizeX, int32 SizeY, int32 SizeZ, EPixelFormat Format)
2008 {
2009 return Create3D(DebugName)
2010 .SetExtent(SizeX, SizeY)
2011 .SetDepth((uint16)SizeZ)
2012 .SetFormat(Format);
2013 }
2014
2016 {
2017 return CreateCube(DebugName)
2018 .SetExtent(Size)
2019 .SetFormat(Format);
2020 }
2021
2023 {
2024 return CreateCubeArray(DebugName)
2025 .SetExtent(Size)
2027 .SetArraySize((uint16)ArraySize);
2028 }
2029
2031
2032 // Constructor with minimal argument set. Name and dimension are always required.
2038
2039 // Constructor for when you already have an FRHITextureDesc
2041 FRHITextureDesc const& InDesc
2043 , TCHAR const* InDebugName
2045 )
2047 , DebugName(InDebugName)
2048 , InitialState(InInitialState)
2049 {
2050 if (InBulkData)
2051 {
2052 SetInitActionBulkData(InBulkData);
2053 }
2054 }
2055
2056 void CheckValidity() const
2057 {
2058 FRHITextureDesc::CheckValidity(*this, DebugName);
2059
2060 ensureMsgf(InitialState != ERHIAccess::Unknown, TEXT("Resource %s cannot be created in an unknown state."), DebugName);
2061 }
2062
2067 FRHITextureCreateDesc& SetExtent(const FIntPoint& InExtent) { Extent = InExtent; return *this; }
2077 FRHITextureCreateDesc& SetDebugName(const TCHAR* InDebugName) { DebugName = InDebugName; return *this; }
2083 FRHITextureCreateDesc& AddAliasbleFormat(EPixelFormat InFormat) { AliasableFormats.Add(InFormat); return *this; }
2084
2086 {
2087 FastVRAMPercentage = uint8(FMath::Clamp(InFastVRAMPercentage, 0.f, 1.0f) * 0xFF);
2088 return *this;
2089 }
2090
2092 {
2093 if (InitialState == ERHIAccess::Unknown)
2094 {
2095 InitialState = RHIGetDefaultResourceState(Flags, BulkData != nullptr);
2096 }
2097 return *this;
2098 }
2099
2101 {
2102 return SetInitAction(ERHITextureInitAction::Default);
2103 }
2113
2114 UE_DEPRECATED(5.6, "SetBulkData has been renamed to SetInitActionBulkData")
2116 {
2117 if (InBulkData)
2118 {
2119 SetInitActionBulkData(InBulkData);
2120 }
2121 return *this;
2122 }
2123
2125 {
2126 const static FLazyName FRHITextureName(TEXT("FRHITexture"));
2127 return (ClassName == NAME_None) ? FRHITextureName : ClassName;
2128 }
2129
2130 /* A friendly name for the resource. */
2131 const TCHAR* DebugName = nullptr;
2132
2133 /* The RHI access state that the resource will be created in. */
2135
2136 /* Tells how to initialize (or not) the texture's data. */
2138
2139 /* Optional initial data to fill the resource with. */
2141
2142 /* The owner class of FRHITexture used for Insight asset metadata tracing */
2143 FName ClassName = NAME_None;
2144
2145 /* The owner name used for Insight asset metadata tracing */
2146 FName OwnerName = NAME_None;
2147};
2148
2150#if ENABLE_RHI_VALIDATION
2151 , public RHIValidation::FTextureResource
2152#endif
2153{
2154protected:
2155 FRHITexture() = delete;
2156
2158 RHI_API FRHITexture(const FRHITextureCreateDesc& CreateDesc);
2159
2162
2163public:
2170 virtual const FRHITextureDesc& GetDesc() const { return TextureDesc; }
2171
2175
2176 virtual class FRHITextureReference* GetTextureReference() { return NULL; }
2178
2185 virtual void* GetNativeResource() const
2186 {
2187 // Override this in derived classes to expose access to the native texture resource
2188 return nullptr;
2189 }
2190
2197 virtual void* GetNativeShaderResourceView() const
2198 {
2199 // Override this in derived classes to expose access to the native texture resource
2200 return nullptr;
2201 }
2202
2207 virtual void* GetTextureBaseRHI()
2208 {
2209 // Override this in derived classes to expose access to the native texture resource
2210 return nullptr;
2211 }
2212
2213 virtual void GetWriteMaskProperties(void*& OutData, uint32& OutSize)
2214 {
2215 OutData = nullptr;
2216 OutSize = 0;
2217 }
2218
2222
2228 {
2229 const FRHITextureDesc& Desc = GetDesc();
2230 switch (Desc.Dimension)
2231 {
2232 case ETextureDimension::Texture2D: return FIntVector(Desc.Extent.X, Desc.Extent.Y, 1);
2233 case ETextureDimension::Texture2DArray: return FIntVector(Desc.Extent.X, Desc.Extent.Y, Desc.ArraySize);
2234 case ETextureDimension::Texture3D: return FIntVector(Desc.Extent.X, Desc.Extent.Y, Desc.Depth);
2235 case ETextureDimension::TextureCube: return FIntVector(Desc.Extent.X, Desc.Extent.Y, 1);
2237 }
2238 return FIntVector(0, 0, 0);
2239 }
2240
2247 {
2248 const FRHITextureDesc& Desc = GetDesc();
2249 return FIntVector(
2250 FMath::Max<int32>(Desc.Extent.X >> MipIndex, 1),
2251 FMath::Max<int32>(Desc.Extent.Y >> MipIndex, 1),
2252 FMath::Max<int32>(Desc.Depth >> MipIndex, 1)
2253 );
2254 }
2255
2257 bool IsMultisampled() const { return GetDesc().NumSamples > 1; }
2258
2260 bool HasClearValue() const
2261 {
2262 return GetDesc().ClearValue.ColorBinding != EClearBinding::ENoneBound;
2263 }
2264
2267 {
2268 return GetDesc().ClearValue.GetClearColor();
2269 }
2270
2273 {
2274 return GetDesc().ClearValue.GetDepthStencil(OutDepth, OutStencil);
2275 }
2276
2279 {
2280 float Depth;
2282 GetDesc().ClearValue.GetDepthStencil(Depth, Stencil);
2283 return Depth;
2284 }
2285
2288 {
2289 float Depth;
2291 GetDesc().ClearValue.GetDepthStencil(Depth, Stencil);
2292 return Stencil;
2293 }
2294
2298
2301 {
2302 LastRenderTime.SetLastRenderTime(InLastRenderTime);
2303 }
2304
2305 double GetLastRenderTime() const
2306 {
2307 return LastRenderTime.GetLastRenderTime();
2308 }
2309
2310 RHI_API void SetName(FName InName);
2311
2315
2316 //UE_DEPRECATED(5.1, "FRHITexture2D is deprecated, please use FRHITexture directly")
2317 inline FRHITexture* GetTexture2D() { return TextureDesc.Dimension == ETextureDimension::Texture2D ? this : nullptr; }
2318 //UE_DEPRECATED(5.1, "FRHITexture2DArray is deprecated, please use FRHITexture directly")
2319 inline FRHITexture* GetTexture2DArray() { return TextureDesc.Dimension == ETextureDimension::Texture2DArray ? this : nullptr; }
2320 //UE_DEPRECATED(5.1, "FRHITexture3D is deprecated, please use FRHITexture directly")
2321 inline FRHITexture* GetTexture3D() { return TextureDesc.Dimension == ETextureDimension::Texture3D ? this : nullptr; }
2322 //UE_DEPRECATED(5.1, "FRHITextureCube is deprecated, please use FRHITexture directly")
2323 inline FRHITexture* GetTextureCube() { return TextureDesc.IsTextureCube() ? this : nullptr; }
2324
2325 //UE_DEPRECATED(5.1, "GetSizeX() is deprecated, please use GetDesc().Extent.X instead")
2326 uint32 GetSizeX() const { return GetDesc().Extent.X; }
2327
2328 //UE_DEPRECATED(5.1, "GetSizeY() is deprecated, please use GetDesc().Extent.Y instead")
2329 uint32 GetSizeY() const { return GetDesc().Extent.Y; }
2330
2331 //UE_DEPRECATED(5.1, "GetSizeXY() is deprecated, please use GetDesc().Extent.X or GetDesc().Extent.Y instead")
2332 FIntPoint GetSizeXY() const { return FIntPoint(GetDesc().Extent.X, GetDesc().Extent.Y); }
2333
2334 //UE_DEPRECATED(5.1, "GetSizeZ() is deprecated, please use GetDesc().ArraySize instead for TextureArrays and GetDesc().Depth for 3D textures")
2335 uint32 GetSizeZ() const { return GetSizeXYZ().Z; }
2336
2337 //UE_DEPRECATED(5.1, "GetNumMips() is deprecated, please use GetDesc().NumMips instead")
2338 uint32 GetNumMips() const { return GetDesc().NumMips; }
2339
2340 //UE_DEPRECATED(5.1, "GetFormat() is deprecated, please use GetDesc().Format instead")
2341 EPixelFormat GetFormat() const { return GetDesc().Format; }
2342
2343 //UE_DEPRECATED(5.1, "GetFlags() is deprecated, please use GetDesc().Flags instead")
2344 ETextureCreateFlags GetFlags() const { return GetDesc().Flags; }
2345
2346 //UE_DEPRECATED(5.1, "GetNumSamples() is deprecated, please use GetDesc().NumSamples instead")
2347 uint32 GetNumSamples() const { return GetDesc().NumSamples; }
2348
2349 //UE_DEPRECATED(5.1, "GetClearBinding() is deprecated, please use GetDesc().ClearValue instead")
2350 const FClearValueBinding GetClearBinding() const { return GetDesc().ClearValue; }
2351
2352 //UE_DEPRECATED(5.1, "GetSize() is deprecated, please use GetDesc().Extent.X instead")
2353 uint32 GetSize() const { check(GetDesc().IsTextureCube()); return GetDesc().Extent.X; }
2354
2355#if ENABLE_RHI_VALIDATION
2356 virtual RHIValidation::FResource* GetValidationTrackerResource() override
2357 {
2358 // Use the method inherited from RHIValidation::FTextureResource, as that's already a virtual overridden
2359 // by subclasses such as FRHITextureReference to return the correct storage for the tracker information.
2360 return GetTrackerResource();
2361 }
2362#endif
2363
2364private:
2366
2367 FRHITextureDesc TextureDesc;
2368
2369 FLastRenderTimeContainer LastRenderTime;
2370};
2371
2372//
2373// Misc
2374//
2375
2376#if (RHI_NEW_GPU_PROFILER == 0)
2378{
2379public:
2383};
2384#endif
2385
2387{
2388public:
2391 , FenceName(InName)
2392 {}
2393
2394 virtual void Clear() = 0;
2395
2408 virtual bool Poll() const = 0;
2409
2421 virtual bool Poll(FRHIGPUMask GPUMask) const
2422 {
2423 checkf(GPUMask == FRHIGPUMask::GPU0(), TEXT("The current platform RHI does not implement MGPU support for RHI GPU fences."));
2424 return Poll();
2425 }
2426
2433 virtual void Wait(FRHICommandListImmediate& RHICmdList, FRHIGPUMask GPUMask) const = 0;
2434
2435 FName GetFName() const { return FenceName; }
2436
2438
2439protected:
2441};
2442
2444{
2445public:
2447};
2448
2450
2452{
2454 FRHIRenderQueryPool* QueryPool = nullptr;
2455
2456public:
2460
2465
2466 bool IsValid() const
2467 {
2468 return Query.IsValid();
2469 }
2470
2472 {
2473 return Query;
2474 }
2475
2476 void ReleaseQuery();
2477};
2478
2480{
2481public:
2485
2486private:
2488 virtual void ReleaseQuery(TRefCountPtr<FRHIRenderQuery>&& Query) = 0;
2489};
2490
2497
2499{
2500 if (QueryPool && Query.IsValid())
2501 {
2502 QueryPool->ReleaseQuery(MoveTemp(Query));
2503 QueryPool = nullptr;
2504 }
2505 check(!Query.IsValid());
2506}
2507
2513
2515{
2516public:
2518
2525 virtual void* GetNativeSwapChain() const { return nullptr; }
2532 virtual void* GetNativeBackBufferTexture() const { return nullptr; }
2539 virtual void* GetNativeBackBufferRT() const { return nullptr; }
2540
2548 virtual void* GetNativeWindow(void** AddParam = nullptr) const { return nullptr; }
2549
2553 virtual void SetCustomPresent(class FRHICustomPresent*) {}
2554
2558 virtual class FRHICustomPresent* GetCustomPresent() const { return nullptr; }
2559
2560 virtual FRHITexture* GetOptionalSDRBackBuffer(FRHITexture* BackBuffer) const { return nullptr; }
2561
2565 virtual void Tick(float DeltaTime) {}
2566
2568
2569 virtual void IssueFrameEvent() { }
2570};
2571
2574{
2575 // The primary plane is used with default compression behavior.
2576 Primary = 0,
2577
2578 // The primary plane is used without decompressing it.
2580
2581 // The depth plane is used with default compression behavior.
2582 Depth = 2,
2583
2584 // The stencil plane is used with default compression behavior.
2585 Stencil = 3,
2586
2587 // The HTile plane is used.
2588 HTile = 4,
2589
2590 // the FMask plane is used.
2591 FMask = 5,
2592
2593 // the CMask plane is used.
2594 CMask = 6,
2595
2596 // This enum is packed into various structures. Avoid adding new
2597 // members without verifying structure sizes aren't increased.
2598 Num,
2599 NumBits = 3,
2600
2601 // @todo deprecate
2602 None = Primary,
2604};
2605static_assert((1u << uint32(ERHITexturePlane::NumBits)) >= uint32(ERHITexturePlane::Num), "Not enough bits in the ERHITexturePlane enum");
2606
2607//UE_DEPRECATED(5.3, "Use ERHITexturePlane.")
2609
2610//
2611// Views
2612//
2613
2614template <typename TType>
2616{
2617 TType First = 0;
2618 TType Num = 0;
2619
2620 TRHIRange() = default;
2629
2630 TType ExclusiveLast() const { return First + Num; }
2631 TType InclusiveLast() const { return First + Num - 1; }
2632
2634 {
2636 return Value >= First && Value < ExclusiveLast();
2637 }
2638};
2639
2642
2643//
2644// The unified RHI view descriptor. These are stored in the base FRHIView type, and packed to minimize memory usage.
2645// Platform RHI implementations use the GetViewInfo() functions to convert an FRHIViewDesc into the required info to make a view / descriptor for the GPU.
2646//
2648{
2649 enum class EViewType : uint8
2650 {
2651 BufferSRV,
2652 BufferUAV,
2653 TextureSRV,
2655 };
2656
2657 enum class EBufferType : uint8
2658 {
2659 Unknown = 0,
2660
2661 Typed = 1,
2662 Structured = 2,
2664 Raw = 4
2665 };
2666
2667 enum class EDimension : uint8
2668 {
2669 Unknown = 0,
2670
2671 Texture2D = 1,
2672 Texture2DArray = 2,
2673 TextureCube = 3,
2674 TextureCubeArray = 4,
2675 Texture3D = 5,
2676
2677 NumBits = 3
2678 };
2679
2680 // Properties that apply to all views.
2686
2687 // Properties shared by buffer views. Some fields are SRV or UAV specific.
2688 struct FBuffer : public FCommon
2689 {
2691 uint8 bAtomicCounter : 1; // UAV only
2692 uint8 bAppendBuffer : 1; // UAV only
2693 uint8 /* padding */ : 6;
2695 union
2696 {
2697 struct
2698 {
2701 };
2702 FRHIRayTracingScene* RayTracingScene; // only if BufferType == AccelerationStructure
2703 };
2704
2705 struct FViewInfo;
2706 protected:
2708 };
2709
2710 // Properties shared by texture views. Some fields are SRV or UAV specific.
2723
2724 struct FBufferSRV : public FBuffer
2725 {
2726 struct FInitializer;
2727 struct FViewInfo;
2729 };
2730
2731 struct FBufferUAV : public FBuffer
2732 {
2733 struct FInitializer;
2734 struct FViewInfo;
2736 };
2737
2738 struct FTextureSRV : public FTexture
2739 {
2740 struct FInitializer;
2741 struct FViewInfo;
2743 };
2744
2745 struct FTextureUAV : public FTexture
2746 {
2747 struct FInitializer;
2748 struct FViewInfo;
2750 };
2751
2752 union
2753 {
2755 union
2756 {
2760 union
2761 {
2765 };
2766
2767 static inline FBufferSRV::FInitializer CreateBufferSRV();
2768 static inline FBufferUAV::FInitializer CreateBufferUAV();
2769
2770 static inline FTextureSRV::FInitializer CreateTextureSRV();
2771 static inline FTextureUAV::FInitializer CreateTextureUAV();
2772
2774 bool IsUAV() const { return !IsSRV(); }
2775
2777 bool IsTexture() const { return !IsBuffer(); }
2778
2779 bool operator == (FRHIViewDesc const& RHS) const
2780 {
2781 return FMemory::Memcmp(this, &RHS, sizeof(*this)) == 0;
2782 }
2783
2784 bool operator != (FRHIViewDesc const& RHS) const
2785 {
2786 return !(*this == RHS);
2787 }
2788
2791 {
2792 FMemory::Memzero(*this);
2793 }
2794
2795 static const TCHAR* GetBufferTypeString(EBufferType BufferType);
2797
2798protected:
2800 {
2801 FMemory::Memzero(*this);
2802 Common.ViewType = ViewType;
2803 }
2804};
2805
2806// These static asserts are to ensure the descriptor is minimal in size and can be copied around by-value.
2807// If they fail, consider re-packing the struct.
2808static_assert(sizeof(FRHIViewDesc) == 16, "Packing of FRHIViewDesc is unexpected.");
2809static_assert(TIsTrivial<FRHIViewDesc>::Value, "FRHIViewDesc must be a trivial type.");
2810
2812{
2817
2818protected:
2822
2823public:
2825 {
2826 check(Type != EBufferType::Unknown);
2827 Buffer.SRV.BufferType = Type;
2828 return *this;
2829 }
2830
2831 //
2832 // Provided for back-compat with existing code. Consider using SetType() instead for more direct control over the view.
2833 // For example, it is possible to create a typed view of a BUF_ByteAddress buffer, but not using this function which always choses raw access.
2834 //
2836 {
2838 checkf(!TargetBuffer->GetDesc().IsNull(), TEXT("Null buffer resources are placeholders for the streaming system. They do not contain a valid descriptor for this function to use. Call SetType() instead."));
2839
2840 Buffer.SRV.BufferType =
2845 return *this;
2846 }
2847
2849 {
2850 Buffer.SRV.Format = InFormat;
2851 return *this;
2852 }
2853
2855 {
2856 Buffer.SRV.OffsetInBytes = InOffsetBytes;
2857 return *this;
2858 }
2859
2861 {
2862 check(Buffer.SRV.BufferType != EBufferType::Unknown && Buffer.SRV.BufferType != EBufferType::AccelerationStructure);
2863 Buffer.SRV.Stride = InStride;
2864 return *this;
2865 }
2866
2868 {
2869 check(Buffer.SRV.BufferType != EBufferType::Unknown && Buffer.SRV.BufferType != EBufferType::AccelerationStructure);
2870 Buffer.SRV.NumElements = InNumElements;
2871 return *this;
2872 }
2873
2875 {
2877 Buffer.SRV.RayTracingScene = InRayTracingScene;
2878 return *this;
2879 }
2880};
2881
2883{
2886
2887protected:
2891
2892public:
2894 {
2895 check(Type != EBufferType::Unknown);
2896 Buffer.UAV.BufferType = Type;
2897 return *this;
2898 }
2899
2900 //
2901 // Provided for back-compat with existing code. Consider using SetType() instead for more direct control over the view.
2902 // For example, it is possible to create a typed view of a BUF_ByteAddress buffer, but not using this function which always choses raw access.
2903 //
2905 {
2907 checkf(!TargetBuffer->GetDesc().IsNull(), TEXT("Null buffer resources are placeholders for the streaming system. They do not contain a valid descriptor for this function to use. Call SetType() instead."));
2908
2909 Buffer.UAV.BufferType =
2914 return *this;
2915 }
2916
2918 {
2919 Buffer.UAV.Format = InFormat;
2920 return *this;
2921 }
2922
2924 {
2925 Buffer.UAV.OffsetInBytes = InOffsetBytes;
2926 return *this;
2927 }
2928
2930 {
2931 Buffer.UAV.Stride = InStride;
2932 return *this;
2933 }
2934
2936 {
2937 Buffer.UAV.NumElements = InNumElements;
2938 return *this;
2939 }
2940
2942 {
2943 Buffer.UAV.bAtomicCounter = InAtomicCounter;
2944 return *this;
2945 }
2946
2948 {
2949 Buffer.UAV.bAppendBuffer = InAppendBuffer;
2950 return *this;
2951 }
2952};
2953
2955{
2958
2959protected:
2963
2964public:
2965 //
2966 // Specifies the type of view to create. Must match the shader parameter this view will be bound to.
2967 //
2968 // The dimension is allowed to differ from the underlying resource's dimensions, e.g. to create a view
2969 // compatible with a Texture2D<> shader parameter, but where the underlying resource is a texture 2D array.
2970 //
2971 // Some combinations are not valid, e.g. 3D textures can only have 3D views.
2972 //
2974 {
2975 switch (InDimension)
2976 {
2977 default: checkNoEntry(); break;
2978 case ETextureDimension::Texture2D : Texture.SRV.Dimension = EDimension::Texture2D ; break;
2980 case ETextureDimension::Texture3D : Texture.SRV.Dimension = EDimension::Texture3D ; break;
2981 case ETextureDimension::TextureCube : Texture.SRV.Dimension = EDimension::TextureCube ; break;
2983 }
2984 return *this;
2985 }
2986
2987 //
2988 // Provided for back-compat with existing code. Consider using SetDimension() instead for more direct control over the view.
2989 // For example, it is possible to create a 2D view of a 2DArray texture, but not using this function which always choses 2DArray dimension.
2990 //
2992 {
2994 SetDimension(TargetTexture->GetDesc().Dimension);
2995 return *this;
2996 }
2997
2999 {
3000 Texture.SRV.Format = InFormat;
3001 return *this;
3002 }
3003
3005 {
3006 Texture.SRV.Plane = InPlane;
3007 return *this;
3008 }
3009
3011 {
3012 Texture.SRV.MipRange.First = InFirstMip;
3013 Texture.SRV.MipRange.Num = InNumMips;
3014 return *this;
3015 }
3016
3017 //
3018 // The meaning of array "elements" is given by the dimension of the underlying resource.
3019 // I.e. a view of a TextureCubeArray resource indexes the array in whole cubes.
3020 //
3021 // [0] = the first cube (2D slices 0 to 5)
3022 // [1] = the second cube (2D slices 6 to 11)
3023 //
3024 // If the view dimension is smaller than the resource dimension, the array range will be further limited.
3025 // E.g. creating a Texture2D dimension view of a TextureCubeArray resource
3026 //
3028 {
3029 Texture.SRV.ArrayRange.First = InFirstElement;
3030 Texture.SRV.ArrayRange.Num = InNumElements;
3031 return *this;
3032 }
3033
3035 {
3036 Texture.SRV.bDisableSRGB = InDisableSRGB;
3037 return *this;
3038 }
3039};
3040
3042{
3045
3046protected:
3049 {
3050 // Texture UAVs only support 1 mip
3051 Texture.UAV.MipRange.Num = 1;
3052 }
3053
3054public:
3055 //
3056 // Specifies the type of view to create. Must match the shader parameter this view will be bound to.
3057 //
3058 // The dimension is allowed to differ from the underlying resource's dimensions, e.g. to create a view
3059 // compatible with an RWTexture2D<> shader parameter, but where the underlying resource is a texture 2D array.
3060 //
3061 // Some combinations are not valid, e.g. 3D textures can only have 3D views.
3062 //
3064 {
3065 switch (InDimension)
3066 {
3067 default: checkNoEntry(); break;
3068 case ETextureDimension::Texture2D : Texture.UAV.Dimension = EDimension::Texture2D ; break;
3070 case ETextureDimension::Texture3D : Texture.UAV.Dimension = EDimension::Texture3D ; break;
3071 case ETextureDimension::TextureCube : Texture.UAV.Dimension = EDimension::TextureCube ; break;
3073 }
3074 return *this;
3075 }
3076
3077 //
3078 // Provided for back-compat with existing code. Consider using SetDimension() instead for more direct control over the view.
3079 // For example, it is possible to create a 2D view of a 2DArray texture, but not using this function which always choses 2DArray dimension.
3080 //
3082 {
3084 SetDimension(TargetTexture->GetDesc().Dimension);
3085 return *this;
3086 }
3087
3089 {
3090 Texture.UAV.Format = InFormat;
3091 return *this;
3092 }
3093
3095 {
3096 Texture.UAV.Plane = InPlane;
3097 return *this;
3098 }
3099
3101 {
3102 Texture.UAV.MipRange.First = InMipLevel;
3103 return *this;
3104 }
3105
3106 //
3107 // The meaning of array "elements" is given by the dimension of the underlying resource.
3108 // I.e. a view of a TextureCubeArray resource indexes the array in whole cubes.
3109 //
3110 // [0] = the first cube (2D slices 0 to 5)
3111 // [1] = the second cube (2D slices 6 to 11)
3112 //
3113 // If the view dimension is smaller than the resource dimension, the array range will be further limited.
3114 // E.g. creating a Texture2D dimension view of a TextureCubeArray resource
3115 //
3117 {
3118 Texture.UAV.ArrayRange.First = InFirstElement;
3119 Texture.UAV.ArrayRange.Num = InNumElements;
3120 return *this;
3121 }
3122};
3123
3128
3133
3138
3143
3144//
3145// Used by platform RHIs to create views of buffers. The data in this structure is computed in GetViewInfo(),
3146// and is specific to a particular buffer resource. It is not intended to be stored in a view instance.
3147//
3149{
3150 // The offset in bytes from the beginning of the viewed buffer resource.
3152
3153 // The size in bytes of a single element in the view.
3155
3156 // The number of elements visible in the view.
3158
3159 // The total number of bytes the data visible in the view covers (i.e. stride * numelements).
3161
3162 // Whether this is a typed / structured / raw view etc.
3164
3165 // The format of the data exposed by this view. PF_Unknown for all buffer types except typed buffer views.
3167
3168 // When true, the view is referring to a BUF_NullResource, so a null descriptor should be created.
3170};
3171
3172// Buffer SRV specific info
3175
3176// Buffer UAV specific info
3182
3183//
3184// Used by platform RHIs to create views of textures. The data in this structure is computed in GetViewInfo(),
3185// and is specific to a particular texture resource. It is not intended to be stored in a view instance.
3186//
3188{
3189 //
3190 // The range of array "elements" the view covers.
3191 //
3192 // The meaning of "elements" is given by the view dimension.
3193 // I.e. a view with "Dimension == CubeArray" indexes the array in whole cubes.
3194 //
3195 // - [0]: the first cube (2D slices 0 to 5)
3196 // - [1]: the second cube (2D slices 6 to 11)
3197 //
3198 // 3D textures always have ArrayRange.Num == 1 because there are no "3D texture arrays".
3199 //
3201
3202 // Which plane of a texture to access (i.e. color, depth, stencil etc).
3204
3205 // The typed format to use when reading / writing data in the viewed texture.
3207
3208 // Specifies how to treat the texture resource when creating the view.
3209 // E.g. it is possible to create a 2DArray view of a 2D or Cube texture.
3211
3212 // True when the view covers every mip of the resource.
3214
3215 // True when the view covers every array slice of the resource.
3216 // This includes depth slices for 3D textures, and faces of texture cubes.
3218};
3219
3220// Texture SRV specific info
3222{
3223 // The range of texture mips the view covers.
3225
3226 // Indicates if this view should use an sRGB variant of the typed format.
3228};
3229
3230
3231// Texture UAV specific info
3233{
3234 // The single mip level covered by this view.
3236};
3237
3239{
3240public:
3243 , Resource(InResource)
3245 {
3246 checkf(InResource, TEXT("Cannot create a view of a nullptr resource."));
3247 }
3248
3250 {
3251 return FRHIDescriptorHandle();
3252 }
3253
3255 {
3256 return Resource;
3257 }
3258
3260 {
3262 return static_cast<FRHIBuffer*>(Resource.GetReference());
3263 }
3264
3266 {
3268 return static_cast<FRHITexture*>(Resource.GetReference());
3269 }
3270
3271 bool IsBuffer () const { return ViewDesc.IsBuffer (); }
3272 bool IsTexture() const { return ViewDesc.IsTexture(); }
3273
3274#if ENABLE_RHI_VALIDATION
3275 RHIValidation::FViewIdentity GetViewIdentity() const
3276 {
3277 return RHIValidation::FViewIdentity(Resource, ViewDesc);
3278 }
3279#endif
3280
3281 FRHIViewDesc const& GetDesc() const
3282 {
3283 return ViewDesc;
3284 }
3285
3286private:
3288
3289protected:
3291};
3292
3302
3312
3331
3336
3337//
3338// Ray tracing resources
3339//
3340
3342{
3343 None = 0,
3344 TriangleCullDisable = 1 << 1, // No back face culling. Triangle is visible from both sides.
3345 TriangleCullReverse = 1 << 2, // Makes triangle front-facing if its vertices are counterclockwise from ray origin.
3346 ForceOpaque = 1 << 3, // Disable any-hit shader invocation for this instance.
3347 ForceNonOpaque = 1 << 4, // Force any-hit shader invocation even if geometries inside the instance were marked opaque.
3348};
3350
3357{
3359
3361
3362 // A single physical mesh may be duplicated many times in the scene with different transforms and user data.
3363 // All copies share the same shader binding table entries and therefore will have the same material and shader resources.
3365
3366 // Offsets into the scene's instance scene data buffer used to get instance transforms from GPUScene
3367 // If BaseInstanceSceneDataOffset != -1, instances are assumed to be continuous.
3370
3371 // Conservative number of instances. Some of the actual instances may be made inactive if GPU transforms are used.
3372 // Must be less or equal to number of entries in Transforms view if CPU transform data is used.
3374
3375 // Each geometry copy can receive a user-provided integer, which can be used to retrieve extra shader parameters or customize appearance.
3376 // This data can be retrieved using GetInstanceUserData() in closest/any hit shaders.
3377 // If UserData view is empty, then DefaultUserData value will be used for all instances.
3378 // If UserData view is used, then it must have the same number of entries as NumInstances.
3381
3382 // Whether local bounds scale and center translation should be applied to the instance transform.
3384 // Whether to increment UserData for each instance of this geometry (only applied when using DefaultUserData)
3386
3387 bool bUsesLightingChannels : 1 = false;
3388
3389 // Mask that will be tested against one provided to TraceRay() in shader code.
3390 // If binary AND of instance mask with ray mask is zero, then the instance is considered not intersected / invisible.
3391 uint8 Mask = 0xFF;
3392
3393 // Flags to control triangle back face culling, whether to allow any-hit shaders, etc.
3395};
3396
3398{
3399 uint32 Reserved[6] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
3400
3401 bool IsValid() const
3402 {
3403 return *this != FRayTracingGeometryOfflineDataHeader();
3404 }
3405
3407 {
3408 return Reserved[0] == Other.Reserved[0]
3409 && Reserved[1] == Other.Reserved[1]
3410 && Reserved[2] == Other.Reserved[2]
3411 && Reserved[3] == Other.Reserved[3]
3412 && Reserved[4] == Other.Reserved[4]
3413 && Reserved[5] == Other.Reserved[5];
3414 }
3415
3417 {
3418 return !(*this == Other);
3419 }
3420
3422 {
3423 Ar << Header.Reserved[0];
3424 Ar << Header.Reserved[1];
3425 Ar << Header.Reserved[2];
3426 Ar << Header.Reserved[3];
3427 Ar << Header.Reserved[4];
3428 Ar << Header.Reserved[5];
3429 return Ar;
3430 }
3431};
3432
3434{
3435 // Indexed or non-indexed triangle list with fixed function ray intersection.
3436 // Vertex buffer must contain vertex positions as VET_Float3.
3437 // Vertex stride must be at least 12 bytes, but may be larger to support custom per-vertex data.
3438 // Index buffer may be provided for indexed triangle lists. Implicit triangle list is assumed otherwise.
3440
3441 // Custom primitive type that requires an intersection shader.
3442 // Vertex buffer for procedural geometry must contain one AABB per primitive as {float3 MinXYZ, float3 MaxXYZ}.
3443 // Vertex stride must be at least 24 bytes, but may be larger to support custom per-primitive data.
3444 // Index buffers can't be used with procedural geometry.
3446};
3448
3450{
3451 // Fully initializes the RayTracingGeometry object: creates underlying buffer and initializes shader parameters.
3452 Rendering,
3453
3454 // Does not create underlying buffer or shader parameters. Used by the streaming system as an object that is streamed into.
3456
3457 // Creates buffers but does not create shader parameters. Used for intermediate objects in the streaming system.
3459};
3461
3463{
3464public:
3467
3468 // Offset in bytes from the base address of the vertex buffer.
3470
3471 // Number of bytes between elements of the vertex buffer (sizeof VET_Float3 by default).
3472 // Must be equal or greater than the size of the position vector.
3474
3475 // Number of vertices (positions) in VertexBuffer.
3476 // If an index buffer is present, this must be at least the maximum index value in the index buffer + 1.
3478
3479 // Primitive range for this segment.
3482
3483 // Indicates whether any-hit shader could be invoked when hitting this geometry segment.
3484 // Setting this to `false` turns off any-hit shaders, making the section "opaque" and improving ray tracing performance.
3485 bool bForceOpaque = false;
3486
3487 // Any-hit shader may be invoked multiple times for the same primitive during ray traversal.
3488 // Setting this to `false` guarantees that only a single instance of any-hit shader will run per primitive, at some performance cost.
3490
3491 // Indicates whether this section is enabled and should be taken into account during acceleration structure creation
3492 bool bEnabled = true;
3493};
3494
3496{
3497public:
3499
3500 // Offset in bytes from the base address of the index buffer.
3502
3504
3505 // Total number of primitives in all segments of the geometry. Only used for validation.
3507
3508 bool bFastBuild = false;
3509 bool bAllowUpdate = false;
3510 bool bAllowCompaction = true;
3511 bool bTemplate = false;
3513
3514 // Partitions of geometry to allow different shader and resource bindings.
3515 // All ray tracing geometries must have at least one segment.
3517
3518 // Offline built geometry data. If null, the geometry will be built by the RHI at runtime.
3521
3522 // Pointer to an existing ray tracing geometry which the new geometry is built from.
3524
3525 // Use FDebugName for auto-generated debug names with numbered suffixes, it is a variation of FMemoryImageName with optional number postfix.
3527 // Store the path name of the owner object for resource tracking. FMemoryImageName allows a conversion to/from FName.
3529};
3530
3531#if DO_CHECK
3532inline bool operator==(const FRayTracingGeometryInitializer& LHS, const FRayTracingGeometryInitializer& RHS)
3533{
3534 // Can't compare LHS == RHS directly due to some members not having equality operators
3535
3536 if (LHS.IndexBuffer != RHS.IndexBuffer
3537 || LHS.IndexBufferOffset != RHS.IndexBufferOffset
3538 || LHS.GeometryType != RHS.GeometryType
3539 || LHS.TotalPrimitiveCount != RHS.TotalPrimitiveCount)
3540 {
3541 return false;
3542 }
3543
3544 // Can't compare Segments directly due to some members not having equality operators
3545 if (LHS.Segments.Num() != RHS.Segments.Num())
3546 {
3547 return false;
3548 }
3549
3550 for (int32 SegmentIndex = 0; SegmentIndex < LHS.Segments.Num(); ++SegmentIndex)
3551 {
3552 //if (LHS.Segments[SegmentIndex] != RHS.Segments[SegmentIndex])
3553 //{
3554 // return false;
3555 //}
3556
3557 if (LHS.Segments[SegmentIndex].VertexBuffer != RHS.Segments[SegmentIndex].VertexBuffer
3558 || LHS.Segments[SegmentIndex].VertexBufferElementType != RHS.Segments[SegmentIndex].VertexBufferElementType
3559 || LHS.Segments[SegmentIndex].VertexBufferOffset != RHS.Segments[SegmentIndex].VertexBufferOffset
3560 || LHS.Segments[SegmentIndex].VertexBufferStride != RHS.Segments[SegmentIndex].VertexBufferStride
3561 || LHS.Segments[SegmentIndex].MaxVertices != RHS.Segments[SegmentIndex].MaxVertices
3562 || LHS.Segments[SegmentIndex].FirstPrimitive != RHS.Segments[SegmentIndex].FirstPrimitive
3563 || LHS.Segments[SegmentIndex].NumPrimitives != RHS.Segments[SegmentIndex].NumPrimitives
3564 || LHS.Segments[SegmentIndex].bForceOpaque != RHS.Segments[SegmentIndex].bForceOpaque
3565 || LHS.Segments[SegmentIndex].bAllowDuplicateAnyHitShaderInvocation != RHS.Segments[SegmentIndex].bAllowDuplicateAnyHitShaderInvocation
3566 || LHS.Segments[SegmentIndex].bEnabled != RHS.Segments[SegmentIndex].bEnabled)
3567 {
3568 return false;
3569 }
3570 }
3571
3572 if (LHS.OfflineData != RHS.OfflineData
3573 || LHS.SourceGeometry != RHS.SourceGeometry
3574 || LHS.bFastBuild != RHS.bFastBuild
3575 || LHS.bAllowUpdate != RHS.bAllowUpdate
3576 || LHS.bAllowCompaction != RHS.bAllowCompaction
3577 || LHS.Type != RHS.Type)
3578 {
3579 return false;
3580 }
3581
3582 // Can't compare DebugName directly due to FDebugName not having equality operator
3583 if (LHS.OwnerName != RHS.OwnerName)
3584 {
3585 return false;
3586 }
3587
3588 return true;
3589}
3590#endif
3591
3593{
3594 // Scene may only be used during the frame when it was created.
3596
3597 // Scene may be constructed once and used in any number of later frames (not currently implemented).
3598 // RTSL_MultiFrame,
3599};
3600
3602{
3603 None = 0,
3604 AllowUpdate = 1 << 0,
3605 AllowCompaction = 1 << 1,
3606 FastTrace = 1 << 2,
3607 FastBuild = 1 << 3,
3608 MinimizeMemory = 1 << 4,
3609};
3611
3613{
3614 Transient, //< SBT will be reallocated each frame
3615 Persistent, //< SBT will be persistently stored and only new or changed bindings will be set
3616};
3618
3620{
3621 Disabled = 0, //< No binding data at all
3622 Inline = 1 << 0, //< Binding data for inline raytracing
3623 RTPSO = 1 << 1, //< Binding data for raytracing using RTPSOs
3624};
3626
3628{
3629 Allow,
3630 Disallow,
3631};
3633
3635{
3636 // Defines lifetime of the shader binding table
3638
3639 // Defines which types of binding data needs to be stored in the SBT (Inline and/or RTPSO)
3641
3642 // Allow indexing of the hit group shaders for RTPSO bindings - if disabled then the SBT won't store any hit group data
3644
3645 // Local binding data size used for each entry in the SBT (needs to be at least as big as the local binding data size of all shaders used in the SBT)
3647
3648 // This value controls how many elements will be allocated in the shader binding table per geometry segment.
3649 // Changing this value allows different hit shaders to be used for different effects.
3650 // For example, setting this to 2 allows one hit shader for regular material evaluation and a different one for shadows.
3651 // Desired hit shader can be selected by providing appropriate RayContributionToHitGroupIndex to TraceRay() function.
3652 // Use ShaderSlot argument in SetRayTracingHitGroup() to assign shaders and resources for specific part of the shder binding table record.
3654
3655 // Maximum number of geometry segments which can be stored in the hit group binding data
3657
3658 // At least one miss shader must be present in a ray tracing scene.
3659 // Default miss shader is always in slot 0. Default shader must not use local resources.
3660 // Custom miss shaders can be bound to other slots using SetRayTracingMissShader().
3662
3663 // Defines how many different callable shaders with unique resource bindings can be bound to this scene.
3664 // Shaders and resources are assigned to slots in the scene using SetRayTracingCallableShader().
3666};
3667
3669{
3670 // Maximum number of instances in this scene. Actual number of instances is specified in FRayTracingSceneBuildParams.
3672
3673 UE_DEPRECATED(5.6, "Use FRayTracingShaderBindingTableInitializer instead.")
3675
3676 // Defines whether data in this scene should persist between frames.
3677 // Currently only single-frame lifetime is supported.
3679
3680 // Controls the flags of the ray tracing scene build.
3682
3684
3690};
3691
3693{
3694 uint64 ResultSize = 0;
3695 uint64 BuildScratchSize = 0;
3696 uint64 UpdateScratchSize = 0;
3697};
3698
3700{
3702 uint32 ScratchSize = 0;
3703 uint32 SerializedSize = 0;
3704 uint32 SerializedOffset = 0;
3705};
3706
3708 : public FRHIResource
3709#if ENABLE_RHI_VALIDATION
3710 , public RHIValidation::FAccelerationStructureResource
3711#endif
3712{
3713public:
3715
3717 {
3718 return SizeInfo;
3719 };
3720
3721protected:
3723};
3724
3726
3729{
3730public:
3735
3737 virtual bool IsCompressed() const { return false; }
3738
3740 {
3741 return Initializer;
3742 }
3743
3745 {
3746 return Initializer.Segments.Num();
3747 }
3748protected:
3750};
3751
3755{
3756public:
3758};
3759
3761{
3762 uint64 ResultMaxSizeInBytes = 0;
3763 uint64 ScratchSizeInBytes = 0;
3764};
3765
3767{
3768 MOVE, // Moves CLAS, CLAS Templates, or Clustered BLAS
3769 CLAS_BUILD, // Builds CLAS from clusters of triangles
3770 CLAS_BUILD_TEMPLATES, // Builds CLAS templates from clusters of triangles
3771 CLAS_INSTANTIATE_TEMPLATES, // Instantiates CLAS templates
3772 BLAS_BUILD // Builds Clustered BLAS from CLAS
3773};
3774
3776{
3777 BOTTOM_LEVEL, // Moved objects are Clustered BLAS
3778 CLUSTER_LEVEL, // Moved objects are CLAS
3779 TEMPLATE // Moved objects are CLAS Templates
3780};
3781
3783{
3784 IMPLICIT_DESTINATIONS, // Provide total buffer space, driver places results within, returns VAs and actual sizes
3785 EXPLICIT_DESTINATIONS, // Provide individual target VAs, driver places them there, returns actual sizes
3786 GET_SIZES // Get minimum size per element
3787};
3788
3790{
3791 NONE = 0x0,
3792 FAST_TRACE = 0x1,
3793 FAST_BUILD = 0x2,
3794 NO_OVERLAP = 0x4,
3795 ALLOW_OMM = 0x8
3796};
3798
3804
3806{
3807 // Format of the CLAS vertices
3809
3810 // Index of the last geometry in a single CLAS
3811 uint32 MaxGeometryIndex = 0;
3812
3813 // Maximum number of unique geometries in a single CLAS
3814 uint32 MaxUniqueGeometryCount = 1;
3815
3816 // Maximum number of triangles in a single CLAS
3817 uint32 MaxTriangleCount = 0;
3818
3819 // Maximum number of vertices in a single CLAS
3820 uint32 MaxVertexCount = 0;
3821
3822 // Maximum number of triangles across all CLAS (of the current cluster operation)
3823 uint32 MaxTotalTriangleCount = 0;
3824
3825 // Maximum number of vertices across all CLAS (of the current cluster operation)
3826 uint32 MaxTotalVertexCount = 0;
3827
3828 // Minimum number of bits to be truncated in vertex positions across all CLAS (in the current cluster operation)
3829 uint32 MinPositionTruncateBitCount = 0;
3830};
3831
3833{
3834 // Maximum number of CLAS referenced by a single BLAS
3835 uint32 MaxCLASPerBLASCount = 0;
3836
3837 // Maximum number of CLAS references across all BLAS (in the current cluster operation)
3838 uint32 MaxTotalCLASCount = 0;
3839};
3840
3857
3859 : public FRHIResource
3860#if ENABLE_RHI_VALIDATION
3861 , public RHIValidation::FShaderBindingTable
3862#endif
3863{
3864public:
3872
3877
3878 UE_DEPRECATED(5.6, "GetOrCreateInlineBufferSRV is deprecated. Use GetInlineBufferSize and provide the buffer to RHICommitInlineRayTracingBuffer function.")
3879 FRHIShaderResourceView* GetOrCreateInlineBufferSRV(FRHICommandListBase& RHICmdList)
3880 {
3881 return nullptr;
3882 }
3883
3884 // Returns the size and stride of the structured buffer for RHI-specific inline parameters associated with this SBT.
3885 // Returns 0 if current RHI does not require this buffer.
3887 {
3888 return FRHISizeAndStride{0,0};
3889 }
3890
3891protected:
3893};
3894
3896{
3897 // Compute shaders
3898 CS,
3899
3900 // Mesh and pixel shaders
3901 MSPS,
3902
3903 // Vertex and pixel shaders
3904 VSPS,
3905
3906 MAX
3907};
3908
3910{
3911 uint32 NumRecords = 0u;
3912 uint32 ArgOffset = 0u;
3913 uint32 ArgStride = 0u;
3914
3916};
3917
3919{
3920public:
3925
3926public:
3930 , NumRecords(CreateInfo.NumRecords)
3931 , ArgOffset(CreateInfo.ArgOffset)
3932 , ArgStride(CreateInfo.ArgStride)
3933 , Mode(CreateInfo.Mode)
3934 {
3935#if DO_CHECK
3936 if (Mode == ERHIShaderBundleMode::CS)
3937 {
3938 // Load3
3939 check(ArgStride >= 12u);
3940 }
3941 else if (Mode == ERHIShaderBundleMode::MSPS)
3942 {
3943 // Load
3944 check(ArgStride >= 4u);
3945 }
3946 else if (Mode == ERHIShaderBundleMode::VSPS)
3947 {
3948 // Load4
3949 check(ArgStride >= 16u);
3950 }
3951 else
3952 {
3953 checkNoEntry();
3954 }
3955#endif
3956 }
3957
3958 const TCHAR* GetModeName() const
3959 {
3960 switch (Mode)
3961 {
3963 return TEXT("CS");
3965 return TEXT("MSPS");
3967 return TEXT("VSPS");
3968 break;
3970 default:
3971 checkNoEntry();
3972 return TEXT("<none>");
3973 }
3974 }
3975};
3976
3977/* Generic staging buffer class used by FRHIGPUMemoryReadback
3978* RHI specific staging buffers derive from this
3979*/
3981{
3982public:
3985 , bIsLocked(false)
3986 {}
3987
3989
3990 virtual void *Lock(uint32 Offset, uint32 NumBytes) = 0;
3991 virtual void Unlock() = 0;
3992
3993 // For debugging, may not be implemented on all RHIs
3994 virtual uint64 GetGPUSizeBytes() const { return 0; }
3995
3996protected:
3998};
3999
4001{
4002public:
4006
4008
4009 RHI_API virtual void* Lock(uint32 Offset, uint32 NumBytes) final override;
4010 RHI_API virtual void Unlock() final override;
4011 virtual uint64 GetGPUSizeBytes() const final override { return ShadowBuffer.IsValid() ? ShadowBuffer->GetSize() : 0; }
4012
4015};
4016
4018{
4019public:
4021 uint32 MipIndex = 0;
4022
4024 uint32 ArraySliceIndex = ~0u;
4025
4028
4034
4035 //common case
4038 MipIndex(0),
4039 ArraySliceIndex(-1),
4040 LoadAction(InLoadAction),
4041 StoreAction(ERenderTargetStoreAction::EStore)
4042 {}
4043
4044 //common case
4052
4060
4062 {
4063 return
4064 Texture == Other.Texture &&
4065 MipIndex == Other.MipIndex &&
4066 ArraySliceIndex == Other.ArraySliceIndex &&
4067 LoadAction == Other.LoadAction &&
4068 StoreAction == Other.StoreAction;
4069 }
4070};
4071
4073{
4074public:
4076
4080
4081private:
4082 ERenderTargetStoreAction StencilStoreAction;
4083 FExclusiveDepthStencil DepthStencilAccess;
4084public:
4085
4086 // accessor to prevent write access to StencilStoreAction
4087 ERenderTargetStoreAction GetStencilStoreAction() const { return StencilStoreAction; }
4088 // accessor to prevent write access to DepthStencilAccess
4089 FExclusiveDepthStencil GetDepthStencilAccess() const { return DepthStencilAccess; }
4090
4092 Texture(nullptr),
4093 DepthLoadAction(ERenderTargetLoadAction::ENoAction),
4094 DepthStoreAction(ERenderTargetStoreAction::ENoAction),
4095 StencilLoadAction(ERenderTargetLoadAction::ENoAction),
4096 StencilStoreAction(ERenderTargetStoreAction::ENoAction),
4097 DepthStencilAccess(FExclusiveDepthStencil::DepthNop_StencilNop)
4098 {
4099 Validate();
4100 }
4101
4102 //common case
4105 DepthLoadAction(InLoadAction),
4106 DepthStoreAction(InStoreAction),
4107 StencilLoadAction(InLoadAction),
4108 StencilStoreAction(InStoreAction),
4109 DepthStencilAccess(FExclusiveDepthStencil::DepthWrite_StencilWrite)
4110 {
4111 Validate();
4112 }
4113
4116 DepthLoadAction(InLoadAction),
4117 DepthStoreAction(InStoreAction),
4118 StencilLoadAction(InLoadAction),
4119 StencilStoreAction(InStoreAction),
4120 DepthStencilAccess(InDepthStencilAccess)
4121 {
4122 Validate();
4123 }
4124
4127 DepthLoadAction(InDepthLoadAction),
4128 DepthStoreAction(InDepthStoreAction),
4129 StencilLoadAction(InStencilLoadAction),
4130 StencilStoreAction(InStencilStoreAction),
4131 DepthStencilAccess(FExclusiveDepthStencil::DepthWrite_StencilWrite)
4132 {
4133 Validate();
4134 }
4135
4146
4147 void Validate() const
4148 {
4149 // VK and Metal MAY leave the attachment in an undefined state if the StoreAction is DontCare. So we can't assume read-only implies it should be DontCare unless we know for sure it will never be used again.
4150 // ensureMsgf(DepthStencilAccess.IsDepthWrite() || DepthStoreAction == ERenderTargetStoreAction::ENoAction, TEXT("Depth is read-only, but we are performing a store. This is a waste on mobile. If depth can't change, we don't need to store it out again"));
4151 /*ensureMsgf(DepthStencilAccess.IsStencilWrite() || StencilStoreAction == ERenderTargetStoreAction::ENoAction, TEXT("Stencil is read-only, but we are performing a store. This is a waste on mobile. If stencil can't change, we don't need to store it out again"));*/
4152 }
4153
4155 {
4156 return
4157 Texture == Other.Texture &&
4158 DepthLoadAction == Other.DepthLoadAction &&
4159 DepthStoreAction == Other.DepthStoreAction &&
4160 StencilLoadAction == Other.StencilLoadAction &&
4161 StencilStoreAction == Other.StencilStoreAction &&
4162 DepthStencilAccess == Other.DepthStencilAccess;
4163 }
4164};
4165
4167{
4168public:
4169 // Color Render Targets Info
4173
4174 // Color Render Targets Info
4177
4178 // Depth/Stencil Render Target Info
4180 // Used when depth resolve is enabled.
4184
4187
4189
4191 NumColorRenderTargets(0),
4192 bClearColor(false),
4193 bHasResolveAttachments(false),
4194 bClearDepth(false),
4195 ShadingRateTexture(nullptr),
4196 MultiViewCount(0)
4197 {}
4198
4200 NumColorRenderTargets(InNumColorRenderTargets),
4201 bClearColor(InNumColorRenderTargets > 0 && InColorRenderTargets[0].LoadAction == ERenderTargetLoadAction::EClear),
4202 bHasResolveAttachments(false),
4203 DepthStencilRenderTarget(InDepthStencilRenderTarget),
4205 ShadingRateTexture(nullptr),
4206 ShadingRateTextureCombiner(VRSRB_Passthrough)
4207 {
4210 {
4211 ColorRenderTarget[Index] = InColorRenderTargets[Index];
4212 }
4213 }
4214 // @todo metal mrt: This can go away after all the cleanup is done
4216 {
4217 if (bInClearDepth)
4218 {
4219 DepthStencilRenderTarget.DepthLoadAction = ERenderTargetLoadAction::EClear;
4220 }
4221 if (bInClearStencil)
4222 {
4223 DepthStencilRenderTarget.StencilLoadAction = ERenderTargetLoadAction::EClear;
4224 }
4225 bClearDepth = bInClearDepth;
4226 bClearStencil = bInClearStencil;
4227 }
4228
4230 {
4231 // Need a separate struct so we can memzero/remove dependencies on reference counts
4232 struct FHashableStruct
4233 {
4234 // *2 for color and resolves
4235 // depth goes in the third-to-last slot
4236 // depth resolve goes in the second-to-last slot
4237 // shading rate goes in the last slot
4240 uint32 ArraySliceIndex[MaxSimultaneousRenderTargets];
4243
4244 ERenderTargetLoadAction DepthLoadAction;
4245 ERenderTargetStoreAction DepthStoreAction;
4246 ERenderTargetLoadAction StencilLoadAction;
4247 ERenderTargetStoreAction StencilStoreAction;
4248 FExclusiveDepthStencil DepthStencilAccess;
4249
4250 bool bClearDepth;
4251 bool bClearStencil;
4252 bool bClearColor;
4253 bool bHasResolveAttachments;
4254 uint8 MultiViewCount;
4255
4257 {
4258 FMemory::Memzero(*this);
4259 for (int32 Index = 0; Index < RTInfo.NumColorRenderTargets; ++Index)
4260 {
4261 Texture[Index] = RTInfo.ColorRenderTarget[Index].Texture;
4262 Texture[MaxSimultaneousRenderTargets+Index] = RTInfo.ColorResolveRenderTarget[Index].Texture;
4263 MipIndex[Index] = RTInfo.ColorRenderTarget[Index].MipIndex;
4264 ArraySliceIndex[Index] = RTInfo.ColorRenderTarget[Index].ArraySliceIndex;
4265 LoadAction[Index] = RTInfo.ColorRenderTarget[Index].LoadAction;
4266 StoreAction[Index] = RTInfo.ColorRenderTarget[Index].StoreAction;
4267 }
4268
4269 Texture[MaxSimultaneousRenderTargets*2] = RTInfo.DepthStencilRenderTarget.Texture;
4270 Texture[MaxSimultaneousRenderTargets*2 + 1] = RTInfo.DepthStencilResolveRenderTarget.Texture;
4271 Texture[MaxSimultaneousRenderTargets*2 + 2] = RTInfo.ShadingRateTexture;
4272 DepthLoadAction = RTInfo.DepthStencilRenderTarget.DepthLoadAction;
4273 DepthStoreAction = RTInfo.DepthStencilRenderTarget.DepthStoreAction;
4274 StencilLoadAction = RTInfo.DepthStencilRenderTarget.StencilLoadAction;
4275 StencilStoreAction = RTInfo.DepthStencilRenderTarget.GetStencilStoreAction();
4276 DepthStencilAccess = RTInfo.DepthStencilRenderTarget.GetDepthStencilAccess();
4277
4278 bClearDepth = RTInfo.bClearDepth;
4279 bClearStencil = RTInfo.bClearStencil;
4280 bClearColor = RTInfo.bClearColor;
4281 bHasResolveAttachments = RTInfo.bHasResolveAttachments;
4282 MultiViewCount = RTInfo.MultiViewCount;
4283 }
4284 };
4285
4288 RTHash.Set(*this);
4289 return FCrc::MemCrc32(&RTHash, sizeof(RTHash));
4290 }
4291};
4292
4294{
4295public:
4297
4298 virtual ~FRHICustomPresent() {} // should release any references to D3D resources.
4299
4300 // Called when viewport is resized.
4301 virtual void OnBackBufferResize() = 0;
4302
4303 // Called from render thread to see if a native present will be requested for this frame.
4304 // @return true if native Present will be requested for this frame; false otherwise. Must
4305 // match value subsequently returned by Present for this frame.
4306 virtual bool NeedsNativePresent() = 0;
4307 // In come cases we want to use custom present but still let the native environment handle
4308 // advancement of the backbuffer indices.
4309 // @return true if backbuffer index should advance independently from CustomPresent.
4310 virtual bool NeedsAdvanceBackbuffer() { return false; };
4311
4312 // Called from RHI thread when the engine begins drawing to the viewport.
4313 UE_DEPRECATED(5.7, "FRHICustomPresent::BeginDrawing is deprecated and never called.")
4314 virtual void BeginDrawing() {};
4315
4316 // Called from RHI thread to perform custom present.
4317 // @param InOutSyncInterval - in out param, indicates if vsync is on (>0) or off (==0).
4318 // @param RHICmdContext - the current rhi command context
4319 // @return true if native Present should be also be performed; false otherwise. If it returns
4320 // true, then InOutSyncInterval could be modified to switch between VSync/NoVSync for the normal
4321 // Present. Must match value previously returned by NeedsNativePresent for this frame.
4322 virtual bool Present(IRHICommandContext& RHICmdContext, int32& InOutSyncInterval) { check(false); return true; };
4323
4324 // Called from RHI thread after native Present has been called
4325 virtual void PostPresent() {};
4326
4327 // Called when rendering thread is acquired
4329 // Called when rendering thread is released
4331};
4332
4333
4334// Templates to convert an FRHI*Shader to its enum
4335template<typename TRHIShader> struct TRHIShaderToEnum {};
4336template<> struct TRHIShaderToEnum<FRHIVertexShader> { enum { ShaderFrequency = SF_Vertex }; };
4337template<> struct TRHIShaderToEnum<FRHIMeshShader> { enum { ShaderFrequency = SF_Mesh }; };
4338template<> struct TRHIShaderToEnum<FRHIAmplificationShader> { enum { ShaderFrequency = SF_Amplification }; };
4339template<> struct TRHIShaderToEnum<FRHIPixelShader> { enum { ShaderFrequency = SF_Pixel }; };
4340template<> struct TRHIShaderToEnum<FRHIGeometryShader> { enum { ShaderFrequency = SF_Geometry }; };
4341template<> struct TRHIShaderToEnum<FRHIComputeShader> { enum { ShaderFrequency = SF_Compute }; };
4342template<> struct TRHIShaderToEnum<FRHIVertexShader*> { enum { ShaderFrequency = SF_Vertex }; };
4343template<> struct TRHIShaderToEnum<FRHIMeshShader*> { enum { ShaderFrequency = SF_Mesh }; };
4344template<> struct TRHIShaderToEnum<FRHIAmplificationShader*> { enum { ShaderFrequency = SF_Amplification }; };
4345template<> struct TRHIShaderToEnum<FRHIPixelShader*> { enum { ShaderFrequency = SF_Pixel }; };
4346template<> struct TRHIShaderToEnum<FRHIGeometryShader*> { enum { ShaderFrequency = SF_Geometry }; };
4347template<> struct TRHIShaderToEnum<FRHIComputeShader*> { enum { ShaderFrequency = SF_Compute }; };
4348template<> struct TRHIShaderToEnum<FVertexShaderRHIRef> { enum { ShaderFrequency = SF_Vertex }; };
4349template<> struct TRHIShaderToEnum<FMeshShaderRHIRef> { enum { ShaderFrequency = SF_Mesh }; };
4350template<> struct TRHIShaderToEnum<FAmplificationShaderRHIRef> { enum { ShaderFrequency = SF_Amplification }; };
4351template<> struct TRHIShaderToEnum<FPixelShaderRHIRef> { enum { ShaderFrequency = SF_Pixel }; };
4352template<> struct TRHIShaderToEnum<FGeometryShaderRHIRef> { enum { ShaderFrequency = SF_Geometry }; };
4353template<> struct TRHIShaderToEnum<FComputeShaderRHIRef> { enum { ShaderFrequency = SF_Compute }; };
4354
4355template<typename TRHIShaderType>
4360
4362{
4364
4382
4383#if PLATFORM_SUPPORTS_MESH_SHADERS
4388 : PixelShaderRHI(InPixelShaderRHI)
4391 {
4392 }
4393#endif
4394
4396 {
4397 if (GetMeshShader())
4398 {
4399 check(VertexDeclarationRHI == nullptr);
4400 check(VertexShaderRHI == nullptr);
4401 check(GetWorkGraphShader() == nullptr);
4402 GetMeshShader()->AddRef();
4403
4404 if (GetAmplificationShader())
4405 {
4406 GetAmplificationShader()->AddRef();
4407 }
4408 }
4409 else if (GetWorkGraphShader())
4410 {
4411 check(VertexDeclarationRHI == nullptr);
4412 check(VertexShaderRHI == nullptr);
4413 check(GetMeshShader() == nullptr);
4414 GetWorkGraphShader()->AddRef();
4415 }
4416 else
4417 {
4418 check(VertexDeclarationRHI);
4419 VertexDeclarationRHI->AddRef();
4420
4421 check(VertexShaderRHI);
4422 VertexShaderRHI->AddRef();
4423 }
4424
4425 if (PixelShaderRHI)
4426 {
4427 PixelShaderRHI->AddRef();
4428 }
4429
4430 if (GetGeometryShader())
4431 {
4432 GetGeometryShader()->AddRef();
4433 }
4434 }
4435
4437 {
4438 if (GetMeshShader())
4439 {
4440 check(VertexDeclarationRHI == nullptr);
4441 check(VertexShaderRHI == nullptr);
4442 check(GetWorkGraphShader() == nullptr);
4443 GetMeshShader()->Release();
4444
4445 if (GetAmplificationShader())
4446 {
4447 GetAmplificationShader()->Release();
4448 }
4449 }
4450 else if (GetWorkGraphShader())
4451 {
4452 check(VertexDeclarationRHI == nullptr);
4453 check(VertexShaderRHI == nullptr);
4454 check(GetMeshShader() == nullptr);
4455 GetWorkGraphShader()->Release();
4456 }
4457 else
4458 {
4459 check(VertexDeclarationRHI);
4460 VertexDeclarationRHI->Release();
4461
4462 check(VertexShaderRHI);
4463 VertexShaderRHI->Release();
4464 }
4465
4466 if (PixelShaderRHI)
4467 {
4468 PixelShaderRHI->Release();
4469 }
4470
4471 if (GetGeometryShader())
4472 {
4473 GetGeometryShader()->Release();
4474 }
4475 }
4476
4477 FRHIVertexShader* GetVertexShader() const { return VertexShaderRHI; }
4478 FRHIPixelShader* GetPixelShader() const { return PixelShaderRHI; }
4479
4480#if PLATFORM_SUPPORTS_MESH_SHADERS
4481 FRHIMeshShader* GetMeshShader() const { return MeshShaderRHI; }
4482 void SetMeshShader(FRHIMeshShader* InMeshShader) { MeshShaderRHI = InMeshShader; }
4483 FRHIAmplificationShader* GetAmplificationShader() const { return AmplificationShaderRHI; }
4485#else
4486 constexpr FRHIMeshShader* GetMeshShader() const { return nullptr; }
4488 constexpr FRHIAmplificationShader* GetAmplificationShader() const { return nullptr; }
4490#endif
4491
4492#if PLATFORM_SUPPORTS_GEOMETRY_SHADERS
4493 FRHIGeometryShader* GetGeometryShader() const { return GeometryShaderRHI; }
4495#else
4496 constexpr FRHIGeometryShader* GetGeometryShader() const { return nullptr; }
4498#endif
4499
4500#if PLATFORM_SUPPORTS_WORKGRAPH_SHADERS
4501 FRHIWorkGraphShader* GetWorkGraphShader() const { return WorkGraphMeshShaderRHI; }
4503#else
4504 FRHIWorkGraphShader* GetWorkGraphShader() const { return nullptr; }
4506#endif
4507
4508 FRHIVertexDeclaration* VertexDeclarationRHI = nullptr;
4509 FRHIVertexShader* VertexShaderRHI = nullptr;
4510 FRHIPixelShader* PixelShaderRHI = nullptr;
4511private:
4512#if PLATFORM_SUPPORTS_MESH_SHADERS
4513 FRHIMeshShader* MeshShaderRHI = nullptr;
4515#endif
4516#if PLATFORM_SUPPORTS_GEOMETRY_SHADERS
4518#endif
4519#if PLATFORM_SUPPORTS_WORKGRAPH_SHADERS
4521#endif
4522};
4523
4524// Hints for some RHIs that support subpasses
4526{
4527 // Regular rendering
4528 None,
4529
4530 // Render pass has depth reading subpass
4532
4533 // Mobile defferred shading subpass
4535
4536 // Mobile MSAA custom resolve subpass. Includes DepthReadSubpass.
4538};
4539
4541{
4542 Disabled,
4544};
4545
4569
4570
4572{
4573public:
4574 // Can't use TEnumByte<EPixelFormat> as it changes the struct to be non trivially constructible, breaking memset
4577
4579 : BlendState(nullptr)
4580 , RasterizerState(nullptr)
4581 , DepthStencilState(nullptr)
4582 , RenderTargetsEnabled(0)
4583 , RenderTargetFormats(InPlace, UE_PIXELFORMAT_TO_UINT8(PF_Unknown))
4584 , RenderTargetFlags(InPlace, TexCreate_None)
4585 , DepthStencilTargetFormat(PF_Unknown)
4586 , DepthStencilTargetFlag(TexCreate_None)
4587 , DepthTargetLoadAction(ERenderTargetLoadAction::ENoAction)
4588 , DepthTargetStoreAction(ERenderTargetStoreAction::ENoAction)
4589 , StencilTargetLoadAction(ERenderTargetLoadAction::ENoAction)
4590 , StencilTargetStoreAction(ERenderTargetStoreAction::ENoAction)
4591 , NumSamples(0)
4592 , SubpassHint(ESubpassHint::None)
4593 , SubpassIndex(0)
4594 , ConservativeRasterization(EConservativeRasterization::Disabled)
4595 , bDepthBounds(false)
4596 , MultiViewCount(0)
4597 , bHasFragmentDensityAttachment(false)
4598 , bAllowVariableRateShading(true)
4599 , ShadingRate(EVRSShadingRate::VRSSR_1x1)
4600 , Flags(0)
4601 , StatePrecachePSOHash(0)
4602 {
4603#if PLATFORM_WINDOWS
4604 static_assert(sizeof(TRenderTargetFormats::ElementType) == sizeof(uint8/*EPixelFormat*/), "Change TRenderTargetFormats's uint8 to EPixelFormat's size!");
4605#endif
4606 static_assert(PF_MAX < MAX_uint8, "TRenderTargetFormats assumes EPixelFormat can fit in a uint8!");
4607 }
4608
4631 bool bInDepthBounds,
4636 : BoundShaderState(InBoundShaderState)
4637 , BlendState(InBlendState)
4638 , RasterizerState(InRasterizerState)
4639 , DepthStencilState(InDepthStencilState)
4640 , ImmutableSamplerState(InImmutableSamplerState)
4641 , PrimitiveType(InPrimitiveType)
4642 , RenderTargetsEnabled(InRenderTargetsEnabled)
4643 , RenderTargetFormats(InRenderTargetFormats)
4644 , RenderTargetFlags(InRenderTargetFlags)
4645 , DepthStencilTargetFormat(InDepthStencilTargetFormat)
4646 , DepthStencilTargetFlag(InDepthStencilTargetFlag)
4647 , DepthTargetLoadAction(InDepthTargetLoadAction)
4648 , DepthTargetStoreAction(InDepthTargetStoreAction)
4649 , StencilTargetLoadAction(InStencilTargetLoadAction)
4650 , StencilTargetStoreAction(InStencilTargetStoreAction)
4651 , DepthStencilAccess(InDepthStencilAccess)
4652 , NumSamples(InNumSamples)
4653 , SubpassHint(InSubpassHint)
4654 , SubpassIndex(InSubpassIndex)
4655 , ConservativeRasterization(EConservativeRasterization::Disabled)
4656 , bDepthBounds(bInDepthBounds)
4657 , MultiViewCount(InMultiViewCount)
4658 , bHasFragmentDensityAttachment(bInHasFragmentDensityAttachment)
4659 , bAllowVariableRateShading(bInAllowVariableRateShading)
4660 , ShadingRate(InShadingRate)
4661 , Flags(InFlags)
4662 , StatePrecachePSOHash(0)
4663 {
4664 }
4665
4667 {
4668 if (BoundShaderState.VertexDeclarationRHI != rhs.BoundShaderState.VertexDeclarationRHI ||
4669 BoundShaderState.VertexShaderRHI != rhs.BoundShaderState.VertexShaderRHI ||
4670 BoundShaderState.PixelShaderRHI != rhs.BoundShaderState.PixelShaderRHI ||
4671 BoundShaderState.GetMeshShader() != rhs.BoundShaderState.GetMeshShader() ||
4672 BoundShaderState.GetAmplificationShader() != rhs.BoundShaderState.GetAmplificationShader() ||
4673 BoundShaderState.GetWorkGraphShader() != rhs.BoundShaderState.GetWorkGraphShader() ||
4674 BoundShaderState.GetGeometryShader() != rhs.BoundShaderState.GetGeometryShader() ||
4675 BlendState != rhs.BlendState ||
4676 RasterizerState != rhs.RasterizerState ||
4677 DepthStencilState != rhs.DepthStencilState ||
4678 ImmutableSamplerState != rhs.ImmutableSamplerState ||
4679 PrimitiveType != rhs.PrimitiveType ||
4680 bDepthBounds != rhs.bDepthBounds ||
4681 MultiViewCount != rhs.MultiViewCount ||
4682 ShadingRate != rhs.ShadingRate ||
4683 bAllowVariableRateShading != rhs.bAllowVariableRateShading ||
4684 bHasFragmentDensityAttachment != rhs.bHasFragmentDensityAttachment ||
4685 RenderTargetsEnabled != rhs.RenderTargetsEnabled ||
4686 RenderTargetFormats != rhs.RenderTargetFormats ||
4687 !RelevantRenderTargetFlagsEqual(RenderTargetFlags, rhs.RenderTargetFlags) ||
4688 DepthStencilTargetFormat != rhs.DepthStencilTargetFormat ||
4689 !RelevantDepthStencilFlagsEqual(DepthStencilTargetFlag, rhs.DepthStencilTargetFlag) ||
4690 DepthTargetLoadAction != rhs.DepthTargetLoadAction ||
4691 DepthTargetStoreAction != rhs.DepthTargetStoreAction ||
4692 StencilTargetLoadAction != rhs.StencilTargetLoadAction ||
4693 StencilTargetStoreAction != rhs.StencilTargetStoreAction ||
4694 DepthStencilAccess != rhs.DepthStencilAccess ||
4695 NumSamples != rhs.NumSamples ||
4696 SubpassHint != rhs.SubpassHint ||
4697 SubpassIndex != rhs.SubpassIndex ||
4698 ConservativeRasterization != rhs.ConservativeRasterization)
4699 {
4700 return false;
4701 }
4702
4703 return true;
4704 }
4705
4706 // We care about flags that influence RT formats (which is the only thing the underlying API cares about).
4707 // In most RHIs, the format is only influenced by TexCreate_SRGB. D3D12 additionally uses TexCreate_Shared in its format selection logic.
4708 static constexpr ETextureCreateFlags RelevantRenderTargetFlagMask = ETextureCreateFlags::SRGB | ETextureCreateFlags::Shared;
4709
4710 // We care about flags that influence DS formats (which is the only thing the underlying API cares about).
4711 // D3D12 shares the format choice function with the RT, so preserving all the flags used there out of abundance of caution.
4713
4715 {
4716 for (int32 Index = 0; Index < A.Num(); ++Index)
4717 {
4718 ETextureCreateFlags FlagsA = A[Index] & RelevantRenderTargetFlagMask;
4719 ETextureCreateFlags FlagsB = B[Index] & RelevantRenderTargetFlagMask;
4720 if (FlagsA != FlagsB)
4721 {
4722 return false;
4723 }
4724 }
4725 return true;
4726 }
4727
4729 {
4730 ETextureCreateFlags FlagsA = (A & RelevantDepthStencilFlagMask);
4731 ETextureCreateFlags FlagsB = (B & RelevantDepthStencilFlagMask);
4732 return (FlagsA == FlagsB);
4733 }
4734
4736 {
4737 // Get the count of valid render targets (ignore those at the end of the array with PF_Unknown)
4738 if (RenderTargetsEnabled > 0)
4739 {
4741 for (int32 i = (int32)RenderTargetsEnabled - 1; i >= 0; i--)
4742 {
4743 if (RenderTargetFormats[i] != PF_Unknown)
4744 {
4745 LastValidTarget = i;
4746 break;
4747 }
4748 }
4749 return uint32(LastValidTarget + 1);
4750 }
4751 return RenderTargetsEnabled;
4752 }
4753
4759
4780
4781 // Note: these flags do NOT affect compilation of this PSO.
4782 // The resulting object is invariant with respect to whatever is set here, they are
4783 // behavior hints.
4784 // They do not participate in equality comparisons or hashing.
4785 union
4786 {
4787 struct
4788 {
4793 };
4795 };
4796
4798 {
4799 NotSet = 0,
4800 MinPri = 1,
4801 NormalPri = 2,
4802 MaxPri = 3,
4803
4804 NumTypes = 4,
4805 };
4806 static_assert((int)EPSOPrecacheCompileType::MaxPri < (1<<3) ); // ensure MaxPri fits within PrecacheCompileType
4813
4814 // Cached hash off all state data provided at creation time (Only contains hash of data which influences the PSO precaching for the current platform)
4815 // Created from hashing the state data instead of the pointers which are used during fast runtime cache checking and compares
4817};
4818
4820{
4821public:
4822
4824 : ComputeShader(nullptr)
4825 , Flags(0)
4826 {
4827 }
4828
4836
4838 {
4839 return ComputeShader == Other.ComputeShader;
4840 }
4841
4843
4844 // Note: these flags do NOT affect compilation of this PSO.
4845 // The resulting object is invariant with respect to whatever is set here, they are
4846 // behavior hints.
4847 // They do not participate in equality comparisons or hashing.
4848 union
4849 {
4850 struct
4851 {
4855 };
4857 };
4858};
4859
4861template<typename TShaderType>
4862inline uint64 ComputeShaderTableHash(const TArrayView<TShaderType*>& ShaderTable, uint64 InitialHash = 5699878132332235837ull)
4863{
4864 uint64 CombinedHash = InitialHash;
4865 for (FRHIShader* ShaderRHI : ShaderTable)
4866 {
4867 uint64 ShaderHash = 0;
4868 if (ShaderRHI)
4869 {
4870 // 64 bits from the shader SHA1
4871 FMemory::Memcpy(&ShaderHash, ShaderRHI->GetHash().Hash, sizeof(ShaderHash));
4872 }
4873
4874 // 64 bit hash combination as per boost::hash_combine_impl
4875 CombinedHash ^= ShaderHash + 0x9e3779b9 + (CombinedHash << 6) + (CombinedHash >> 2);
4876 }
4877
4878 return CombinedHash;
4879}
4880
4882{
4883public:
4885
4887 {
4888 return NameHash == Rhs.NameHash &&
4889 NameTableHash == Rhs.NameTableHash &&
4890 ShaderTableHash == Rhs.ShaderTableHash &&
4891 GraphicsPSOTableHash == Rhs.GraphicsPSOTableHash;
4892 }
4893
4895 {
4896 return GetTypeHash(Initializer.NameHash) ^
4897 GetTypeHash(Initializer.NameTableHash) ^
4898 GetTypeHash(Initializer.ShaderTableHash) ^
4899 GetTypeHash(Initializer.GraphicsPSOTableHash);
4900 }
4901
4902 uint64 GetNameHash() const { return NameHash; }
4903 uint64 GetNameTableHash() const { return NameTableHash; }
4904 uint64 GetShaderTableHash() const { return ShaderTableHash; }
4905 uint64 GetGraphicsPSOTableHash() const { return GraphicsPSOTableHash; }
4906
4907protected:
4909 uint64 NameTableHash = 0;
4910 uint64 ShaderTableHash = 0;
4911 uint64 GraphicsPSOTableHash = 0;
4912};
4913
4915{
4916public:
4918
4920 {
4921 ProgramName = InProgramName;
4922 NameHash = GetTypeHash(ProgramName);
4923 }
4924
4927 {
4928 FString ExportName;
4929 FString NodeName;
4931
4932 FNameMap(FString const& InExportName, FString const& InNodeName)
4933 : ExportName(InExportName)
4934 , NodeName(InNodeName)
4935 , ExportNameHash(GetTypeHash(InExportName))
4936 {}
4937
4938 friend uint32 GetTypeHash(FNameMap const& NameMap)
4939 {
4940 return HashCombineFast(GetTypeHash(NameMap.ExportName), GetTypeHash(NameMap.NodeName));
4941 }
4942 };
4943
4945 {
4946 NameMaps = InNameMaps;
4947 NameTableHash = Hash ? Hash : GetArrayHash(NameMaps.GetData(), NameMaps.Num());
4948 }
4949
4951 {
4952 ShaderTable = InShaders;
4953 ShaderTableHash = Hash ? Hash : ComputeShaderTableHash(InShaders);
4954 // RootShaderIndex doesn't need adding to a hash because if used correctly it is an artifact of the shader table.
4955 // (Only one shader in the array can have a global root signature).
4956 RootShaderIndex = InRootShaderIndex;
4957 }
4958
4960 {
4961 GraphicsPSOTable = InGraphicsPSOs;
4962 GraphicsPSOTableHash = Hash ? Hash : ComputeGraphicsPSOTableHash(InGraphicsPSOs);
4963 }
4964
4965 FString const& GetProgramName() const { return ProgramName; }
4966 TArray<FNameMap> const& GetNameTable() const { return NameMaps; }
4967 int32 GetRootShaderIndex() const { return RootShaderIndex; }
4968 TArrayView<FRHIWorkGraphShader*> const& GetShaderTable() const { return ShaderTable; }
4970
4971private:
4972 RHI_API uint64 ComputeGraphicsPSOTableHash(const TArrayView<FGraphicsPipelineStateInitializer const*>& InGraphicsPSOTable, uint64 InitialHash = 5699878132332235837ull);
4973
4974 FString ProgramName;
4975 TArray<FNameMap> NameMaps;
4976 int32 RootShaderIndex = -1;
4979};
4980
4982{
4983public:
4984
4985 uint32 MaxAttributeSizeInBytes = 8; // sizeof FRayTracingIntersectionAttributes declared in RayTracingCommon.ush
4986 uint32 MaxPayloadSizeInBytes = 24; // sizeof FDefaultPayload declared in RayTracingCommon.ush
4987
4988 // NOTE: GetTypeHash(const FRayTracingPipelineStateInitializer& Initializer) should also be updated when changing this function
4990 {
4991 return MaxAttributeSizeInBytes == rhs.MaxAttributeSizeInBytes
4992 && MaxPayloadSizeInBytes == rhs.MaxPayloadSizeInBytes
4993 && RayGenHash == rhs.RayGenHash
4994 && MissHash == rhs.MissHash
4995 && HitGroupHash == rhs.HitGroupHash
4996 && CallableHash == rhs.CallableHash;
4997 }
4998
5000 {
5001 return GetTypeHash(Initializer.MaxAttributeSizeInBytes) ^
5002 GetTypeHash(Initializer.MaxPayloadSizeInBytes) ^
5003 GetTypeHash(Initializer.GetRayGenHash()) ^
5004 GetTypeHash(Initializer.GetRayMissHash()) ^
5005 GetTypeHash(Initializer.GetHitGroupHash()) ^
5006 GetTypeHash(Initializer.GetCallableHash());
5007 }
5008
5009 uint64 GetHitGroupHash() const { return HitGroupHash; }
5010 uint64 GetRayGenHash() const { return RayGenHash; }
5011 uint64 GetRayMissHash() const { return MissHash; }
5012 uint64 GetCallableHash() const { return CallableHash; }
5013
5014protected:
5015
5016 uint64 RayGenHash = 0;
5017 uint64 MissHash = 0;
5018 uint64 HitGroupHash = 0;
5019 uint64 CallableHash = 0;
5020};
5021
5023{
5024public:
5025
5027
5028 // Partial ray tracing pipelines can be used for run-time asynchronous shader compilation, but not for rendering.
5029 // Any number of shaders for any stage may be provided when creating partial pipelines, but
5030 // at least one shader must be present in total (completely empty pipelines are not allowed).
5031 bool bPartial = false;
5032
5033 // Hints to the RHI that this PSO is being compiled by a background task and will not be needed immediately for rendering.
5034 // Speculative PSO pre-caching or non-blocking PSO creation should set this flag.
5035 // This may be used by the RHI to decide if a hitch warning should be reported, change priority of any internally dispatched tasks, etc.
5036 // Does not affect the creation of the PSO itself.
5037 bool bBackgroundCompilation = false;
5038
5039 // Ray tracing pipeline may be created by deriving from the existing base.
5040 // Base pipeline will be extended by adding new shaders into it, potentially saving substantial amount of CPU time.
5041 // Depends on GRHISupportsRayTracingPSOAdditions support at runtime (base pipeline is simply ignored if it is unsupported).
5043
5044 // Shader binding table layout used during shader compilation which needs to be the same for all shaders in the RTPSO and defines
5045 // how uniform buffers needs to be bound at runtime (global(RayGen) vs local(miss/hit/callable) data)
5047
5048 const TArrayView<FRHIRayTracingShader*>& GetRayGenTable() const { return RayGenTable; }
5049 const TArrayView<FRHIRayTracingShader*>& GetMissTable() const { return MissTable; }
5050 const TArrayView<FRHIRayTracingShader*>& GetHitGroupTable() const { return HitGroupTable; }
5051 const TArrayView<FRHIRayTracingShader*>& GetCallableTable() const { return CallableTable; }
5052
5053 // Shaders used as entry point to ray tracing work. At least one RayGen shader must be provided.
5059
5060 // Shaders that will be invoked if a ray misses all geometry.
5061 // If this table is empty, then a built-in default miss shader will be used that sets HitT member of FMinimalPayload to -1.
5062 // Desired miss shader can be selected by providing MissShaderIndex to TraceRay() function.
5068
5069 // Shaders that will be invoked when ray intersects geometry.
5070 // If this table is empty, then a built-in default shader will be used for all geometry, using FDefaultPayload.
5072 {
5073 HitGroupTable = InHitGroups;
5074 HitGroupHash = Hash ? Hash : ComputeShaderTableHash(HitGroupTable);
5075 }
5076
5077 // Shaders that can be explicitly invoked from RayGen shaders by their Shader Binding Table (SBT) index.
5078 // SetRayTracingCallableShader() command must be used to fill SBT slots before a shader can be called.
5080 {
5081 CallableTable = InCallableShaders;
5082 CallableHash = Hash ? Hash : ComputeShaderTableHash(CallableTable);
5083 }
5084
5085 // Retrieve the max local binding size of all the raytracing shaders used in the RTPSO
5086 RHI_API uint32 GetMaxLocalBindingDataSize() const;
5087
5088private:
5093};
5094
5095// This PSO is used as a fallback for RHIs that dont support PSOs. It is used to set the graphics state using the legacy state setting APIs
5097{
5098public:
5100
5105
5107 {
5108 switch (Frequency)
5109 {
5110 case SF_Vertex: return Initializer.BoundShaderState.GetVertexShader();
5111 case SF_Mesh: return Initializer.BoundShaderState.GetMeshShader();
5112 case SF_Amplification: return Initializer.BoundShaderState.GetAmplificationShader();
5113 case SF_Pixel: return Initializer.BoundShaderState.GetPixelShader();
5114 case SF_Geometry: return Initializer.BoundShaderState.GetGeometryShader();
5115 default: return nullptr;
5116 }
5117 }
5118
5120};
5121
5129
5131{
5132 LoadOpMask = 2,
5133
5134#define RTACTION_MAKE_MASK(Load, Store) (((uint8)ERenderTargetLoadAction::Load << (uint8)LoadOpMask) | (uint8)ERenderTargetStoreAction::Store)
5135
5137
5141
5146
5147#undef RTACTION_MAKE_MASK
5148};
5149
5154
5159
5164
5166{
5167 DepthMask = 4,
5168
5169#define RTACTION_MAKE_MASK(Depth, Stencil) (((uint8)ERenderTargetActions::Depth << (uint8)DepthMask) | (uint8)ERenderTargetActions::Stencil)
5170
5179
5187
5189
5190#undef RTACTION_MAKE_MASK
5191};
5192
5197
5202
5207
5209{
5214
5215 // e.g. for a a full 256 x 256 area starting at (0, 0) it would be
5216 // the values would be 0, 0, 256, 256
5218 : X1(InX1)
5219 , Y1(InY1)
5220 , X2(InX2)
5221 , Y2(InY2)
5222 {}
5223
5225 : X1(Other.Min.X)
5226 , Y1(Other.Min.Y)
5227 , X2(Other.Max.X)
5228 , Y2(Other.Max.Y)
5229 {}
5230
5232 {
5233 return X1 == Other.X1 && Y1 == Other.Y1 && X2 == Other.X2 && Y2 == Other.Y2;
5234 }
5235
5237 {
5238 return !(*this == Other);
5239 }
5240
5241 bool IsValid() const
5242 {
5243 return X1 >= 0 && Y1 >= 0 && X2 - X1 > 0 && Y2 - Y1 > 0;
5244 }
5245};
5246
5248{
5250 {
5252 FRHITexture* ResolveTarget = nullptr;
5253 int32 ArraySlice = -1;
5254 uint8 MipIndex = 0;
5256 };
5258
5267
5268 // Controls the area for a multisample resolve or raster UAV (i.e. no fixed-function targets) operation.
5270
5271 // Some RHIs can use a texture to control the sampling and/or shading resolution of different areas
5272 FTextureRHIRef ShadingRateTexture = nullptr;
5273 EVRSRateCombiner ShadingRateTextureCombiner = VRSRB_Passthrough;
5274
5275 // Some RHIs need to know the layout of all planes in the depth target
5277
5278 // Some RHIs require a hint that occlusion queries will be used in this render pass
5279 uint32 NumOcclusionQueries = 0;
5280 bool bOcclusionQueries = false;
5281
5282 // if this renderpass should be multiview, and if so how many views are required
5283 uint8 MultiViewCount = 0;
5284
5285 // Hint for some RHI's that renderpass will have specific sub-passes
5287
5291
5292 // Color, no depth, optional resolve, optional mip, optional array slice
5294 {
5295 check(!(ResolveRT && ResolveRT->IsMultisampled()));
5296 check(ColorRT);
5297 ColorRenderTargets[0].RenderTarget = ColorRT;
5298 ColorRenderTargets[0].ResolveTarget = ResolveRT;
5299 ColorRenderTargets[0].ArraySlice = InArraySlice;
5300 ColorRenderTargets[0].MipIndex = InMipIndex;
5301 ColorRenderTargets[0].Action = ColorAction;
5302 }
5303
5304 // Color MRTs, no depth
5306 {
5307 check(NumColorRTs > 0);
5308 for (int32 Index = 0; Index < NumColorRTs; ++Index)
5309 {
5311 ColorRenderTargets[Index].RenderTarget = ColorRTs[Index];
5312 ColorRenderTargets[Index].ArraySlice = -1;
5313 ColorRenderTargets[Index].Action = ColorAction;
5314 }
5315 DepthStencilRenderTarget.DepthStencilTarget = nullptr;
5316 DepthStencilRenderTarget.Action = EDepthStencilTargetActions::DontLoad_DontStore;
5318 DepthStencilRenderTarget.ResolveTarget = nullptr;
5319 }
5320
5321 // Color MRTs, no depth
5323 {
5324 check(NumColorRTs > 0);
5325 for (int32 Index = 0; Index < NumColorRTs; ++Index)
5326 {
5328 ColorRenderTargets[Index].RenderTarget = ColorRTs[Index];
5329 ColorRenderTargets[Index].ResolveTarget = ResolveTargets[Index];
5330 ColorRenderTargets[Index].ArraySlice = -1;
5331 ColorRenderTargets[Index].MipIndex = 0;
5332 ColorRenderTargets[Index].Action = ColorAction;
5333 }
5334 DepthStencilRenderTarget.DepthStencilTarget = nullptr;
5335 DepthStencilRenderTarget.Action = EDepthStencilTargetActions::DontLoad_DontStore;
5337 DepthStencilRenderTarget.ResolveTarget = nullptr;
5338 }
5339
5340 // Color MRTs and depth
5342 {
5343 check(NumColorRTs > 0);
5344 for (int32 Index = 0; Index < NumColorRTs; ++Index)
5345 {
5347 ColorRenderTargets[Index].RenderTarget = ColorRTs[Index];
5348 ColorRenderTargets[Index].ResolveTarget = nullptr;
5349 ColorRenderTargets[Index].ArraySlice = -1;
5350 ColorRenderTargets[Index].MipIndex = 0;
5351 ColorRenderTargets[Index].Action = ColorAction;
5352 }
5353 check(DepthRT);
5354 DepthStencilRenderTarget.DepthStencilTarget = DepthRT;
5355 DepthStencilRenderTarget.ResolveTarget = nullptr;
5356 DepthStencilRenderTarget.Action = DepthActions;
5357 DepthStencilRenderTarget.ExclusiveDepthStencil = InEDS;
5358 }
5359
5360 // Color MRTs and depth
5362 {
5363 check(NumColorRTs > 0);
5364 for (int32 Index = 0; Index < NumColorRTs; ++Index)
5365 {
5366 check(!ResolveRTs[Index] || ResolveRTs[Index]->IsMultisampled());
5368 ColorRenderTargets[Index].RenderTarget = ColorRTs[Index];
5369 ColorRenderTargets[Index].ResolveTarget = ResolveRTs[Index];
5370 ColorRenderTargets[Index].ArraySlice = -1;
5371 ColorRenderTargets[Index].MipIndex = 0;
5372 ColorRenderTargets[Index].Action = ColorAction;
5373 }
5374 check(!ResolveDepthRT || ResolveDepthRT->IsMultisampled());
5375 check(DepthRT);
5376 DepthStencilRenderTarget.DepthStencilTarget = DepthRT;
5377 DepthStencilRenderTarget.ResolveTarget = ResolveDepthRT;
5378 DepthStencilRenderTarget.Action = DepthActions;
5379 DepthStencilRenderTarget.ExclusiveDepthStencil = InEDS;
5380 }
5381
5382 // Depth, no color
5384 {
5385 check(!ResolveDepthRT || ResolveDepthRT->IsMultisampled());
5386 check(DepthRT);
5387 DepthStencilRenderTarget.DepthStencilTarget = DepthRT;
5388 DepthStencilRenderTarget.ResolveTarget = ResolveDepthRT;
5389 DepthStencilRenderTarget.Action = DepthActions;
5390 DepthStencilRenderTarget.ExclusiveDepthStencil = InEDS;
5391 }
5392
5393 // Depth, no color, occlusion queries
5395 : NumOcclusionQueries(InNumOcclusionQueries)
5396 {
5397 check(!ResolveDepthRT || ResolveDepthRT->IsMultisampled());
5398 check(DepthRT);
5399 DepthStencilRenderTarget.DepthStencilTarget = DepthRT;
5400 DepthStencilRenderTarget.ResolveTarget = ResolveDepthRT;
5401 DepthStencilRenderTarget.Action = DepthActions;
5402 DepthStencilRenderTarget.ExclusiveDepthStencil = InEDS;
5403 }
5404
5405 // Color and depth
5407 {
5408 check(ColorRT);
5409 ColorRenderTargets[0].RenderTarget = ColorRT;
5410 ColorRenderTargets[0].ResolveTarget = nullptr;
5411 ColorRenderTargets[0].ArraySlice = -1;
5412 ColorRenderTargets[0].MipIndex = 0;
5413 ColorRenderTargets[0].Action = ColorAction;
5414 check(DepthRT);
5415 DepthStencilRenderTarget.DepthStencilTarget = DepthRT;
5416 DepthStencilRenderTarget.ResolveTarget = nullptr;
5417 DepthStencilRenderTarget.Action = DepthActions;
5418 DepthStencilRenderTarget.ExclusiveDepthStencil = InEDS;
5419 FMemory::Memzero(&ColorRenderTargets[1], sizeof(FColorEntry) * (MaxSimultaneousRenderTargets - 1));
5420 }
5421
5422 // Color and depth with resolve
5425 {
5426 check(!ResolveColorRT || ResolveColorRT->IsMultisampled());
5427 check(!ResolveDepthRT || ResolveDepthRT->IsMultisampled());
5428 check(ColorRT);
5429 ColorRenderTargets[0].RenderTarget = ColorRT;
5430 ColorRenderTargets[0].ResolveTarget = ResolveColorRT;
5431 ColorRenderTargets[0].ArraySlice = -1;
5432 ColorRenderTargets[0].MipIndex = 0;
5433 ColorRenderTargets[0].Action = ColorAction;
5434 check(DepthRT);
5435 DepthStencilRenderTarget.DepthStencilTarget = DepthRT;
5436 DepthStencilRenderTarget.ResolveTarget = ResolveDepthRT;
5437 DepthStencilRenderTarget.Action = DepthActions;
5438 DepthStencilRenderTarget.ExclusiveDepthStencil = InEDS;
5439 FMemory::Memzero(&ColorRenderTargets[1], sizeof(FColorEntry) * (MaxSimultaneousRenderTargets - 1));
5440 }
5441
5442 // Color and depth with resolve and optional sample density
5447 {
5448 check(!ResolveColorRT || ResolveColorRT->IsMultisampled());
5449 check(!ResolveDepthRT || ResolveDepthRT->IsMultisampled());
5450 check(ColorRT);
5451 ColorRenderTargets[0].RenderTarget = ColorRT;
5452 ColorRenderTargets[0].ResolveTarget = ResolveColorRT;
5453 ColorRenderTargets[0].ArraySlice = -1;
5454 ColorRenderTargets[0].MipIndex = 0;
5455 ColorRenderTargets[0].Action = ColorAction;
5456 check(DepthRT);
5457 DepthStencilRenderTarget.DepthStencilTarget = DepthRT;
5458 DepthStencilRenderTarget.ResolveTarget = ResolveDepthRT;
5459 DepthStencilRenderTarget.Action = DepthActions;
5460 DepthStencilRenderTarget.ExclusiveDepthStencil = InEDS;
5461 ShadingRateTexture = InShadingRateTexture;
5462 ShadingRateTextureCombiner = InShadingRateTextureCombiner;
5463 FMemory::Memzero(&ColorRenderTargets[1], sizeof(FColorEntry) * (MaxSimultaneousRenderTargets - 1));
5464 }
5465
5467 {
5468 int32 ColorIndex = 0;
5470 {
5471 const FColorEntry& Entry = ColorRenderTargets[ColorIndex];
5472 if (!Entry.RenderTarget)
5473 {
5474 break;
5475 }
5476 }
5477
5478 return ColorIndex;
5479 }
5480
5482 {
5484
5487
5489 {
5490 FRHITexture* RenderTarget = ColorRenderTargets[RenderTargetIndex].RenderTarget;
5491 if (!RenderTarget)
5492 {
5493 break;
5494 }
5495
5496 RenderTargetsInfo.RenderTargetFormats[RenderTargetIndex] = (uint8)RenderTarget->GetFormat();
5497 RenderTargetsInfo.RenderTargetFlags[RenderTargetIndex] = RenderTarget->GetFlags();
5498 RenderTargetsInfo.NumSamples |= RenderTarget->GetNumSamples();
5499 }
5500
5501 RenderTargetsInfo.RenderTargetsEnabled = RenderTargetIndex;
5503 {
5504 RenderTargetsInfo.RenderTargetFormats[RenderTargetIndex] = PF_Unknown;
5505 }
5506
5507 if (DepthStencilRenderTarget.DepthStencilTarget)
5508 {
5509 RenderTargetsInfo.DepthStencilTargetFormat = DepthStencilRenderTarget.DepthStencilTarget->GetFormat();
5510 RenderTargetsInfo.DepthStencilTargetFlag = DepthStencilRenderTarget.DepthStencilTarget->GetFlags();
5511 RenderTargetsInfo.NumSamples |= DepthStencilRenderTarget.DepthStencilTarget->GetNumSamples();
5512 }
5513 else
5514 {
5515 RenderTargetsInfo.DepthStencilTargetFormat = PF_Unknown;
5516 }
5517
5518 const ERenderTargetActions DepthActions = GetDepthActions(DepthStencilRenderTarget.Action);
5519 const ERenderTargetActions StencilActions = GetStencilActions(DepthStencilRenderTarget.Action);
5520 RenderTargetsInfo.DepthTargetLoadAction = GetLoadAction(DepthActions);
5521 RenderTargetsInfo.DepthTargetStoreAction = GetStoreAction(DepthActions);
5522 RenderTargetsInfo.StencilTargetLoadAction = GetLoadAction(StencilActions);
5523 RenderTargetsInfo.StencilTargetStoreAction = GetStoreAction(StencilActions);
5524 RenderTargetsInfo.DepthStencilAccess = DepthStencilRenderTarget.ExclusiveDepthStencil;
5525
5526 RenderTargetsInfo.MultiViewCount = MultiViewCount;
5527 RenderTargetsInfo.bHasFragmentDensityAttachment = ShadingRateTexture != nullptr;
5528
5529 return RenderTargetsInfo;
5530 }
5531
5532#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
5533 RHI_API void Validate() const;
5534#else
5535 void Validate() const {}
5536#endif
5537 RHI_API void ConvertToRenderTargetsInfo(FRHISetRenderTargetsInfo& OutRTInfo) const;
5538};
5539
5540class FRHIContextArray : public TRHIPipelineArray<IRHIComputeContext*>
5541{
5543public:
5544 using Base::Base;
5545};
5546
5548{
5549 FRHIContextArray Contexts{ InPlace, nullptr };
5550 IRHIUploadContext* UploadContext = nullptr;
5552
5553 // Contains platform specific data
5554 void* RHIPlatformData = nullptr;
5555
5559};
5560
5561//UE_DEPRECATED(5.3, "Use FRHITextureSRVCreateDesc::SetDisableSRGB to create a view which explicitly disables SRGB.")
5567
5568//UE_DEPRECATED(5.3, "Use FRHITextureSRVCreateDesc rather than FRHITextureSRVCreateInfo.")
5570{
5572 : Format(InFormat)
5573 , MipLevel(InMipLevel)
5574 , NumMipLevels(InNumMipLevels)
5575 , SRGBOverride(SRGBO_Default)
5576 , FirstArraySlice(0)
5577 , NumArraySlices(0)
5578 {}
5579
5581 : Format(InFormat)
5582 , MipLevel(InMipLevel)
5583 , NumMipLevels(InNumMipLevels)
5584 , SRGBOverride(SRGBO_Default)
5585 , FirstArraySlice(InFirstArraySlice)
5586 , NumArraySlices(InNumArraySlices)
5587 {}
5588
5591
5594
5597
5600
5603
5606
5609
5612
5614 {
5615 return (
5616 Format == Other.Format &&
5617 MipLevel == Other.MipLevel &&
5618 NumMipLevels == Other.NumMipLevels &&
5619 SRGBOverride == Other.SRGBOverride &&
5620 FirstArraySlice == Other.FirstArraySlice &&
5621 NumArraySlices == Other.NumArraySlices &&
5622 MetaData == Other.MetaData &&
5623 DimensionOverride == Other.DimensionOverride);
5624 }
5625
5627 {
5628 return !(*this == Other);
5629 }
5630
5632 {
5633 uint32 Hash = uint32(Info.Format) | uint32(Info.MipLevel) << 8 | uint32(Info.NumMipLevels) << 16 | uint32(Info.SRGBOverride) << 24;
5634 Hash = HashCombine(Hash, uint32(Info.FirstArraySlice) | uint32(Info.NumArraySlices) << 16);
5635 Hash = HashCombine(Hash, Info.DimensionOverride.IsSet() ? uint32(*Info.DimensionOverride) : MAX_uint32);
5636 Hash = HashCombine(Hash, uint32(Info.MetaData));
5637 return Hash;
5638 }
5639
5641 static bool CheckValidity(const FRHITextureDesc& TextureDesc, const FRHITextureSRVCreateInfo& TextureSRVDesc, const TCHAR* TextureName)
5642 {
5643 return FRHITextureSRVCreateInfo::Validate(TextureDesc, TextureSRVDesc, TextureName, /* bFatal = */ true);
5644 }
5645
5646protected:
5647 RHI_API static bool Validate(const FRHITextureDesc& TextureDesc, const FRHITextureSRVCreateInfo& TextureSRVDesc, const TCHAR* TextureName, bool bFatal);
5648};
5649
5651{
5652public:
5654
5656 : Format(InFormat)
5657 , MipLevel(InMipLevel)
5658 , FirstArraySlice(InFirstArraySlice)
5659 , NumArraySlices(InNumArraySlices)
5660 {}
5661
5665
5667 {
5668 return Format == Other.Format && MipLevel == Other.MipLevel && MetaData == Other.MetaData &&
5669 FirstArraySlice == Other.FirstArraySlice && NumArraySlices == Other.NumArraySlices &&
5670 DimensionOverride == Other.DimensionOverride;
5671 }
5672
5674 {
5675 return !(*this == Other);
5676 }
5677
5679 {
5680 uint32 Hash = uint32(Info.Format) | uint32(Info.MipLevel) << 8 | uint32(Info.FirstArraySlice) << 16;
5681 Hash = HashCombine(Hash, Info.DimensionOverride.IsSet() ? uint32(*Info.DimensionOverride) : MAX_uint32);
5682 Hash = HashCombine(Hash, uint32(Info.NumArraySlices) | uint32(Info.MetaData) << 16);
5683 return Hash;
5684 }
5685
5687 uint8 MipLevel = 0;
5688 uint16 FirstArraySlice = 0;
5689 uint16 NumArraySlices = 0; // When 0, the default behavior will be used, e.g. all slices mapped.
5691
5694};
5695
5698
5700{
5701 explicit FRHIBufferSRVCreateInfo() = default;
5702
5706
5711
5716
5718 {
5719 return Format == Other.Format
5720 && StartOffsetBytes == Other.StartOffsetBytes
5721 && NumElements == Other.NumElements
5722 && RayTracingScene == Other.RayTracingScene;
5723 }
5724
5726 {
5727 return !(*this == Other);
5728 }
5729
5731 {
5732 return HashCombine(
5734 HashCombine(GetTypeHash(Desc.Format), GetTypeHash(Desc.StartOffsetBytes)),
5735 GetTypeHash(Desc.NumElements)),
5736 GetTypeHash(Desc.RayTracingScene)
5737 );
5738 }
5739
5742
5744 uint32 StartOffsetBytes = 0;
5745
5747 uint32 NumElements = UINT32_MAX;
5748
5750 FRHIRayTracingScene* RayTracingScene = nullptr;
5751};
5752
5754{
5756
5760
5762 {
5763 return Format == Other.Format && bSupportsAtomicCounter == Other.bSupportsAtomicCounter && bSupportsAppendBuffer == Other.bSupportsAppendBuffer;
5764 }
5765
5767 {
5768 return !(*this == Other);
5769 }
5770
5772 {
5773 return uint32(Info.Format) | uint32(Info.bSupportsAtomicCounter) << 8 | uint32(Info.bSupportsAppendBuffer) << 16;
5774 }
5775
5778
5780 bool bSupportsAtomicCounter = false;
5781 bool bSupportsAppendBuffer = false;
5782};
5783
5785{
5786public:
5787 // Finds a UAV matching the descriptor in the cache or creates a new one and updates the cache.
5788 RHI_API FRHIUnorderedAccessView* GetOrCreateUAV(FRHICommandListBase& RHICmdList, FRHITexture* Texture, const FRHITextureUAVCreateInfo& CreateInfo);
5789
5790 // Finds a SRV matching the descriptor in the cache or creates a new one and updates the cache.
5791 RHI_API FRHIShaderResourceView* GetOrCreateSRV(FRHICommandListBase& RHICmdList, FRHITexture* Texture, const FRHITextureSRVCreateInfo& CreateInfo);
5792
5793 // Sets the debug name of the RHI view resources.
5794#if RHI_USE_RESOURCE_DEBUG_NAME
5795 RHI_API void SetDebugName(FRHICommandListBase& RHICmdList, const TCHAR* DebugName);
5796#else
5797 void SetDebugName(FRHICommandListBase& RHICmdList, const TCHAR* DebugName) {}
5798#endif
5799
5800private:
5803};
5804
5806{
5807public:
5808 // Finds a UAV matching the descriptor in the cache or creates a new one and updates the cache.
5809 RHI_API FRHIUnorderedAccessView* GetOrCreateUAV(FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer, const FRHIBufferUAVCreateInfo& CreateInfo);
5810
5811 // Finds a SRV matching the descriptor in the cache or creates a new one and updates the cache.
5812 RHI_API FRHIShaderResourceView* GetOrCreateSRV(FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer, const FRHIBufferSRVCreateInfo& CreateInfo);
5813
5814 // Sets the debug name of the RHI view resources.
5815#if RHI_USE_RESOURCE_DEBUG_NAME
5816 RHI_API void SetDebugName(FRHICommandListBase& RHICmdList, const TCHAR* DebugName);
5817#else
5818 void SetDebugName(FRHICommandListBase& RHICmdList, const TCHAR* DebugName) {}
5819#endif
5820 inline int32 NumItems() const
5821 {
5822 return UAVs.Num() + SRVs.Num();
5823 }
5824
5825private:
5828};
#define NULL
Definition oodle2base.h:134
#define PLATFORM_SUPPORTS_GEOMETRY_SHADERS
Definition AndroidPlatform.h:62
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
#define checkNoEntry()
Definition AssertionMacros.h:316
#define ensure( InExpression)
Definition AssertionMacros.h:464
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define ENABLE_RHI_VALIDATION
Definition Build.h:475
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
@ InPlace
Definition CoreMiscDefines.h:162
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
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
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:35
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
FArchive & operator<<(FArchive &Ar, FEnvQueryDebugProfileData::FStep &Data)
Definition EnvQueryTypes.cpp:489
return true
Definition ExternalRpcRegistry.cpp:601
#define X(Name, Desc)
Definition FormatStringSan.h:47
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
void Init()
Definition LockFreeList.h:4
UE_FORCEINLINE_HINT bool operator!=(const FIndexedPointer &Other) const
Definition LockFreeList.h:76
FInt32Vector3 FIntVector
Definition MathFwd.h:115
FInt32Point FIntPoint
Definition MathFwd.h:124
#define DECLARE_INTRINSIC_TYPE_LAYOUT(T)
Definition MemoryLayout.h:760
#define MAX_NUM_GPUS
Definition MultiGPU.h:25
#define MAX_uint32
Definition NumericLimits.h:21
#define MAX_uint8
Definition NumericLimits.h:19
FPixelFormatInfo GPixelFormats[PF_MAX]
Definition PixelFormat.cpp:31
bool IsStencilFormat(EPixelFormat Format)
Definition PixelFormat.h:409
#define UE_PIXELFORMAT_TO_UINT8(argument)
Definition PixelFormat.h:268
EPixelFormat
Definition PixelFormat.h:16
@ PF_Unknown
Definition PixelFormat.h:17
@ PF_MAX
Definition PixelFormat.h:111
@ PF_D24
Definition PixelFormat.h:37
ERHIAccess
Definition RHIAccess.h:11
ERHIUniformBufferFlags
Definition RHIDefinitions.h:704
EVertexElementType
Definition RHIDefinitions.h:496
@ VET_Float3
Definition RHIDefinitions.h:500
#define TexCreate_ResolveTargetable
Definition RHIDefinitions.h:1193
EShaderFrequency
Definition RHIDefinitions.h:202
@ SF_Compute
Definition RHIDefinitions.h:208
@ SF_Amplification
Definition RHIDefinitions.h:205
@ SF_Vertex
Definition RHIDefinitions.h:203
@ SF_Mesh
Definition RHIDefinitions.h:204
@ SF_Geometry
Definition RHIDefinitions.h:207
@ SF_RayGen
Definition RHIDefinitions.h:209
@ SF_RayCallable
Definition RHIDefinitions.h:212
@ SF_RayMiss
Definition RHIDefinitions.h:210
@ SF_RayHitGroup
Definition RHIDefinitions.h:211
@ SF_WorkGraphRoot
Definition RHIDefinitions.h:213
@ SF_WorkGraphComputeNode
Definition RHIDefinitions.h:214
@ SF_Pixel
Definition RHIDefinitions.h:206
ERHIDescriptorType
Definition RHIDefinitions.h:1348
#define TexCreate_RenderTargetable
Definition RHIDefinitions.h:1192
ERHIResourceType
Definition RHIDefinitions.h:1030
@ RRT_SamplerState
Definition RHIDefinitions.h:1033
@ RRT_RayTracingAccelerationStructure
Definition RHIDefinitions.h:1065
@ RRT_RayTracingShader
Definition RHIDefinitions.h:1043
@ RRT_AmplificationShader
Definition RHIDefinitions.h:1040
@ RRT_PixelShader
Definition RHIDefinitions.h:1041
@ RRT_RenderQuery
Definition RHIDefinitions.h:1060
@ RRT_WorkGraphShader
Definition RHIDefinitions.h:1071
@ RRT_DepthStencilState
Definition RHIDefinitions.h:1035
@ RRT_ShaderBundle
Definition RHIDefinitions.h:1070
@ RRT_CustomPresent
Definition RHIDefinitions.h:1068
@ RRT_RenderQueryPool
Definition RHIDefinitions.h:1061
@ RRT_BlendState
Definition RHIDefinitions.h:1036
@ RRT_VertexShader
Definition RHIDefinitions.h:1038
@ RRT_RayTracingPipelineState
Definition RHIDefinitions.h:1047
@ RRT_BoundShaderState
Definition RHIDefinitions.h:1048
@ RRT_UniformBuffer
Definition RHIDefinitions.h:1050
@ RRT_VertexDeclaration
Definition RHIDefinitions.h:1037
@ RRT_StagingBuffer
Definition RHIDefinitions.h:1067
@ RRT_RasterizerState
Definition RHIDefinitions.h:1034
@ RRT_ComputePipelineState
Definition RHIDefinitions.h:1046
@ RRT_GeometryShader
Definition RHIDefinitions.h:1042
@ RRT_Viewport
Definition RHIDefinitions.h:1062
@ RRT_StreamSourceSlot
Definition RHIDefinitions.h:1073
@ RRT_UnorderedAccessView
Definition RHIDefinitions.h:1063
@ RRT_ShaderResourceView
Definition RHIDefinitions.h:1064
@ RRT_MeshShader
Definition RHIDefinitions.h:1039
@ RRT_WorkGraphPipelineState
Definition RHIDefinitions.h:1072
@ RRT_ComputeShader
Definition RHIDefinitions.h:1044
@ RRT_GPUFence
Definition RHIDefinitions.h:1059
@ RRT_RayTracingShaderBindingTable
Definition RHIDefinitions.h:1066
@ RRT_GraphicsPipelineState
Definition RHIDefinitions.h:1045
@ RRT_TimestampCalibrationQuery
Definition RHIDefinitions.h:1058
#define TexCreate_Memoryless
Definition RHIDefinitions.h:1204
@ MaxSimultaneousRenderTargets
Definition RHIDefinitions.h:287
EBufferUsageFlags
Definition RHIDefinitions.h:892
ETextureDimension
Definition RHIDefinitions.h:1081
#define TexCreate_None
Definition RHIDefinitions.h:1191
uint8 FUniformBufferStaticSlot
Definition RHIDefinitions.h:722
EUniformBufferBaseType
Definition RHIDefinitions.h:634
bool IsUniformBufferStaticSlotValid(const FUniformBufferStaticSlot Slot)
Definition RHIDefinitions.h:731
EVRSRateCombiner
Definition RHIDefinitions.h:873
@ VRSRB_Passthrough
Definition RHIDefinitions.h:874
#define BUF_ByteAddressBuffer
Definition RHIDefinitions.h:984
EUniformBufferBindingFlags
Definition RHIDefinitions.h:686
#define BUF_AccelerationStructure
Definition RHIDefinitions.h:993
ERenderTargetStoreAction
Definition RHIDefinitions.h:1272
ETextureCreateFlags
Definition RHIDefinitions.h:1091
#define BUF_StructuredBuffer
Definition RHIDefinitions.h:997
ERenderTargetLoadAction
Definition RHIDefinitions.h:1253
#define TexCreate_UAV
Definition RHIDefinitions.h:1209
EPrimitiveType
Definition RHIDefinitions.h:822
EVRSShadingRate
Definition RHIDefinitions.h:860
@ VRSSR_1x1
Definition RHIDefinitions.h:861
#define TexCreate_DepthStencilResolveTarget
Definition RHIDefinitions.h:1219
ERayTracingClusterOperationFlags
Definition RHIResources.h:3790
ERayTracingClusterOperationType
Definition RHIResources.h:3767
ERayTracingGeometryInitializerType
Definition RHIResources.h:3450
ERenderTargetActions MakeRenderTargetActions(ERenderTargetLoadAction Load, ERenderTargetStoreAction Store)
Definition RHIResources.h:5150
constexpr uint16 kUniformBufferInvalidOffset
Definition RHIResources.h:1144
ERayTracingAccelerationStructureFlags
Definition RHIResources.h:3602
ERHIDescriptorType RHIDescriptorTypeFromViewType(FRHIViewDesc::EViewType ViewType)
Definition RHIResources.h:3313
ERenderTargetLoadAction GetLoadAction(ERenderTargetActions Action)
Definition RHIResources.h:5155
EClearBinding
Definition RHIResources.h:239
ERayTracingSceneLifetime
Definition RHIResources.h:3593
@ RTSL_SingleFrame
Definition RHIResources.h:3595
const TCHAR * GetShaderFrequencyString(bool bIncludePrefix=true)
Definition RHIResources.h:4356
ERayTracingHitGroupIndexingMode
Definition RHIResources.h:3628
uint64 FRayTracingAccelerationStructureAddress
Definition RHIResources.h:3725
ERayTracingGeometryType
Definition RHIResources.h:3434
@ RTGT_Triangles
Definition RHIResources.h:3439
@ RTGT_Procedural
Definition RHIResources.h:3445
ERHIShaderBundleMode
Definition RHIResources.h:3896
uint64 ComputeShaderTableHash(const TArrayView< TShaderType * > &ShaderTable, uint64 InitialHash=5699878132332235837ull)
Definition RHIResources.h:4862
EConservativeRasterization
Definition RHIResources.h:4541
ERayTracingShaderBindingTableLifetime
Definition RHIResources.h:3613
ERenderTargetActions
Definition RHIResources.h:5131
EDepthStencilTargetActions
Definition RHIResources.h:5166
TArray< FGraphEventRef, TInlineAllocator< 4 > > FGraphEventArray
Definition RHIResources.h:44
ERayTracingInstanceFlags
Definition RHIResources.h:3342
ERHIDescriptorType RHIDescriptorTypeFromViewDesc(const FRHIViewDesc &InViewDesc)
Definition RHIResources.h:3332
ERenderTargetActions GetDepthActions(EDepthStencilTargetActions Action)
Definition RHIResources.h:5198
ERayTracingClusterOperationMoveType
Definition RHIResources.h:3776
constexpr EDepthStencilTargetActions MakeDepthStencilTargetActions(const ERenderTargetActions Depth, const ERenderTargetActions Stencil)
Definition RHIResources.h:5193
ESubpassHint
Definition RHIResources.h:4526
@ DeferredShadingSubpass
ERHITextureSRVOverrideSRGBType
Definition RHIResources.h:5563
@ SRGBO_ForceDisable
Definition RHIResources.h:5565
@ SRGBO_Default
Definition RHIResources.h:5564
ERHITexturePlane
Definition RHIResources.h:2574
ERHITextureInitAction
Definition RHIResources.h:1926
#define RTACTION_MAKE_MASK(Load, Store)
Definition RHIResources.h:5134
ERayTracingClusterOperationMode
Definition RHIResources.h:3783
ERayTracingShaderBindingMode
Definition RHIResources.h:3620
ERenderTargetActions GetStencilActions(EDepthStencilTargetActions Action)
Definition RHIResources.h:5203
ERHIBufferInitAction
Definition RHIResources.h:1402
ERenderTargetStoreAction GetStoreAction(ERenderTargetActions Action)
Definition RHIResources.h:5160
ERHIAccess RHIGetDefaultResourceState(ETextureCreateFlags InUsage, bool bInHasInitialData)
Definition RHIUtilities.cpp:639
TArray< FVertexElement, TFixedAllocator< MaxVertexElementCount > > FVertexDeclarationElementList
Definition RHI.h:229
@ ShadowBuffer
Indicates this buffer is a full object's memory.
CORE_API bool IsInParallelRenderingThread()
Definition ThreadingBase.cpp:301
constexpr uint32 HashCombineFast(uint32 A, uint32 B)
Definition TypeHash.h:74
constexpr uint32 HashCombine(uint32 A, uint32 C)
Definition TypeHash.h:36
uint32 GetArrayHash(const T *Ptr, uint64 Size, uint32 PreviousHash=0)
Definition TypeHash.h:200
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
FRWLock Lock
Definition UnversionedPropertySerialization.cpp:921
uint32 Offset
Definition VulkanMemory.cpp:4033
uint32 Size
Definition VulkanMemory.cpp:4034
if(Failed) console_printf("Failed.\n")
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition RHI.h:403
Definition RHIResources.h:4820
uint8 bPSOPrecache
Definition RHIResources.h:4853
uint8 bFromPSOFileCache
Definition RHIResources.h:4854
uint8 Reserved
Definition RHIResources.h:4852
uint8 Flags
Definition RHIResources.h:4856
bool operator==(const FComputePipelineStateInitializer &Other) const
Definition RHIResources.h:4837
FComputePipelineStateInitializer()
Definition RHIResources.h:4823
FRHIComputeShader * ComputeShader
Definition RHIResources.h:4842
FComputePipelineStateInitializer(FRHIComputeShader *InComputeShader, uint8 InFlags)
Definition RHIResources.h:4829
Definition RHIDefinitions.h:95
Definition DynamicRHI.h:206
Definition RHIResources.h:409
FExclusiveDepthStencil GetWritableTransition() const
Definition RHIResources.h:610
bool IsUsingDepth() const
Definition RHIResources.h:450
void SetDepthStencilWrite(bool bDepth, bool bStencil)
Definition RHIResources.h:488
void EnumerateSubresources(TFunction Function) const
Definition RHIResources.h:557
void SetDepthWrite()
Definition RHIResources.h:480
void GetAccess(ERHIAccess &DepthAccess, ERHIAccess &StencilAccess) const
Definition RHIResources.h:530
bool IsStencilWrite() const
Definition RHIResources.h:466
bool IsDepthRead() const
Definition RHIResources.h:462
Type
Definition RHIResources.h:412
@ DepthWrite
Definition RHIResources.h:417
@ StencilNop
Definition RHIResources.h:419
@ StencilWrite
Definition RHIResources.h:421
@ DepthWrite_StencilWrite
Definition RHIResources.h:433
@ DepthNop
Definition RHIResources.h:415
@ StencilRead
Definition RHIResources.h:420
@ DepthNop_StencilNop
Definition RHIResources.h:425
@ DepthRead
Definition RHIResources.h:416
void SetStencilWrite()
Definition RHIResources.h:484
bool operator==(const FExclusiveDepthStencil &rhs) const
Definition RHIResources.h:501
uint32 GetIndex() const
Definition RHIResources.h:623
bool IsUsingDepthStencil() const
Definition RHIResources.h:446
bool IsDepthWrite() const
Definition RHIResources.h:458
bool IsUsingStencil() const
Definition RHIResources.h:454
FExclusiveDepthStencil(Type InValue=DepthNop_StencilNop)
Definition RHIResources.h:441
bool IsAnyWrite() const
Definition RHIResources.h:475
bool IsValid(FExclusiveDepthStencil &Current) const
Definition RHIResources.h:511
FExclusiveDepthStencil GetReadableTransition() const
Definition RHIResources.h:592
bool IsStencilRead() const
Definition RHIResources.h:470
Definition RHIResources.h:4001
~FGenericRHIStagingBuffer()
Definition RHIResources.h:4007
FGenericRHIStagingBuffer()
Definition RHIResources.h:4003
FBufferRHIRef ShadowBuffer
Definition RHIResources.h:4013
uint32 Offset
Definition RHIResources.h:4014
Definition RHIResources.h:4572
uint16 bFromPSOFileCache
Definition RHIResources.h:4791
EConservativeRasterization ConservativeRasterization
Definition RHIResources.h:4774
ERenderTargetStoreAction DepthTargetStoreAction
Definition RHIResources.h:4767
FGraphicsPipelineStateInitializer(FBoundShaderStateInput InBoundShaderState, FRHIBlendState *InBlendState, FRHIRasterizerState *InRasterizerState, FRHIDepthStencilState *InDepthStencilState, FImmutableSamplerState InImmutableSamplerState, EPrimitiveType InPrimitiveType, uint32 InRenderTargetsEnabled, const TRenderTargetFormats &InRenderTargetFormats, const TRenderTargetFlags &InRenderTargetFlags, EPixelFormat InDepthStencilTargetFormat, ETextureCreateFlags InDepthStencilTargetFlag, ERenderTargetLoadAction InDepthTargetLoadAction, ERenderTargetStoreAction InDepthTargetStoreAction, ERenderTargetLoadAction InStencilTargetLoadAction, ERenderTargetStoreAction InStencilTargetStoreAction, FExclusiveDepthStencil InDepthStencilAccess, uint16 InNumSamples, ESubpassHint InSubpassHint, uint8 InSubpassIndex, EConservativeRasterization InConservativeRasterization, uint16 InFlags, bool bInDepthBounds, uint8 InMultiViewCount, bool bInHasFragmentDensityAttachment, bool bInAllowVariableRateShading, EVRSShadingRate InShadingRate)
Definition RHIResources.h:4609
bool bDepthBounds
Definition RHIResources.h:4775
FBoundShaderStateInput BoundShaderState
Definition RHIResources.h:4754
EPixelFormat DepthStencilTargetFormat
Definition RHIResources.h:4764
EVRSShadingRate ShadingRate
Definition RHIResources.h:4779
static bool RelevantDepthStencilFlagsEqual(const ETextureCreateFlags A, const ETextureCreateFlags B)
Definition RHIResources.h:4728
uint32 RenderTargetsEnabled
Definition RHIResources.h:4761
FRHIBlendState * BlendState
Definition RHIResources.h:4755
uint64 StatePrecachePSOHash
Definition RHIResources.h:4816
uint16 PrecacheCompileType
Definition RHIResources.h:4792
ETextureCreateFlags DepthStencilTargetFlag
Definition RHIResources.h:4765
uint8 MultiViewCount
Definition RHIResources.h:4776
uint16 Flags
Definition RHIResources.h:4794
bool bHasFragmentDensityAttachment
Definition RHIResources.h:4777
ERenderTargetLoadAction StencilTargetLoadAction
Definition RHIResources.h:4768
EPSOPrecacheCompileType GetPSOPrecacheCompileType() const
Definition RHIResources.h:4812
FRHIRasterizerState * RasterizerState
Definition RHIResources.h:4756
static bool RelevantRenderTargetFlagsEqual(const TRenderTargetFlags &A, const TRenderTargetFlags &B)
Definition RHIResources.h:4714
uint8 SubpassIndex
Definition RHIResources.h:4773
ERenderTargetLoadAction DepthTargetLoadAction
Definition RHIResources.h:4766
void SetPSOPrecacheCompileType(EPSOPrecacheCompileType PrecacheCompileTypeIN)
Definition RHIResources.h:4807
ESubpassHint SubpassHint
Definition RHIResources.h:4772
uint16 Reserved
Definition RHIResources.h:4789
TRenderTargetFormats RenderTargetFormats
Definition RHIResources.h:4762
uint16 bPSOPrecache
Definition RHIResources.h:4790
FExclusiveDepthStencil DepthStencilAccess
Definition RHIResources.h:4770
FRHIDepthStencilState * DepthStencilState
Definition RHIResources.h:4757
uint32 ComputeNumValidRenderTargets() const
Definition RHIResources.h:4735
TRenderTargetFlags RenderTargetFlags
Definition RHIResources.h:4763
bool bAllowVariableRateShading
Definition RHIResources.h:4778
bool operator==(const FGraphicsPipelineStateInitializer &rhs) const
Definition RHIResources.h:4666
EPrimitiveType PrimitiveType
Definition RHIResources.h:4760
ERenderTargetStoreAction StencilTargetStoreAction
Definition RHIResources.h:4769
uint16 NumSamples
Definition RHIResources.h:4771
FGraphicsPipelineStateInitializer()
Definition RHIResources.h:4578
EPSOPrecacheCompileType
Definition RHIResources.h:4798
FImmutableSamplerState ImmutableSamplerState
Definition RHIResources.h:4758
Definition HazardPointer.h:58
Definition RHIResources.h:1666
double GetLastRenderTime() const
Definition RHIResources.h:1670
FLastRenderTimeContainer()
Definition RHIResources.h:1668
void SetLastRenderTime(double InLastRenderTime)
Definition RHIResources.h:1672
Definition NameTypes.h:1680
Definition NameTypes.h:617
Definition RHIResources.h:966
FRHIAmplificationShader()
Definition RHIResources.h:968
Definition RHIResources.h:696
FRHIBlendState()
Definition RHIResources.h:698
virtual bool GetInitializer(class FBlendStateInitializerRHI &Init)
Definition RHIResources.h:699
Definition RHIResources.h:733
FRHIBoundShaderState()
Definition RHIResources.h:735
Definition RHIResources.h:5806
RHI_API void SetDebugName(FRHICommandListBase &RHICmdList, const TCHAR *DebugName)
int32 NumItems() const
Definition RHIResources.h:5820
Definition RHIResources.h:1581
void TakeOwnership(FRHIBuffer &Other)
Definition RHIResources.h:1625
EBufferUsageFlags GetUsage() const
Definition RHIResources.h:1607
FRHIBuffer()=delete
void ReleaseOwnership()
Definition RHIResources.h:1631
void SetName(FName InName)
Definition RHIResources.h:1612
uint32 GetStride() const
Definition RHIResources.h:1601
const FRHIBufferDesc & GetDesc() const
Definition RHIResources.h:1589
uint32 GetSize() const
Definition RHIResources.h:1595
Definition RHICommandList.h:455
Definition RHICommandList.h:5284
Definition RHICommandList.h:4626
Definition RHICommandList.h:3819
Definition RHICommandList.h:2735
Definition RHIResources.h:5123
FRHIComputePipelineStateFallback(FRHIComputeShader *InComputeShader)
Definition RHIResources.h:5125
Definition RHIResources.h:1078
virtual void MarkUsed()
Definition RHIResources.h:1089
bool IsUsed()
Definition RHIResources.h:1090
TRefCountPtr< FRHIComputeShader > ComputeShader
Definition RHIResources.h:1098
void SetValid(bool InIsValid)
Definition RHIResources.h:1087
FRHIComputeShader * GetComputeShader() const
Definition RHIResources.h:1092
FRHIComputePipelineState(FRHIComputeShader *InComputeShader)
Definition RHIResources.h:1080
bool IsValid() const
Definition RHIResources.h:1088
Definition RHIResources.h:1018
FRHIComputeShader()
Definition RHIResources.h:1020
void SetStats(struct FPipelineStateStats *Ptr)
Definition RHIResources.h:1025
Definition RHIResources.h:5541
Definition RHIResources.h:4294
virtual void OnBackBufferResize()=0
virtual ~FRHICustomPresent()
Definition RHIResources.h:4298
virtual void OnAcquireThreadOwnership()
Definition RHIResources.h:4328
FRHICustomPresent()
Definition RHIResources.h:4296
virtual void OnReleaseThreadOwnership()
Definition RHIResources.h:4330
virtual bool NeedsNativePresent()=0
virtual bool Present(IRHICommandContext &RHICmdContext, int32 &InOutSyncInterval)
Definition RHIResources.h:4322
virtual void PostPresent()
Definition RHIResources.h:4325
virtual bool NeedsAdvanceBackbuffer()
Definition RHIResources.h:4310
Definition RHIResources.h:4073
void Validate() const
Definition RHIResources.h:4147
bool operator==(const FRHIDepthRenderTargetView &Other) const
Definition RHIResources.h:4154
FRHIDepthRenderTargetView(FRHITexture *InTexture, ERenderTargetLoadAction InLoadAction, ERenderTargetStoreAction InStoreAction)
Definition RHIResources.h:4103
FRHIDepthRenderTargetView(FRHITexture *InTexture, ERenderTargetLoadAction InLoadAction, ERenderTargetStoreAction InStoreAction, FExclusiveDepthStencil InDepthStencilAccess)
Definition RHIResources.h:4114
ERenderTargetStoreAction DepthStoreAction
Definition RHIResources.h:4078
FRHIDepthRenderTargetView(FRHITexture *InTexture, ERenderTargetLoadAction InDepthLoadAction, ERenderTargetStoreAction InDepthStoreAction, ERenderTargetLoadAction InStencilLoadAction, ERenderTargetStoreAction InStencilStoreAction)
Definition RHIResources.h:4125
FRHITexture * Texture
Definition RHIResources.h:4075
ERenderTargetLoadAction DepthLoadAction
Definition RHIResources.h:4077
FExclusiveDepthStencil GetDepthStencilAccess() const
Definition RHIResources.h:4089
ERenderTargetLoadAction StencilLoadAction
Definition RHIResources.h:4079
FRHIDepthRenderTargetView()
Definition RHIResources.h:4091
FRHIDepthRenderTargetView(FRHITexture *InTexture, ERenderTargetLoadAction InDepthLoadAction, ERenderTargetStoreAction InDepthStoreAction, ERenderTargetLoadAction InStencilLoadAction, ERenderTargetStoreAction InStencilStoreAction, FExclusiveDepthStencil InDepthStencilAccess)
Definition RHIResources.h:4136
ERenderTargetStoreAction GetStencilStoreAction() const
Definition RHIResources.h:4087
Definition RHIResources.h:686
FRHIDepthStencilState()
Definition RHIResources.h:688
virtual bool GetInitializer(struct FDepthStencilStateInitializerRHI &Init)
Definition RHIResources.h:692
Definition RHIResources.h:2387
virtual bool Poll() const =0
FThreadSafeCounter NumPendingWriteCommands
Definition RHIResources.h:2437
const FName FenceName
Definition RHIResources.h:2440
virtual void Clear()=0
virtual void Wait(FRHICommandListImmediate &RHICmdList, FRHIGPUMask GPUMask) const =0
virtual bool Poll(FRHIGPUMask GPUMask) const
Definition RHIResources.h:2421
FName GetFName() const
Definition RHIResources.h:2435
FRHIGPUFence(FName InName)
Definition RHIResources.h:2389
Definition RHIResources.h:978
FRHIGeometryShader()
Definition RHIResources.h:980
Definition RHIResources.h:5097
FRHIGraphicsShader * GetShader(EShaderFrequency Frequency) const override
Definition RHIResources.h:5106
FRHIGraphicsPipelineStateFallBack(const FGraphicsPipelineStateInitializer &Init)
Definition RHIResources.h:5101
FRHIGraphicsPipelineStateFallBack()
Definition RHIResources.h:5099
FGraphicsPipelineStateInitializer Initializer
Definition RHIResources.h:5119
Definition RHIResources.h:1058
void SetSortKey(uint64 InSortKey)
Definition RHIResources.h:1062
uint64 GetSortKey() const
Definition RHIResources.h:1063
virtual FRHIGraphicsShader * GetShader(EShaderFrequency Frequency) const =0
FRHIGraphicsPipelineState()
Definition RHIResources.h:1060
Definition RHIResources.h:947
FRHIGraphicsShader(ERHIResourceType InResourceType, EShaderFrequency InFrequency)
Definition RHIResources.h:949
Definition RHIResources.h:960
FRHIMeshShader()
Definition RHIResources.h:962
Definition RHIResources.h:972
FRHIPixelShader()
Definition RHIResources.h:974
Definition RHIResources.h:2452
void ReleaseQuery()
Definition RHIResources.h:2498
FRHIRenderQuery * GetQuery() const
Definition RHIResources.h:2471
FRHIPooledRenderQuery()=default
bool IsValid() const
Definition RHIResources.h:2466
FRHIPooledRenderQuery(FRHIPooledRenderQuery &&)=default
FRHIPooledRenderQuery & operator=(const FRHIPooledRenderQuery &)=delete
FRHIPooledRenderQuery(const FRHIPooledRenderQuery &)=delete
~FRHIPooledRenderQuery()
Definition RHIResources.h:2508
FRHIPooledRenderQuery & operator=(FRHIPooledRenderQuery &&)=default
Definition RHIResources.h:679
FRHIRasterizerState()
Definition RHIResources.h:681
virtual bool GetInitializer(struct FRasterizerStateInitializerRHI &Init)
Definition RHIResources.h:682
Definition RHIResources.h:1006
FRHIRayCallableShader()
Definition RHIResources.h:1008
Definition RHIResources.h:994
FRHIRayGenShader()
Definition RHIResources.h:996
Definition RHIResources.h:1012
FRHIRayHitGroupShader()
Definition RHIResources.h:1014
Definition RHIResources.h:1000
FRHIRayMissShader()
Definition RHIResources.h:1002
Definition RHIResources.h:3712
FRHIRayTracingAccelerationStructure()
Definition RHIResources.h:3714
FRayTracingAccelerationStructureSize GetSizeInfo() const
Definition RHIResources.h:3716
Definition RHIResources.h:3729
FRHIRayTracingGeometry()=default
FRHIRayTracingGeometry(const FRayTracingGeometryInitializer &InInitializer)
Definition RHIResources.h:3732
uint32 GetNumSegments() const
Definition RHIResources.h:3744
const FRayTracingGeometryInitializer & GetInitializer() const
Definition RHIResources.h:3739
virtual bool IsCompressed() const
Definition RHIResources.h:3737
virtual FRayTracingAccelerationStructureAddress GetAccelerationStructureAddress(uint64 GPUIndex) const =0
Definition RHIResources.h:1115
FRHIRayTracingPipelineState(const FRayTracingPipelineStateInitializer &InInitializer)
Definition RHIResources.h:1117
Definition RHIResources.h:3755
virtual const FRayTracingSceneInitializer & GetInitializer() const =0
Definition RHIResources.h:984
FRHIRayTracingShader(EShaderFrequency InFrequency)
Definition RHIResources.h:986
Definition RHIResources.h:2480
FRHIRenderQueryPool()
Definition RHIResources.h:2482
virtual ~FRHIRenderQueryPool()
Definition RHIResources.h:2483
virtual FRHIPooledRenderQuery AllocateQuery()=0
Definition RHIResources.h:2444
FRHIRenderQuery()
Definition RHIResources.h:2446
Definition RHIResources.h:4018
FRHIRenderTargetView(FRHITexture *InTexture, ERenderTargetLoadAction InLoadAction)
Definition RHIResources.h:4036
FRHIRenderTargetView()=default
FRHIRenderTargetView & operator=(const FRHIRenderTargetView &)=default
FRHIRenderTargetView(FRHITexture *InTexture, ERenderTargetLoadAction InLoadAction, uint32 InMipIndex, uint32 InArraySliceIndex)
Definition RHIResources.h:4045
FRHIRenderTargetView(const FRHIRenderTargetView &)=default
FRHIRenderTargetView(FRHIRenderTargetView &&)=default
FRHIRenderTargetView & operator=(FRHIRenderTargetView &&)=default
FRHIRenderTargetView(FRHITexture *InTexture, uint32 InMipIndex, uint32 InArraySliceIndex, ERenderTargetLoadAction InLoadAction, ERenderTargetStoreAction InStoreAction)
Definition RHIResources.h:4053
bool operator==(const FRHIRenderTargetView &Other) const
Definition RHIResources.h:4061
Definition RHIResources.h:54
uint32 GetRefCount() const
Definition RHIResources.h:93
uint32 Release() const
Definition RHIResources.h:80
void DisableLifetimeExtension()
Definition RHIResources.h:105
FName GetOwnerName() const
Definition RHIResources.h:113
virtual RHI_API ~FRHIResource()
Definition RHIResources.cpp:33
bool IsValid() const
Definition RHIResources.h:100
void SetOwnerName(FName InOwnerName)
Definition RHIResources.h:122
ERHIResourceType GetType() const
Definition RHIResources.h:111
uint32 AddRef() const
Definition RHIResources.h:73
Definition RHIResources.h:671
FRHISamplerState()
Definition RHIResources.h:673
virtual bool IsImmutable() const
Definition RHIResources.h:674
virtual FRHIDescriptorHandle GetBindlessHandle() const
Definition RHIResources.h:675
Definition RHIResources.h:4167
FRHISetRenderTargetsInfo(int32 InNumColorRenderTargets, const FRHIRenderTargetView *InColorRenderTargets, const FRHIDepthRenderTargetView &InDepthStencilRenderTarget)
Definition RHIResources.h:4199
EVRSRateCombiner ShadingRateTextureCombiner
Definition RHIResources.h:4186
bool bClearStencil
Definition RHIResources.h:4183
void SetClearDepthStencil(bool bInClearDepth, bool bInClearStencil=false)
Definition RHIResources.h:4215
bool bHasResolveAttachments
Definition RHIResources.h:4176
int32 NumColorRenderTargets
Definition RHIResources.h:4171
FRHITexture * ShadingRateTexture
Definition RHIResources.h:4185
FRHISetRenderTargetsInfo()
Definition RHIResources.h:4190
bool bClearDepth
Definition RHIResources.h:4182
uint32 CalculateHash() const
Definition RHIResources.h:4229
uint8 MultiViewCount
Definition RHIResources.h:4188
FRHIDepthRenderTargetView DepthStencilRenderTarget
Definition RHIResources.h:4179
bool bClearColor
Definition RHIResources.h:4172
FRHIDepthRenderTargetView DepthStencilResolveRenderTarget
Definition RHIResources.h:4181
Definition RHIShaderBindingLayout.h:72
Definition RHIResources.h:3863
FRHIShaderBindingTable(const FRayTracingShaderBindingTableInitializer &InInitializer)
Definition RHIResources.h:3865
const FRayTracingShaderBindingTableInitializer & GetInitializer() const
Definition RHIResources.h:3873
virtual FRHISizeAndStride GetInlineBindingDataSizeAndStride() const
Definition RHIResources.h:3886
Definition RHIResources.h:3919
const uint32 ArgOffset
Definition RHIResources.h:3922
const TCHAR * GetModeName() const
Definition RHIResources.h:3958
const uint32 NumRecords
Definition RHIResources.h:3921
FRHIShaderBundle(const FShaderBundleCreateInfo &CreateInfo)
Definition RHIResources.h:3928
const uint32 ArgStride
Definition RHIResources.h:3923
FRHIShaderBundle()=delete
const ERHIShaderBundleMode Mode
Definition RHIResources.h:3924
Definition RHIResources.h:827
FShaderResourceTable ShaderResourceTable
Definition RHIResources.h:845
void SerializeShaderResourceTable(FArchive &Ar)
Definition RHIResources.h:839
const FShaderResourceTable & GetShaderResourceTable() const
Definition RHIResources.h:829
const TArray< FUniformBufferStaticSlot > & GetStaticSlots() const
Definition RHIResources.h:834
TArray< FUniformBufferStaticSlot > StaticSlots
Definition RHIResources.h:846
Definition RHIResources.h:3304
FRHIShaderResourceView(FRHIViewableResource *InResource, FRHIViewDesc const &InViewDesc)
Definition RHIResources.h:3306
Definition RHIResources.h:854
bool HasNoDerivativeOps() const
Definition RHIResources.h:921
TArray< FShaderCodeValidationStride > DebugStrideValidationData
Definition RHIResources.h:884
const FSHAHash & GetHash() const
Definition RHIResources.h:857
FString GetUniformBufferName(uint32 Index) const
Definition RHIResources.h:877
FString ShaderName
Definition RHIResources.h:864
bool HasShaderName() const
Definition RHIResources.h:868
void SetHash(const FSHAHash &InHash)
Definition RHIResources.h:856
bool HasShaderBundleUsage() const
Definition RHIResources.h:931
TArray< FName > UniformBufferNames
Definition RHIResources.h:865
TArray< FShaderCodeValidationType > DebugSRVTypeValidationData
Definition RHIResources.h:885
const TCHAR * GetShaderName() const
Definition RHIResources.h:870
EShaderFrequency GetFrequency() const
Definition RHIResources.h:911
FRHIShader(ERHIResourceType InResourceType, EShaderFrequency InFrequency)
Definition RHIResources.h:898
TArray< FShaderCodeValidationUBSize > DebugUBSizeValidationData
Definition RHIResources.h:887
FRHIShader()=delete
void SetNoDerivativeOps(bool bValue)
Definition RHIResources.h:916
void SetShaderBundleUsage(bool bValue)
Definition RHIResources.h:926
TArray< FShaderCodeValidationType > DebugUAVTypeValidationData
Definition RHIResources.h:886
Definition RHIResources.h:3981
virtual uint64 GetGPUSizeBytes() const
Definition RHIResources.h:3994
FRHIStagingBuffer()
Definition RHIResources.h:3983
virtual void * Lock(uint32 Offset, uint32 NumBytes)=0
virtual void Unlock()=0
bool bIsLocked
Definition RHIResources.h:3997
virtual ~FRHIStagingBuffer()
Definition RHIResources.h:3988
Definition RHIResources.h:1643
static TRefCountPtr< FRHIStreamSourceSlot > Create(FRHIBuffer *InBuffer)
Definition RHIResources.h:1647
Definition RHITextureReference.h:8
Definition RHIResources.h:5785
RHI_API void SetDebugName(FRHICommandListBase &RHICmdList, const TCHAR *DebugName)
Definition RHIResources.h:2153
float GetDepthClearValue() const
Definition RHIResources.h:2278
virtual void * GetNativeResource() const
Definition RHIResources.h:2185
FRHITexture * GetTexture2D()
Definition RHIResources.h:2317
bool HasClearValue() const
Definition RHIResources.h:2260
double GetLastRenderTime() const
Definition RHIResources.h:2305
uint32 GetSizeX() const
Definition RHIResources.h:2326
FRHITexture * GetTextureCube()
Definition RHIResources.h:2323
uint32 GetSize() const
Definition RHIResources.h:2353
EPixelFormat GetFormat() const
Definition RHIResources.h:2341
uint32 GetNumMips() const
Definition RHIResources.h:2338
const FClearValueBinding GetClearBinding() const
Definition RHIResources.h:2350
FIntVector GetSizeXYZ() const
Definition RHIResources.h:2227
bool IsMultisampled() const
Definition RHIResources.h:2257
FRHITexture * GetTexture2DArray()
Definition RHIResources.h:2319
virtual void GetWriteMaskProperties(void *&OutData, uint32 &OutSize)
Definition RHIResources.h:2213
virtual FRHIDescriptorHandle GetDefaultBindlessHandle() const
Definition RHIResources.h:2177
uint32 GetSizeZ() const
Definition RHIResources.h:2335
void GetDepthStencilClearValue(float &OutDepth, uint32 &OutStencil) const
Definition RHIResources.h:2272
virtual class FRHITextureReference * GetTextureReference()
Definition RHIResources.h:2176
uint32 GetStencilClearValue() const
Definition RHIResources.h:2287
FIntVector GetMipDimensions(uint8 MipIndex) const
Definition RHIResources.h:2246
ETextureCreateFlags GetFlags() const
Definition RHIResources.h:2344
virtual const FRHITextureDesc & GetDesc() const
Definition RHIResources.h:2170
FRHITexture * GetTexture3D()
Definition RHIResources.h:2321
uint32 GetSizeY() const
Definition RHIResources.h:2329
virtual void * GetTextureBaseRHI()
Definition RHIResources.h:2207
void SetLastRenderTime(float InLastRenderTime)
Definition RHIResources.h:2300
FLinearColor GetClearColor() const
Definition RHIResources.h:2266
virtual void * GetNativeShaderResourceView() const
Definition RHIResources.h:2197
FRHITexture()=delete
uint32 GetNumSamples() const
Definition RHIResources.h:2347
FIntPoint GetSizeXY() const
Definition RHIResources.h:2332
Definition RHIResources.h:1232
TArray< TRefCountPtr< FRHIResource > > ResourceTable
Definition RHIResources.h:1255
const TArray< TRefCountPtr< FRHIResource > > & GetResourceTable() const
Definition RHIResources.h:1252
FRHIUniformBuffer(const FRHIUniformBufferLayout *InLayout)
Definition RHIResources.h:1237
const FRHIUniformBufferLayout & GetLayout() const
Definition RHIResources.h:1249
FRHIUniformBuffer()=delete
uint32 GetSize() const
Definition RHIResources.h:1244
const FRHIUniformBufferLayout * GetLayoutPtr() const
Definition RHIResources.h:1250
Definition RHIResources.h:3294
FRHIUnorderedAccessView(FRHIViewableResource *InResource, FRHIViewDesc const &InViewDesc)
Definition RHIResources.h:3296
Definition RHIResources.h:725
virtual bool GetInitializer(FVertexDeclarationElementList &Init)
Definition RHIResources.h:728
FRHIVertexDeclaration()
Definition RHIResources.h:727
virtual uint32 GetPrecachePSOHash() const
Definition RHIResources.h:729
Definition RHIResources.h:954
FRHIVertexShader()
Definition RHIResources.h:956
Definition RHIResources.h:3239
FRHITexture * GetTexture() const
Definition RHIResources.h:3265
FRHIViewDesc const ViewDesc
Definition RHIResources.h:3290
FRHIViewableResource * GetResource() const
Definition RHIResources.h:3254
bool IsBuffer() const
Definition RHIResources.h:3271
virtual FRHIDescriptorHandle GetBindlessHandle() const
Definition RHIResources.h:3249
FRHIViewDesc const & GetDesc() const
Definition RHIResources.h:3281
bool IsTexture() const
Definition RHIResources.h:3272
FRHIBuffer * GetBuffer() const
Definition RHIResources.h:3259
FRHIView(ERHIResourceType InResourceType, FRHIViewableResource *InResource, FRHIViewDesc const &InViewDesc)
Definition RHIResources.h:3241
Definition RHIResources.h:1265
ERHIAccess GetTrackedAccess_Unsafe() const
Definition RHIResources.h:1267
void ReleaseOwnership()
Definition RHIResources.h:1305
FName GetName() const
Definition RHIResources.h:1272
FRHIViewableResource(ERHIResourceType InResourceType, ERHIAccess InAccess, const TCHAR *InName, FName InOwnerName)
Definition RHIResources.h:1282
virtual void SetTrackedAccessFromContext(FRHITrackedAccess InTrackedAccess)
Definition RHIResources.h:1295
void TakeOwnership(FRHIViewableResource &Other)
Definition RHIResources.h:1300
FName Name
Definition RHIResources.h:1310
Definition RHIResources.h:2515
virtual void * GetNativeWindow(void **AddParam=nullptr) const
Definition RHIResources.h:2548
virtual FRHITexture * GetOptionalSDRBackBuffer(FRHITexture *BackBuffer) const
Definition RHIResources.h:2560
virtual void IssueFrameEvent()
Definition RHIResources.h:2569
virtual void WaitForFrameEventCompletion()
Definition RHIResources.h:2567
virtual void * GetNativeBackBufferTexture() const
Definition RHIResources.h:2532
FRHIViewport()
Definition RHIResources.h:2517
virtual void * GetNativeSwapChain() const
Definition RHIResources.h:2525
virtual void SetCustomPresent(class FRHICustomPresent *)
Definition RHIResources.h:2553
virtual class FRHICustomPresent * GetCustomPresent() const
Definition RHIResources.h:2558
virtual void * GetNativeBackBufferRT() const
Definition RHIResources.h:2539
virtual void Tick(float DeltaTime)
Definition RHIResources.h:2565
Definition RHIResources.h:1048
FRHIWorkGraphComputeNodeShader()
Definition RHIResources.h:1050
Definition RHIResources.h:1106
FRHIWorkGraphPipelineState()
Definition RHIResources.h:1108
Definition RHIResources.h:1042
FRHIWorkGraphRootShader()
Definition RHIResources.h:1044
Definition RHIResources.h:1033
FRHIWorkGraphShader(EShaderFrequency InFrequency)
Definition RHIResources.h:1035
Definition RHIResources.h:5023
void SetHitGroupTable(const TArrayView< FRHIRayTracingShader * > &InHitGroups, uint64 Hash=0)
Definition RHIResources.h:5071
void SetMissShaderTable(const TArrayView< FRHIRayTracingShader * > &InMissShaders, uint64 Hash=0)
Definition RHIResources.h:5063
const TArrayView< FRHIRayTracingShader * > & GetMissTable() const
Definition RHIResources.h:5049
const TArrayView< FRHIRayTracingShader * > & GetHitGroupTable() const
Definition RHIResources.h:5050
FRayTracingPipelineStateRHIRef BasePipeline
Definition RHIResources.h:5042
const TArrayView< FRHIRayTracingShader * > & GetRayGenTable() const
Definition RHIResources.h:5048
const TArrayView< FRHIRayTracingShader * > & GetCallableTable() const
Definition RHIResources.h:5051
void SetRayGenShaderTable(const TArrayView< FRHIRayTracingShader * > &InRayGenShaders, uint64 Hash=0)
Definition RHIResources.h:5054
void SetCallableTable(const TArrayView< FRHIRayTracingShader * > &InCallableShaders, uint64 Hash=0)
Definition RHIResources.h:5079
Definition RHIResources.h:4982
uint64 GetRayGenHash() const
Definition RHIResources.h:5010
bool operator==(const FRayTracingPipelineStateSignature &rhs) const
Definition RHIResources.h:4989
friend uint32 GetTypeHash(const FRayTracingPipelineStateSignature &Initializer)
Definition RHIResources.h:4999
uint64 GetRayMissHash() const
Definition RHIResources.h:5011
uint64 GetCallableHash() const
Definition RHIResources.h:5012
uint64 GetHitGroupHash() const
Definition RHIResources.h:5009
Definition PipelineStateCache.cpp:1285
Definition ResourceArray.h:77
Definition ResourceArray.h:102
Definition SecureHash.h:226
Definition ThreadSafeCounter.h:14
Definition SceneRendering.h:1132
Definition RHIResources.h:4915
TArrayView< FRHIWorkGraphShader * > const & GetShaderTable() const
Definition RHIResources.h:4968
void SetNameTable(const TArrayView< FNameMap > InNameMaps, uint64 Hash=0)
Definition RHIResources.h:4944
void SetGraphicsPSOTable(const TArrayView< FGraphicsPipelineStateInitializer const * > &InGraphicsPSOs, uint64 Hash=0)
Definition RHIResources.h:4959
void SetProgramName(TCHAR const *InProgramName)
Definition RHIResources.h:4919
void SetShaderTable(const TArrayView< FRHIWorkGraphShader * > &InShaders, int32 InRootShaderIndex=-1, uint64 Hash=0)
Definition RHIResources.h:4950
FString const & GetProgramName() const
Definition RHIResources.h:4965
int32 GetRootShaderIndex() const
Definition RHIResources.h:4967
TArray< FNameMap > const & GetNameTable() const
Definition RHIResources.h:4966
TArrayView< FGraphicsPipelineStateInitializer const * > const & GetGraphicsPSOTable() const
Definition RHIResources.h:4969
Definition RHIResources.h:4882
bool operator==(const FWorkGraphPipelineStateSignature &Rhs) const
Definition RHIResources.h:4886
uint64 GetNameTableHash() const
Definition RHIResources.h:4903
uint64 GetGraphicsPSOTableHash() const
Definition RHIResources.h:4905
friend uint32 GetTypeHash(const FWorkGraphPipelineStateSignature &Initializer)
Definition RHIResources.h:4894
uint64 GetNameHash() const
Definition RHIResources.h:4902
uint64 GetShaderTableHash() const
Definition RHIResources.h:4904
Definition RHIContext.h:693
Definition RHIContext.h:257
Definition RHIContext.h:573
Definition RHICore.Build.cs:7
Definition ArrayView.h:139
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
Definition AndroidPlatformMisc.h:14
Definition RHIPipeline.h:55
Definition RefCounting.h:454
UE_FORCEINLINE_HINT ReferencedType * GetReference() const
Definition RefCounting.h:584
UE_FORCEINLINE_HINT bool IsValid() const
Definition RefCounting.h:594
Definition ContainerAllocationPolicies.h:894
Definition StaticArray.h:26
uint8 ElementType
Definition StaticArray.h:31
uint32 GetTypeHash(const FKey &Key)
Definition BlackboardKey.h:35
void InitStaticUniformBufferSlots(FRHIShaderData *ShaderData)
Definition RHICoreShader.h:44
Definition AdvancedWidgetsModule.cpp:13
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
Definition RHIResources.h:4362
void AddRefResources()
Definition RHIResources.h:4395
constexpr FRHIGeometryShader * GetGeometryShader() const
Definition RHIResources.h:4496
void SetAmplificationShader(FRHIAmplificationShader *)
Definition RHIResources.h:4489
constexpr FRHIMeshShader * GetMeshShader() const
Definition RHIResources.h:4486
FRHIPixelShader * GetPixelShader() const
Definition RHIResources.h:4478
FRHIVertexShader * GetVertexShader() const
Definition RHIResources.h:4477
FBoundShaderStateInput(FRHIVertexDeclaration *InVertexDeclarationRHI, FRHIVertexShader *InVertexShaderRHI, FRHIPixelShader *InPixelShaderRHI)
Definition RHIResources.h:4366
constexpr FRHIAmplificationShader * GetAmplificationShader() const
Definition RHIResources.h:4488
void SetWorkGraphShader(FRHIWorkGraphShader *InWorkGraphMeshShader)
Definition RHIResources.h:4505
void SetGeometryShader(FRHIGeometryShader *)
Definition RHIResources.h:4497
FBoundShaderStateInput()
Definition RHIResources.h:4363
void SetMeshShader(FRHIMeshShader *)
Definition RHIResources.h:4487
void ReleaseResources()
Definition RHIResources.h:4436
FRHIWorkGraphShader * GetWorkGraphShader() const
Definition RHIResources.h:4504
Definition RHIResources.h:248
uint32 Stencil
Definition RHIResources.h:250
float Depth
Definition RHIResources.h:249
Definition RHIResources.h:246
static RHI_API const FClearValueBinding None
Definition RHIResources.h:358
static RHI_API const FClearValueBinding Black
Definition RHIResources.h:359
void GetDepthStencil(float &OutDepth, uint32 &OutStencil) const
Definition RHIResources.h:298
static RHI_API const FClearValueBinding Transparent
Definition RHIResources.h:362
bool operator==(const FClearValueBinding &Other) const
Definition RHIResources.h:305
static RHI_API const FClearValueBinding DepthZero
Definition RHIResources.h:364
static RHI_API const FClearValueBinding BlackMaxAlpha
Definition RHIResources.h:360
FClearValueBinding()
Definition RHIResources.h:253
EClearBinding ColorBinding
Definition RHIResources.h:349
FLinearColor GetClearColor() const
Definition RHIResources.h:292
union FClearValueBinding::ClearValueType Value
static RHI_API const FClearValueBinding DepthOne
Definition RHIResources.h:363
static RHI_API const FClearValueBinding White
Definition RHIResources.h:361
static RHI_API const FClearValueBinding DepthFar
Definition RHIResources.h:366
FClearValueBinding(EClearBinding NoBinding)
Definition RHIResources.h:262
static RHI_API const FClearValueBinding DefaultNormal8Bit
Definition RHIResources.h:368
friend uint32 GetTypeHash(FClearValueBinding const &Binding)
Definition RHIResources.h:329
static RHI_API const FClearValueBinding Green
Definition RHIResources.h:367
static RHI_API const FClearValueBinding DepthNear
Definition RHIResources.h:365
FClearValueBinding(float DepthClearValue, uint32 StencilClearValue=0)
Definition RHIResources.h:285
FClearValueBinding(const FLinearColor &InClearColor)
Definition RHIResources.h:276
static UE_FORCEINLINE_HINT uint32 MemCrc32(const void *Data, int32 Length, uint32 CRC=0)
Definition Crc.h:31
Definition RHIResources.h:4547
TStaticArray< ETextureCreateFlags, MaxSimultaneousRenderTargets > RenderTargetFlags
Definition RHIResources.h:4557
FExclusiveDepthStencil DepthStencilAccess
Definition RHIResources.h:4564
FGraphicsPipelineRenderTargetsInfo()
Definition RHIResources.h:4548
uint16 NumSamples
Definition RHIResources.h:4565
TStaticArray< uint8, MaxSimultaneousRenderTargets > RenderTargetFormats
Definition RHIResources.h:4556
Definition RHIImmutableSamplerState.h:17
Definition Color.h:48
static constexpr UE_FORCEINLINE_HINT T Clamp(const T X, const T MinValue, const T MaxValue)
Definition UnrealMathUtility.h:592
static UE_FORCEINLINE_HINT void * Memzero(void *Dest, SIZE_T Count)
Definition UnrealMemory.h:131
static UE_FORCEINLINE_HINT int32 Memcmp(const void *Buf1, const void *Buf2, SIZE_T Count)
Definition UnrealMemory.h:114
static UE_FORCEINLINE_HINT void * Memcpy(void *Dest, const void *Src, SIZE_T Count)
Definition UnrealMemory.h:160
Definition PipelineFileCache.h:80
int32 BlockBytes
Definition PixelFormat.h:470
Definition RHIResources.h:1417
static FRHIBufferCreateDesc Create(const TCHAR *InDebugName, EBufferUsageFlags InUsage)
Definition RHIResources.h:1418
FRHIBufferCreateDesc & SetGPUMask(FRHIGPUMask InGPUMask)
Definition RHIResources.h:1525
FRHIBufferCreateDesc & SetInitAction(ERHIBufferInitAction InInitAction)
Definition RHIResources.h:1530
static FRHIBufferCreateDesc CreateUniform(const TCHAR *InDebugName)
Definition RHIResources.h:1496
FRHIBufferCreateDesc & SetStride(uint32 InStride)
Definition RHIResources.h:1522
static FRHIBufferCreateDesc CreateIndex(const TCHAR *InDebugName, uint32 InCount)
Definition RHIResources.h:1465
static FRHIBufferCreateDesc CreateStructured(const TCHAR *InDebugName)
Definition RHIResources.h:1470
FRHIBufferCreateDesc & SetInitActionInitializer()
Definition RHIResources.h:1542
static FRHIBufferCreateDesc CreateIndex(const TCHAR *InDebugName)
Definition RHIResources.h:1454
FRHIBufferCreateDesc & SetInitActionResourceArray(FResourceArrayUploadInterface *InInitialData)
Definition RHIResources.h:1546
static FRHIBufferCreateDesc CreateStructured(const TCHAR *InDebugName, uint32 InSize, uint32 InStride)
Definition RHIResources.h:1475
FRHIBufferCreateDesc(const TCHAR *InDebugName, EBufferUsageFlags InUsage)
Definition RHIResources.h:1503
FRHIBufferCreateDesc & SetInitActionZeroData()
Definition RHIResources.h:1538
FRHIBufferCreateDesc & SetInitialState(ERHIAccess InInitialState)
Definition RHIResources.h:1528
FName GetTraceClassName() const
Definition RHIResources.h:1552
FRHIBufferCreateDesc & SetDebugName(const TCHAR *InDebugName)
Definition RHIResources.h:1527
static FRHIBufferCreateDesc CreateIndex(const TCHAR *InDebugName, uint32 InSize, uint32 InStride)
Definition RHIResources.h:1459
FRHIBufferCreateDesc(const TCHAR *InDebugName, uint32 InSize, uint32 InStride, EBufferUsageFlags InUsage)
Definition RHIResources.h:1509
FRHIBufferCreateDesc & SetInitActionNone()
Definition RHIResources.h:1534
static FRHIBufferCreateDesc CreateStructured(const TCHAR *InDebugName, uint32 InCount)
Definition RHIResources.h:1481
static FRHIBufferCreateDesc CreateByteAddress(const TCHAR *InDebugName)
Definition RHIResources.h:1486
static FRHIBufferCreateDesc Create(const TCHAR *InDebugName, uint32 InSize, uint32 InStride, EBufferUsageFlags InUsage)
Definition RHIResources.h:1423
static FRHIBufferCreateDesc CreateByteAddress(const TCHAR *InDebugName, uint32 InSize, uint32 InStride)
Definition RHIResources.h:1491
FRHIBufferCreateDesc()=default
static FRHIBufferCreateDesc Create(const TCHAR *InDebugName, const FRHIBufferDesc &InDesc)
Definition RHIResources.h:1428
static FRHIBufferCreateDesc CreateVertex(const TCHAR *InDebugName)
Definition RHIResources.h:1438
static FRHIBufferCreateDesc CreateNull(const TCHAR *InDebugName)
Definition RHIResources.h:1433
static FRHIBufferCreateDesc CreateVertex(const TCHAR *InDebugName, uint32 InSize)
Definition RHIResources.h:1443
FRHIBufferCreateDesc & SetSize(uint32 InSize)
Definition RHIResources.h:1521
FRHIBufferCreateDesc & SetOwnerName(FName InOwnerName)
Definition RHIResources.h:1532
FRHIBufferCreateDesc & SetUsage(EBufferUsageFlags InUsage)
Definition RHIResources.h:1523
FRHIBufferCreateDesc & DetermineInitialState()
Definition RHIResources.h:1529
FRHIBufferCreateDesc & AddUsage(EBufferUsageFlags InUsage)
Definition RHIResources.h:1524
FRHIBufferCreateDesc(const TCHAR *InDebugName, const FRHIBufferDesc &InOtherDesc)
Definition RHIResources.h:1515
static FRHIBufferCreateDesc CreateVertex(const TCHAR *InDebugName, uint32 InCount)
Definition RHIResources.h:1449
FRHIBufferCreateDesc & SetClassName(FName InClassName)
Definition RHIResources.h:1531
Definition RHIResources.h:1321
friend uint32 GetTypeHash(const FRHIBufferDesc &Desc)
Definition RHIResources.h:1366
static FRHIBufferDesc Null()
Definition RHIResources.h:1349
FRHIBufferDesc()=default
uint32 Size
Definition RHIResources.h:1323
FRHIGPUMask GPUMask
Definition RHIResources.h:1332
FRHIBufferDesc(uint32 InSize, uint32 InStride, EBufferUsageFlags InUsage, FRHIGPUMask InGPUMask)
Definition RHIResources.h:1341
EBufferUsageFlags Usage
Definition RHIResources.h:1329
FRHIBufferDesc & operator=(const FRHIBufferDesc &Other)
Definition RHIResources.h:1388
uint32 Stride
Definition RHIResources.h:1326
FRHIBufferDesc(uint32 InSize, uint32 InStride, EBufferUsageFlags InUsage)
Definition RHIResources.h:1335
bool IsNull() const
Definition RHIResources.h:1354
bool operator==(const FRHIBufferDesc &Other) const
Definition RHIResources.h:1375
bool operator!=(const FRHIBufferDesc &Other) const
Definition RHIResources.h:1383
Definition RHIResources.h:5700
FRHIBufferSRVCreateInfo(FRHIRayTracingScene *InRayTracingScene, uint32 InStartOffsetBytes)
Definition RHIResources.h:5712
EPixelFormat Format
Definition RHIResources.h:5741
friend uint32 GetTypeHash(const FRHIBufferSRVCreateInfo &Desc)
Definition RHIResources.h:5730
bool operator==(const FRHIBufferSRVCreateInfo &Other) const
Definition RHIResources.h:5717
FRHIBufferSRVCreateInfo(uint32 InStartOffsetBytes, uint32 InNumElements)
Definition RHIResources.h:5707
FRHIBufferSRVCreateInfo()=default
FRHIBufferSRVCreateInfo(EPixelFormat InFormat)
Definition RHIResources.h:5703
uint32 NumElements
Definition RHIResources.h:5747
uint32 StartOffsetBytes
Definition RHIResources.h:5744
bool operator!=(const FRHIBufferSRVCreateInfo &Other) const
Definition RHIResources.h:5725
FRHIRayTracingScene * RayTracingScene
Definition RHIResources.h:5750
Definition RHIResources.h:5754
friend uint32 GetTypeHash(const FRHIBufferUAVCreateInfo &Info)
Definition RHIResources.h:5771
FRHIBufferUAVCreateInfo()=default
bool operator!=(const FRHIBufferUAVCreateInfo &Other) const
Definition RHIResources.h:5766
FRHIBufferUAVCreateInfo(EPixelFormat InFormat)
Definition RHIResources.h:5757
bool operator==(const FRHIBufferUAVCreateInfo &Other) const
Definition RHIResources.h:5761
Definition RHIDefinitions.h:1401
Definition MultiGPU.h:33
SGPU_CONSTEXPR uint32 GetNative() const
Definition MultiGPU.h:160
static SGPU_CONSTEXPR FRHIGPUMask All()
Definition MultiGPU.h:191
static GPUMASK_CONSTEXPR FRHIGPUMask GPU0()
Definition MultiGPU.h:186
Definition RHIResources.h:5548
FRHIParallelRenderPassInfo(FRHIRenderPassInfo &&Info, const TCHAR *InPassName)
Definition RHIResources.h:5556
const TCHAR * PassName
Definition RHIResources.h:5551
Definition RHIResources.h:5250
FRHITexture * RenderTarget
Definition RHIResources.h:5251
Definition RHIResources.h:5260
FRHITexture * ResolveTarget
Definition RHIResources.h:5262
EDepthStencilTargetActions Action
Definition RHIResources.h:5263
FRHITexture * DepthStencilTarget
Definition RHIResources.h:5261
FExclusiveDepthStencil ExclusiveDepthStencil
Definition RHIResources.h:5264
Definition RHIResources.h:5248
FGraphicsPipelineRenderTargetsInfo ExtractRenderTargetsInfo() const
Definition RHIResources.h:5481
FRHIRenderPassInfo(FRHITexture *ColorRT, ERenderTargetActions ColorAction, FRHITexture *ResolveColorRT, FRHITexture *DepthRT, EDepthStencilTargetActions DepthActions, FRHITexture *ResolveDepthRT, FExclusiveDepthStencil InEDS=FExclusiveDepthStencil::DepthWrite_StencilWrite)
Definition RHIResources.h:5423
FRHIRenderPassInfo(int32 NumColorRTs, FRHITexture *ColorRTs[], ERenderTargetActions ColorAction, FRHITexture *ResolveRTs[], FRHITexture *DepthRT, EDepthStencilTargetActions DepthActions, FRHITexture *ResolveDepthRT, FExclusiveDepthStencil InEDS=FExclusiveDepthStencil::DepthWrite_StencilWrite)
Definition RHIResources.h:5361
FRHIRenderPassInfo()=default
FRHIRenderPassInfo(FRHITexture *ColorRT, ERenderTargetActions ColorAction, FRHITexture *ResolveRT=nullptr, uint8 InMipIndex=0, int32 InArraySlice=-1)
Definition RHIResources.h:5293
FRHIRenderPassInfo(FRHITexture *DepthRT, uint32 InNumOcclusionQueries, EDepthStencilTargetActions DepthActions, FRHITexture *ResolveDepthRT=nullptr, FExclusiveDepthStencil InEDS=FExclusiveDepthStencil::DepthWrite_StencilWrite)
Definition RHIResources.h:5394
int32 GetNumColorRenderTargets() const
Definition RHIResources.h:5466
FRHIRenderPassInfo & operator=(const FRHIRenderPassInfo &)=default
FRHIRenderPassInfo(FRHITexture *DepthRT, EDepthStencilTargetActions DepthActions, FRHITexture *ResolveDepthRT=nullptr, FExclusiveDepthStencil InEDS=FExclusiveDepthStencil::DepthWrite_StencilWrite)
Definition RHIResources.h:5383
FRHIRenderPassInfo(int32 NumColorRTs, FRHITexture *ColorRTs[], ERenderTargetActions ColorAction)
Definition RHIResources.h:5305
FRHIRenderPassInfo(FRHITexture *ColorRT, ERenderTargetActions ColorAction, FRHITexture *DepthRT, EDepthStencilTargetActions DepthActions, FExclusiveDepthStencil InEDS=FExclusiveDepthStencil::DepthWrite_StencilWrite)
Definition RHIResources.h:5406
FRHIRenderPassInfo(int32 NumColorRTs, FRHITexture *ColorRTs[], ERenderTargetActions ColorAction, FRHITexture *DepthRT, EDepthStencilTargetActions DepthActions, FExclusiveDepthStencil InEDS=FExclusiveDepthStencil::DepthWrite_StencilWrite)
Definition RHIResources.h:5341
TStaticArray< FColorEntry, MaxSimultaneousRenderTargets > ColorRenderTargets
Definition RHIResources.h:5257
FRHIRenderPassInfo(const FRHIRenderPassInfo &)=default
FDepthStencilEntry DepthStencilRenderTarget
Definition RHIResources.h:5266
FResolveRect ResolveRect
Definition RHIResources.h:5269
FRHIRenderPassInfo(int32 NumColorRTs, FRHITexture *ColorRTs[], ERenderTargetActions ColorAction, FRHITexture *ResolveTargets[])
Definition RHIResources.h:5322
FRHIRenderPassInfo(FRHITexture *ColorRT, ERenderTargetActions ColorAction, FRHITexture *ResolveColorRT, FRHITexture *DepthRT, EDepthStencilTargetActions DepthActions, FRHITexture *ResolveDepthRT, FRHITexture *InShadingRateTexture, EVRSRateCombiner InShadingRateTextureCombiner, FExclusiveDepthStencil InEDS=FExclusiveDepthStencil::DepthWrite_StencilWrite)
Definition RHIResources.h:5443
Definition RHI.h:543
Definition RHIResources.h:47
uint64 Size
Definition RHIResources.h:48
uint32 Stride
Definition RHIResources.h:49
static const uint16 kStencilPlaneSlice
Definition RHITransition.h:23
static const uint16 kAllSubresources
Definition RHITransition.h:24
static const uint16 kDepthPlaneSlice
Definition RHITransition.h:22
Definition RHIResources.h:1938
static FRHITextureCreateDesc Create2D(const TCHAR *DebugName, FIntPoint Size, EPixelFormat Format)
Definition RHIResources.h:1969
static FRHITextureCreateDesc Create2DArray(const TCHAR *DebugName, FIntPoint Size, uint16 ArraySize, EPixelFormat Format)
Definition RHIResources.h:1983
FRHITextureCreateDesc & SetDepth(uint16 InDepth)
Definition RHIResources.h:2070
FRHITextureCreateDesc & DetermineInititialState()
Definition RHIResources.h:2091
void CheckValidity() const
Definition RHIResources.h:2056
FRHITextureCreateDesc & SetGPUMask(FRHIGPUMask InGPUMask)
Definition RHIResources.h:2080
FRHITextureCreateDesc & SetExtent(int32 InExtentX, int32 InExtentY)
Definition RHIResources.h:2068
static FRHITextureCreateDesc Create(const TCHAR *InDebugName, ETextureDimension InDimension)
Definition RHIResources.h:1939
FRHITextureCreateDesc & SetFlags(ETextureCreateFlags InFlags)
Definition RHIResources.h:2063
FRHITextureCreateDesc(const TCHAR *InDebugName, ETextureDimension InDimension)
Definition RHIResources.h:2033
FRHITextureCreateDesc & SetInitActionNone()
Definition RHIResources.h:2100
static FRHITextureCreateDesc Create2DArray(const TCHAR *DebugName, int32 SizeX, int32 SizeY, int32 ArraySize, EPixelFormat Format)
Definition RHIResources.h:1991
FName GetTraceClassName() const
Definition RHIResources.h:2124
FRHITextureCreateDesc & SetUAVFormat(EPixelFormat InUAVFormat)
Definition RHIResources.h:2076
FRHITextureCreateDesc & SetInitActionBulkData(FResourceBulkDataInterface *InBulkData)
Definition RHIResources.h:2108
FRHITextureCreateDesc & SetInitActionInitializer()
Definition RHIResources.h:2104
FRHITextureCreateDesc & SetExtData(uint32 InExtData)
Definition RHIResources.h:2066
FRHITextureCreateDesc & AddAliasbleFormat(EPixelFormat InFormat)
Definition RHIResources.h:2083
FRHITextureCreateDesc & AddFlags(ETextureCreateFlags InFlags)
Definition RHIResources.h:2064
FRHITextureCreateDesc(FRHITextureDesc const &InDesc, ERHIAccess InInitialState, TCHAR const *InDebugName, FResourceBulkDataInterface *InBulkData=nullptr)
Definition RHIResources.h:2040
FRHITextureCreateDesc & SetExtent(const FIntPoint &InExtent)
Definition RHIResources.h:2067
static FRHITextureCreateDesc CreateCubeArray(const TCHAR *DebugName, uint32 Size, uint16 ArraySize, EPixelFormat Format)
Definition RHIResources.h:2022
static FRHITextureCreateDesc Create3D(const TCHAR *DebugName, int32 SizeX, int32 SizeY, int32 SizeZ, EPixelFormat Format)
Definition RHIResources.h:2007
FRHITextureCreateDesc & SetFormat(EPixelFormat InFormat)
Definition RHIResources.h:2075
FRHITextureCreateDesc & SetArraySize(uint16 InArraySize)
Definition RHIResources.h:2071
static FRHITextureCreateDesc Create3D(const TCHAR *DebugName, FIntVector Size, EPixelFormat Format)
Definition RHIResources.h:1999
FRHITextureCreateDesc & SetExtent(uint32 InExtent)
Definition RHIResources.h:2069
FRHITextureCreateDesc()=default
FRHITextureCreateDesc & SetClassName(FName InClassName)
Definition RHIResources.h:2081
FRHITextureCreateDesc & SetDimension(ETextureDimension InDimension)
Definition RHIResources.h:2074
FRHITextureCreateDesc & SetNumSamples(uint8 InNumSamples)
Definition RHIResources.h:2073
FRHITextureCreateDesc & SetInitialState(ERHIAccess InInitialState)
Definition RHIResources.h:2078
FRHITextureCreateDesc & SetClearValue(FClearValueBinding InClearValue)
Definition RHIResources.h:2065
static FRHITextureCreateDesc Create2D(const TCHAR *InDebugName)
Definition RHIResources.h:1944
FRHITextureCreateDesc & SetDebugName(const TCHAR *InDebugName)
Definition RHIResources.h:2077
static FRHITextureCreateDesc Create3D(const TCHAR *InDebugName)
Definition RHIResources.h:1954
static FRHITextureCreateDesc Create2DArray(const TCHAR *InDebugName)
Definition RHIResources.h:1949
FRHITextureCreateDesc & SetOwnerName(FName InOwnerName)
Definition RHIResources.h:2082
FRHITextureCreateDesc & SetFastVRAMPercentage(float InFastVRAMPercentage)
Definition RHIResources.h:2085
static FRHITextureCreateDesc CreateCube(const TCHAR *DebugName, uint32 Size, EPixelFormat Format)
Definition RHIResources.h:2015
static FRHITextureCreateDesc CreateCubeArray(const TCHAR *InDebugName)
Definition RHIResources.h:1964
FRHITextureCreateDesc & SetInitAction(ERHITextureInitAction InInitAction)
Definition RHIResources.h:2079
static FRHITextureCreateDesc CreateCube(const TCHAR *InDebugName)
Definition RHIResources.h:1959
FRHITextureCreateDesc & SetNumMips(uint8 InNumMips)
Definition RHIResources.h:2072
static FRHITextureCreateDesc Create2D(const TCHAR *DebugName, int32 SizeX, int32 SizeY, EPixelFormat Format)
Definition RHIResources.h:1976
Definition RHIResources.h:1689
ETextureDimension Dimension
Definition RHIResources.h:1871
uint16 Depth
Definition RHIResources.h:1859
uint8 FastVRAMPercentage
Definition RHIResources.h:1880
EPixelFormat UAVFormat
Definition RHIResources.h:1877
EPixelFormat Format
Definition RHIResources.h:1874
bool IsTextureCube() const
Definition RHIResources.h:1800
static bool CheckValidity(const FRHITextureDesc &Desc, const TCHAR *Name)
Definition RHIResources.h:1886
FRHIGPUMask GPUMask
Definition RHIResources.h:1850
FIntVector GetSize() const
Definition RHIResources.h:1820
ETextureCreateFlags Flags
Definition RHIResources.h:1844
bool IsValid() const
Definition RHIResources.h:1838
void Reset()
Definition RHIResources.h:1825
uint32 ExtData
Definition RHIResources.h:1853
uint16 ArraySize
Definition RHIResources.h:1862
uint64 CalcMemorySizeEstimate(uint32 FirstMipIndex=0) const
Definition RHIResources.h:1903
TArray< EPixelFormat, TInlineAllocator< 1 > > AliasableFormats
Definition RHIResources.h:1883
bool IsMultisample() const
Definition RHIResources.h:1815
bool IsTextureArray() const
Definition RHIResources.h:1805
FRHITextureDesc()=default
bool IsTexture3D() const
Definition RHIResources.h:1795
bool IsTexture2D() const
Definition RHIResources.h:1790
uint8 NumMips
Definition RHIResources.h:1865
uint16 GetSubresourceCount() const
Definition RHIResources.h:1908
friend uint32 GetTypeHash(const FRHITextureDesc &Desc)
Definition RHIResources.h:1725
FClearValueBinding ClearValue
Definition RHIResources.h:1847
bool IsMipChain() const
Definition RHIResources.h:1810
FRHITextureDesc(ETextureDimension InDimension, ETextureCreateFlags InFlags, EPixelFormat InFormat, FClearValueBinding InClearValue, FIntPoint InExtent, uint16 InDepth, uint16 InArraySize, uint8 InNumMips, uint8 InNumSamples, uint32 InExtData)
Definition RHIResources.h:1701
FRHITextureDesc(ETextureDimension InDimension)
Definition RHIResources.h:1697
uint8 NumSamples
Definition RHIResources.h:1868
FRHITextureDesc & operator=(const FRHITextureDesc &Other)
Definition RHIResources.h:1770
FIntPoint Extent
Definition RHIResources.h:1856
FRHITextureDesc(const FRHITextureDesc &Other)
Definition RHIResources.h:1692
Definition RHIResources.h:5570
static bool CheckValidity(const FRHITextureDesc &TextureDesc, const FRHITextureSRVCreateInfo &TextureSRVDesc, const TCHAR *TextureName)
Definition RHIResources.h:5641
bool operator!=(const FRHITextureSRVCreateInfo &Other) const
Definition RHIResources.h:5626
FRHITextureSRVCreateInfo(uint8 InMipLevel=0u, uint8 InNumMipLevels=1u, EPixelFormat InFormat=PF_Unknown)
Definition RHIResources.h:5571
bool operator==(const FRHITextureSRVCreateInfo &Other) const
Definition RHIResources.h:5613
friend uint32 GetTypeHash(const FRHITextureSRVCreateInfo &Info)
Definition RHIResources.h:5631
ERHITextureSRVOverrideSRGBType SRGBOverride
Definition RHIResources.h:5599
TOptional< ETextureDimension > DimensionOverride
Definition RHIResources.h:5611
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
FRHITextureSRVCreateInfo(uint8 InMipLevel, uint8 InNumMipLevels, uint16 InFirstArraySlice, uint16 InNumArraySlices, EPixelFormat InFormat=PF_Unknown)
Definition RHIResources.h:5580
static RHI_API bool Validate(const FRHITextureDesc &TextureDesc, const FRHITextureSRVCreateInfo &TextureSRVDesc, const TCHAR *TextureName, bool bFatal)
Definition RHI.cpp:1755
Definition RHIResources.h:5651
FRHITextureUAVCreateInfo(uint8 InMipLevel, EPixelFormat InFormat=PF_Unknown, uint16 InFirstArraySlice=0, uint16 InNumArraySlices=0)
Definition RHIResources.h:5655
FRHITextureUAVCreateInfo()=default
bool operator==(const FRHITextureUAVCreateInfo &Other) const
Definition RHIResources.h:5666
FRHITextureUAVCreateInfo(ERHITextureMetaDataAccess InMetaData)
Definition RHIResources.h:5662
bool operator!=(const FRHITextureUAVCreateInfo &Other) const
Definition RHIResources.h:5673
TOptional< ETextureDimension > DimensionOverride
Definition RHIResources.h:5693
friend uint32 GetTypeHash(const FRHITextureUAVCreateInfo &Info)
Definition RHIResources.h:5678
Definition RHITransition.h:433
Definition RHIUniformBufferLayoutInitializer.h:41
Definition RHIResources.h:1150
const FString Name
Definition RHIResources.h:1181
const FUniformBufferStaticSlot StaticSlot
Definition RHIResources.h:1210
friend bool operator==(const FRHIUniformBufferLayout &A, const FRHIUniformBufferLayout &B)
Definition RHIResources.h:1219
bool HasRenderTargets() const
Definition RHIResources.h:1166
const uint32 ConstantBufferSize
Definition RHIResources.h:1204
const FString & GetDebugName() const
Definition RHIResources.h:1155
const TArray< FRHIUniformBufferResource > GraphTextures
Definition RHIResources.h:1190
const TArray< FRHIUniformBufferResource > Resources
Definition RHIResources.h:1184
bool HasExternalOutputs() const
Definition RHIResources.h:1171
const ERHIUniformBufferFlags Flags
Definition RHIResources.h:1216
uint32 GetHash() const
Definition RHIResources.h:1160
const TArray< FRHIUniformBufferResource > UniformBuffers
Definition RHIResources.h:1199
const TArray< FRHIUniformBufferResource > GraphUniformBuffers
Definition RHIResources.h:1196
const TArray< FRHIUniformBufferResource > GraphResources
Definition RHIResources.h:1187
const uint32 Hash
Definition RHIResources.h:1201
const EUniformBufferBindingFlags BindingFlags
Definition RHIResources.h:1213
bool HasStaticSlot() const
Definition RHIResources.h:1176
const TArray< FRHIUniformBufferResource > GraphBuffers
Definition RHIResources.h:1193
FRHIUniformBufferLayout()=delete
const uint16 RenderTargetsOffset
Definition RHIResources.h:1207
Definition RHIResources.h:1129
uint16 MemberOffset
Definition RHIResources.h:1131
friend bool operator==(const FRHIUniformBufferResource &A, const FRHIUniformBufferResource &B)
Definition RHIResources.h:1137
EUniformBufferBaseType MemberType
Definition RHIResources.h:1134
Definition RHIResources.h:2812
FInitializer & SetOffsetInBytes(uint32 InOffsetBytes)
Definition RHIResources.h:2854
FInitializer & SetStride(uint32 InStride)
Definition RHIResources.h:2860
FInitializer & SetType(EBufferType Type)
Definition RHIResources.h:2824
FInitializer & SetNumElements(uint32 InNumElements)
Definition RHIResources.h:2867
FInitializer & SetFormat(EPixelFormat InFormat)
Definition RHIResources.h:2848
FInitializer()
Definition RHIResources.h:2819
friend FRHIViewDesc
Definition RHIResources.h:2813
friend FRHICommandListBase
Definition RHIResources.h:2814
FInitializer & SetRayTracingScene(FRHIRayTracingScene *InRayTracingScene)
Definition RHIResources.h:2874
FInitializer & SetTypeFromBuffer(FRHIBuffer *TargetBuffer)
Definition RHIResources.h:2835
Definition RHIResources.h:3174
Definition RHIResources.h:2725
RHI_API FViewInfo GetViewInfo(FRHIBuffer *TargetBuffer) const
Definition RHIResources.cpp:273
Definition RHIResources.h:2883
FInitializer & SetAtomicCounter(bool InAtomicCounter)
Definition RHIResources.h:2941
friend FRHIViewDesc
Definition RHIResources.h:2884
FInitializer & SetNumElements(uint32 InNumElements)
Definition RHIResources.h:2935
FInitializer & SetAppendBuffer(bool InAppendBuffer)
Definition RHIResources.h:2947
FInitializer & SetTypeFromBuffer(FRHIBuffer *TargetBuffer)
Definition RHIResources.h:2904
FInitializer & SetFormat(EPixelFormat InFormat)
Definition RHIResources.h:2917
FInitializer & SetStride(uint32 InStride)
Definition RHIResources.h:2929
FInitializer & SetOffsetInBytes(uint32 InOffsetBytes)
Definition RHIResources.h:2923
FInitializer()
Definition RHIResources.h:2888
friend FRHICommandListBase
Definition RHIResources.h:2885
FInitializer & SetType(EBufferType Type)
Definition RHIResources.h:2893
Definition RHIResources.h:3178
bool bAppendBuffer
Definition RHIResources.h:3180
bool bAtomicCounter
Definition RHIResources.h:3179
Definition RHIResources.h:2732
RHI_API FViewInfo GetViewInfo(FRHIBuffer *TargetBuffer) const
Definition RHIResources.cpp:279
Definition RHIResources.h:3149
EPixelFormat Format
Definition RHIResources.h:3166
EBufferType BufferType
Definition RHIResources.h:3163
uint32 NumElements
Definition RHIResources.h:3157
bool bNullView
Definition RHIResources.h:3169
uint32 SizeInBytes
Definition RHIResources.h:3160
uint32 StrideInBytes
Definition RHIResources.h:3154
uint32 OffsetInBytes
Definition RHIResources.h:3151
Definition RHIResources.h:2689
EBufferType BufferType
Definition RHIResources.h:2690
FRHIRayTracingScene * RayTracingScene
Definition RHIResources.h:2702
uint8 bAppendBuffer
Definition RHIResources.h:2692
uint8 bAtomicCounter
Definition RHIResources.h:2691
uint32 Stride
Definition RHIResources.h:2700
uint32 OffsetInBytes
Definition RHIResources.h:2694
FViewInfo GetViewInfo(FRHIBuffer *TargetBuffer) const
Definition RHIResources.cpp:176
uint32 NumElements
Definition RHIResources.h:2699
Definition RHIResources.h:2682
EPixelFormat Format
Definition RHIResources.h:2684
EViewType ViewType
Definition RHIResources.h:2683
Definition RHIResources.h:2955
FInitializer()
Definition RHIResources.h:2960
FInitializer & SetPlane(ERHITexturePlane InPlane)
Definition RHIResources.h:3004
FInitializer & SetFormat(EPixelFormat InFormat)
Definition RHIResources.h:2998
FInitializer & SetMipRange(uint8 InFirstMip, uint8 InNumMips)
Definition RHIResources.h:3010
FInitializer & SetArrayRange(uint16 InFirstElement, uint16 InNumElements)
Definition RHIResources.h:3027
FInitializer & SetDimensionFromTexture(FRHITexture *TargetTexture)
Definition RHIResources.h:2991
FInitializer & SetDisableSRGB(bool InDisableSRGB)
Definition RHIResources.h:3034
friend FRHICommandListBase
Definition RHIResources.h:2957
friend FRHIViewDesc
Definition RHIResources.h:2956
FInitializer & SetDimension(ETextureDimension InDimension)
Definition RHIResources.h:2973
Definition RHIResources.h:3222
uint8 bSRGB
Definition RHIResources.h:3227
FRHIRange8 MipRange
Definition RHIResources.h:3224
Definition RHIResources.h:2739
RHI_API FViewInfo GetViewInfo(FRHITexture *TargetTexture) const
Definition RHIResources.cpp:403
Definition RHIResources.h:3042
FInitializer & SetFormat(EPixelFormat InFormat)
Definition RHIResources.h:3088
FInitializer()
Definition RHIResources.h:3047
FInitializer & SetMipLevel(uint8 InMipLevel)
Definition RHIResources.h:3100
friend FRHICommandListBase
Definition RHIResources.h:3044
friend FRHIViewDesc
Definition RHIResources.h:3043
FInitializer & SetPlane(ERHITexturePlane InPlane)
Definition RHIResources.h:3094
FInitializer & SetDimensionFromTexture(FRHITexture *TargetTexture)
Definition RHIResources.h:3081
FInitializer & SetDimension(ETextureDimension InDimension)
Definition RHIResources.h:3063
FInitializer & SetArrayRange(uint16 InFirstElement, uint16 InNumElements)
Definition RHIResources.h:3116
Definition RHIResources.h:3233
uint8 MipLevel
Definition RHIResources.h:3235
Definition RHIResources.h:2746
RHI_API FViewInfo GetViewInfo(FRHITexture *TargetTexture) const
Definition RHIResources.cpp:420
Definition RHIResources.h:3188
uint8 bAllSlices
Definition RHIResources.h:3217
EPixelFormat Format
Definition RHIResources.h:3206
EDimension Dimension
Definition RHIResources.h:3210
ERHITexturePlane Plane
Definition RHIResources.h:3203
FRHIRange16 ArrayRange
Definition RHIResources.h:3200
uint8 bAllMips
Definition RHIResources.h:3213
Definition RHIResources.h:2712
FViewInfo GetViewInfo(FRHITexture *TargetTexture) const
Definition RHIResources.cpp:291
FRHIRange8 MipRange
Definition RHIResources.h:2716
FRHIRange16 ArrayRange
Definition RHIResources.h:2717
uint8 bDisableSRGB
Definition RHIResources.h:2714
ERHITexturePlane Plane
Definition RHIResources.h:2713
EDimension Dimension
Definition RHIResources.h:2715
Definition RHIResources.h:2648
FRHIViewDesc()
Definition RHIResources.h:2789
FCommon Common
Definition RHIResources.h:2754
bool IsTexture() const
Definition RHIResources.h:2777
bool IsSRV() const
Definition RHIResources.h:2773
bool IsUAV() const
Definition RHIResources.h:2774
union FRHIViewDesc::@1904::@1911 Texture
bool operator==(FRHIViewDesc const &RHS) const
Definition RHIResources.h:2779
EViewType
Definition RHIResources.h:2650
static FBufferUAV::FInitializer CreateBufferUAV()
Definition RHIResources.h:3129
FBufferSRV SRV
Definition RHIResources.h:2757
static const TCHAR * GetBufferTypeString(EBufferType BufferType)
Definition RHIResources.cpp:148
static FTextureUAV::FInitializer CreateTextureUAV()
Definition RHIResources.h:3139
FBufferUAV UAV
Definition RHIResources.h:2758
EBufferType
Definition RHIResources.h:2658
FRHIViewDesc(EViewType ViewType)
Definition RHIResources.h:2799
static FTextureSRV::FInitializer CreateTextureSRV()
Definition RHIResources.h:3134
FTextureSRV SRV
Definition RHIResources.h:2762
EDimension
Definition RHIResources.h:2668
static const TCHAR * GetTextureDimensionString(EDimension Dimension)
Definition RHIResources.cpp:162
union FRHIViewDesc::@1904::@1910 Buffer
bool IsBuffer() const
Definition RHIResources.h:2776
static FBufferSRV::FInitializer CreateBufferSRV()
Definition RHIResources.h:3124
FTextureUAV UAV
Definition RHIResources.h:2763
bool operator!=(FRHIViewDesc const &RHS) const
Definition RHIResources.h:2784
Definition RHI.h:278
Definition DynamicRHI.h:90
Definition RHIResources.h:3693
Definition RHIResources.h:3833
Definition RHIResources.h:3806
Definition RHIResources.h:3842
ERayTracingClusterOperationMode Mode
Definition RHIResources.h:3847
FRayTracingClusterOperationMoveInitializer Move
Definition RHIResources.h:3852
ERayTracingClusterOperationFlags Flags
Definition RHIResources.h:3848
FRayTracingClusterOperationCLASInitializer CLAS
Definition RHIResources.h:3853
FRayTracingClusterOperationBLASInitializer BLAS
Definition RHIResources.h:3854
ERayTracingClusterOperationType Type
Definition RHIResources.h:3846
Definition RHIResources.h:3800
ERayTracingClusterOperationMoveType Type
Definition RHIResources.h:3801
Definition RHIResources.h:3761
Definition RHIResources.h:3496
uint32 TotalPrimitiveCount
Definition RHIResources.h:3506
bool bTemplate
Definition RHIResources.h:3511
FName OwnerName
Definition RHIResources.h:3528
FDebugName DebugName
Definition RHIResources.h:3526
uint32 IndexBufferOffset
Definition RHIResources.h:3501
ERayTracingGeometryType GeometryType
Definition RHIResources.h:3503
TArray< FRayTracingGeometrySegment > Segments
Definition RHIResources.h:3516
bool bAllowUpdate
Definition RHIResources.h:3509
bool bAllowCompaction
Definition RHIResources.h:3510
FRayTracingGeometryOfflineDataHeader OfflineDataHeader
Definition RHIResources.h:3520
ERayTracingGeometryInitializerType Type
Definition RHIResources.h:3512
FRHIRayTracingGeometry * SourceGeometry
Definition RHIResources.h:3523
FBufferRHIRef IndexBuffer
Definition RHIResources.h:3498
bool bFastBuild
Definition RHIResources.h:3508
FResourceArrayUploadInterface * OfflineData
Definition RHIResources.h:3519
Definition RHIResources.h:3357
int32 BaseInstanceSceneDataOffset
Definition RHIResources.h:3368
TArrayView< const FMatrix > Transforms
Definition RHIResources.h:3364
int32 InstanceContributionToHitGroupIndex
Definition RHIResources.h:3360
TArrayView< const uint32 > InstanceSceneDataOffsets
Definition RHIResources.h:3369
ERayTracingInstanceFlags Flags
Definition RHIResources.h:3394
bool bApplyLocalBoundsTransform
Definition RHIResources.h:3383
bool bUsesLightingChannels
Definition RHIResources.h:3387
FRHIRayTracingGeometry * GeometryRHI
Definition RHIResources.h:3358
uint32 NumTransforms
Definition RHIResources.h:3373
uint32 DefaultUserData
Definition RHIResources.h:3379
bool bIncrementUserDataPerInstance
Definition RHIResources.h:3385
TArrayView< const uint32 > UserData
Definition RHIResources.h:3380
uint8 Mask
Definition RHIResources.h:3391
Definition RHIResources.h:3398
bool IsValid() const
Definition RHIResources.h:3401
uint32 Reserved[6]
Definition RHIResources.h:3399
bool operator==(const FRayTracingGeometryOfflineDataHeader &Other) const
Definition RHIResources.h:3406
bool operator!=(const FRayTracingGeometryOfflineDataHeader &Other) const
Definition RHIResources.h:3416
friend FArchive & operator<<(FArchive &Ar, FRayTracingGeometryOfflineDataHeader &Header)
Definition RHIResources.h:3421
Definition RHIResources.h:3463
uint32 FirstPrimitive
Definition RHIResources.h:3480
bool bForceOpaque
Definition RHIResources.h:3485
uint32 NumPrimitives
Definition RHIResources.h:3481
uint32 VertexBufferStride
Definition RHIResources.h:3473
EVertexElementType VertexBufferElementType
Definition RHIResources.h:3466
bool bAllowDuplicateAnyHitShaderInvocation
Definition RHIResources.h:3489
uint32 MaxVertices
Definition RHIResources.h:3477
FBufferRHIRef VertexBuffer
Definition RHIResources.h:3465
uint32 VertexBufferOffset
Definition RHIResources.h:3469
bool bEnabled
Definition RHIResources.h:3492
Definition RHIResources.h:3669
ERayTracingSceneLifetime Lifetime
Definition RHIResources.h:3678
uint32 NumTotalSegments
Definition RHIResources.h:3674
FName DebugName
Definition RHIResources.h:3683
uint32 MaxNumInstances
Definition RHIResources.h:3671
ERayTracingAccelerationStructureFlags BuildFlags
Definition RHIResources.h:3681
Definition RHIResources.h:3635
uint32 NumCallableShaderSlots
Definition RHIResources.h:3665
ERayTracingHitGroupIndexingMode HitGroupIndexingMode
Definition RHIResources.h:3643
uint32 LocalBindingDataSize
Definition RHIResources.h:3646
uint32 NumMissShaderSlots
Definition RHIResources.h:3661
ERayTracingShaderBindingMode ShaderBindingMode
Definition RHIResources.h:3640
ERayTracingShaderBindingTableLifetime Lifetime
Definition RHIResources.h:3637
uint32 NumShaderSlotsPerGeometrySegment
Definition RHIResources.h:3653
uint32 NumGeometrySegments
Definition RHIResources.h:3656
Definition RHIResources.h:5209
int32 Y2
Definition RHIResources.h:5213
FResolveRect(int32 InX1=-1, int32 InY1=-1, int32 InX2=-1, int32 InY2=-1)
Definition RHIResources.h:5217
int32 X1
Definition RHIResources.h:5210
FResolveRect(FIntRect Other)
Definition RHIResources.h:5224
int32 X2
Definition RHIResources.h:5212
bool IsValid() const
Definition RHIResources.h:5241
bool operator==(FResolveRect Other) const
Definition RHIResources.h:5231
int32 Y1
Definition RHIResources.h:5211
bool operator!=(FResolveRect Other) const
Definition RHIResources.h:5236
Definition ResourceArray.h:10
Definition RHIResources.h:3910
Definition RHIResources.h:755
TArray< uint32 > ResourceTableLayoutHashes
Definition RHIResources.h:769
TArray< uint32 > TextureMap
Definition RHIResources.h:772
TArray< uint32 > SamplerMap
Definition RHIResources.h:763
TArray< uint32 > ShaderResourceViewMap
Definition RHIResources.h:760
TArray< uint32 > UnorderedAccessViewMap
Definition RHIResources.h:766
TArray< uint32 > ResourceCollectionMap
Definition RHIResources.h:775
Definition DynamicRHI.h:72
Definition RHIResources.h:4927
FNameMap(FString const &InExportName, FString const &InNodeName)
Definition RHIResources.h:4932
friend uint32 GetTypeHash(FNameMap const &NameMap)
Definition RHIResources.h:4938
uint32 ExportNameHash
Definition RHIResources.h:4930
FString ExportName
Definition RHIResources.h:4928
FString NodeName
Definition RHIResources.h:4929
Definition IsTrivial.h:15
Definition NumericLimits.h:41
Definition Optional.h:131
Definition RHIResources.h:2616
bool IsInRange(uint32 Value) const
Definition RHIResources.h:2633
TType Num
Definition RHIResources.h:2618
TRHIRange()=default
TRHIRange(uint32 InFirst, uint32 InNum)
Definition RHIResources.h:2621
TType InclusiveLast() const
Definition RHIResources.h:2631
TType ExclusiveLast() const
Definition RHIResources.h:2630
TType First
Definition RHIResources.h:2617
Definition RHIResources.h:4335
Definition IntPoint.h:25
IntType Y
Definition IntPoint.h:37
IntType X
Definition IntPoint.h:34
Definition RHIResources.h:352
DSVAlue DSValue
Definition RHIResources.h:354
float Color[4]
Definition RHIResources.h:353