UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RHICommandList.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 RHICommandList.h: RHI Command List definitions for queueing up & executing later.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreTypes.h"
11#include "HAL/UnrealMemory.h"
13#include "Math/Color.h"
14#include "Math/IntPoint.h"
15#include "Math/IntRect.h"
16#include "Math/Box2D.h"
19#include "Math/ScaleMatrix.h"
20#include "Math/Float16Color.h"
23#include "Misc/MemStack.h"
24#include "Misc/App.h"
25#include "RHIStats.h"
26#include "HAL/IConsoleManager.h"
31#include "RHIBreadcrumbs.h"
32#include "RHIGlobals.h"
33#include "RHIAllocators.h"
34#include "RHIShaderParameters.h"
35#include "RHITextureReference.h"
36#include "RHIResourceReplace.h"
38#include "Trace/Trace.h"
39
40#include "DynamicRHI.h"
41#include "RHITypes.h"
42#include "RHIGlobals.h"
43
46
49
52
53// Set to 1 to capture the callstack for every RHI command. Cheap & memory efficient representation: Use the
54// value in FRHICommand::StackFrames to get the pointer to the code (ie paste on a disassembly window)
55#define RHICOMMAND_CALLSTACK 0
56#if RHICOMMAND_CALLSTACK
57#include "HAL/PlatformStackwalk.h"
58#endif
59
60class FApp;
71struct FRHIResourceInfo;
80
82
84
85// set this one to get a stat for each RHI command
86#define RHI_STATS 0
87
88#if RHI_STATS
90#define RHISTAT(Method) DECLARE_SCOPE_CYCLE_COUNTER(TEXT(#Method), STAT_RHI##Method, STATGROUP_RHI_COMMANDS)
91#else
92#define RHISTAT(Method)
93#endif
94
95#if !defined(RHI_EXECUTE_API)
96#define RHI_EXECUTE_API RHI_API
97#endif
98
100{
101 None,
103 Tasks
104};
105
106// Global for handling the "r.RHIThread.Enable" command.
108
119
122
147
150
151/*UE::Trace::FChannel& FORCEINLINE GetRHICommandsChannel()
152{
153
154}*/
155
163
171
179
181
183{
188
193
194 // Number of texels to copy. By default it will copy the whole resource if no size is specified.
196
197 // Position of the copy from the source texture/to destination texture
200
204
205 // Mips to copy and destination mips
209};
210
212{
213 class FRHIBuffer* Buffer{ nullptr };
216};
217
246
257
259{
260 Persistent, //< Binding contains persistent data
261 Transient, //< Binding contains transient data
262 Clear, //< Clear SBT record data
263 Validation //< Binding only used for validating persistently stored data in the SBT
264};
265
279
281{
282 HitGroup,
285};
286
288{
306
309
311 {
312 }
313
314 inline void Lock(void* RHIBuffer, void* Buffer, uint32 Offset, uint32 SizeRHI, EResourceLockMode LockMode)
315 {
317#if DO_CHECK
318 for (auto& Parms : OutstandingLocks)
319 {
320 check(Parms.RHIBuffer != RHIBuffer);
321 }
322#endif
323 OutstandingLocks.Add(FLockParams(RHIBuffer, Buffer, Offset, SizeRHI, LockMode));
324 }
325 inline FLockParams Unlock(void* RHIBuffer)
326 {
328 for (int32 Index = 0; Index < OutstandingLocks.Num(); Index++)
329 {
330 if (OutstandingLocks[Index].RHIBuffer == RHIBuffer)
331 {
334 return Result;
335 }
336 }
337 check(!"Mismatched RHI buffer locks.");
338 return FLockParams(nullptr, nullptr, 0, 0, RLM_WriteOnly);
339 }
340};
341
342#ifdef CONTINUABLE_PSO_VERIFY
343#define PSO_VERIFY ensure
344#else
345#define PSO_VERIFY check
346#endif
347
349{
351 virtual void ExecuteAndDestruct(FRHICommandListBase& CmdList) = 0;
352};
353
354template <typename RHICmdListType, typename LAMBDA>
356{
358#if CPUPROFILERTRACE_ENABLED
359 const TCHAR* Name;
360#endif
361
365 , Name(InName)
366#endif
367 {}
368
369 void ExecuteAndDestruct(FRHICommandListBase& CmdList) override final
370 {
372 Lambda(*static_cast<RHICmdListType*>(&CmdList));
373 Lambda.~LAMBDA();
374 }
375};
376
377template <typename RHICmdListType, typename LAMBDA>
379{
381
385
386 void ExecuteAndDestruct(FRHICommandListBase& CmdList) override final
387 {
388 Lambda(*static_cast<RHICmdListType*>(&CmdList));
389 Lambda.~LAMBDA();
390 }
391};
392
393template <typename RHICmdListType, typename LAMBDA>
395{
397#if CPUPROFILERTRACE_ENABLED
398 const TCHAR* Name;
399#endif
401
409
410 inline void ExecuteAndDestruct(FRHICommandListBase& CmdList) override final;
411};
412
413// Using variadic macro because some types are fancy template<A,B> stuff, which gets broken off at the comma and interpreted as multiple arguments.
414#define ALLOC_COMMAND(...) new ( AllocCommand(sizeof(__VA_ARGS__), alignof(__VA_ARGS__)) ) __VA_ARGS__
415#define ALLOC_COMMAND_CL(RHICmdList, ...) new ( (RHICmdList).AllocCommand(sizeof(__VA_ARGS__), alignof(__VA_ARGS__)) ) __VA_ARGS__
416
417// This controls if the cmd list bypass can be toggled at runtime. It is quite expensive to have these branches in there.
418#define CAN_TOGGLE_COMMAND_LIST_BYPASS (!UE_BUILD_SHIPPING && !UE_BUILD_TEST)
419
420// Issues a single fence at the end of the scope if an RHI fence is requested by commands within the scope. Can
421// reduce overhead of RHIThreadFence when batch updating resources that would otherwise issue N fences.
423{
425 FRHICommandListBase& RHICmdList;
427 bool bFenceRequested = false;
428
429public:
432};
433
435{
436 FRHICommandListBase& RHICmdList;
437 bool bPipelineSet = false;
438
439public:
442};
443
445{
446 FRHICommandListBase& RHICmdList;
447 bool bAllowExtraTransitions = false;
448
449public:
450 FRHICommandListScopedAllowExtraTransitions(FRHICommandListBase& RHICmdList, bool bAllowExtraTransitions);
452};
453
455{
456protected:
458
460
461public:
462 // Move only.
465
467
468 inline bool IsImmediate() const;
470 const int32 GetUsedMemory() const;
471
473 {
474 // Command lists cannot be translated in parallel for various reasons...
475
476 // Parallel translate might be explicitly disabled (e.g. platform RHI doesn't support parallel translate)
478 {
479 return false;
480 }
481
482 // All commands recorded by the immediate command list must not be parallel translated.
483 // This is mostly for legacy reasons, since various parts of the renderer / RHI expect immediate commands to be single-threaded.
485 {
486 return false;
487 }
488
489 // Command lists that use RHIThreadFence(true) are going to mutate resource state, so must be single-threaded.
490 if (bUsesLockFence)
491 {
492 return false;
493 }
494
495 // Some shader bundle implementations do not currently support parallel translate
497 {
498 return false;
499 }
500
501 return true;
502 }
503
504 //
505 // Adds a graph event as a dispatch dependency. The command list will not be dispatched to the
506 // RHI / parallel translate threads until all its dispatch prerequisites have been completed.
507 //
508 // Not safe to call after FinishRecording().
509 //
511
512 //
513 // Marks the RHI command list as completed, allowing it to be dispatched to the RHI / parallel translate threads.
514 //
515 // Must be called as the last command in a parallel rendering task. It is not safe to continue using the command
516 // list after FinishRecording() has been called.
517 //
518 // Never call on the immediate command list.
519 //
521
522 inline void* Alloc(int64 AllocSize, int64 Alignment)
523 {
524 return MemManager.Alloc(AllocSize, Alignment);
525 }
526
527 inline void* AllocCopy(const void* InSourceData, int64 AllocSize, int64 Alignment)
528 {
529 void* NewData = Alloc(AllocSize, Alignment);
530 FMemory::Memcpy(NewData, InSourceData, AllocSize);
531 return NewData;
532 }
533
534 template <typename T>
535 inline T* Alloc()
536 {
537 return (T*)Alloc(sizeof(T), alignof(T));
538 }
539
540 template <typename T>
542 {
543 return TArrayView<T>((T*)Alloc(Num * sizeof(T), alignof(T)), Num);
544 }
545
546 template <typename T>
548 {
549 if (InArray.Num() == 0)
550 {
551 return TArrayView<T>();
552 }
553
554 // @todo static_assert(TIsTrivial<T>::Value, "Only trivially constructible / copyable types can be used in RHICmdList.");
555 void* NewArray = AllocCopy(InArray.GetData(), InArray.Num() * sizeof(T), alignof(T));
556 return TArrayView<T>((T*) NewArray, InArray.Num());
557 }
558
559 inline TCHAR* AllocString(const TCHAR* Name)
560 {
561 int32 Len = FCString::Strlen(Name) + 1;
562 TCHAR* NameCopy = (TCHAR*)Alloc(Len * (int32)sizeof(TCHAR), (int32)sizeof(TCHAR));
564 return NameCopy;
565 }
566
567 inline void* AllocCommand(int32 AllocSize, int32 Alignment)
568 {
570 checkfSlow(!Bypass(), TEXT("Invalid attempt to record commands in bypass mode."));
571 FRHICommandBase* Result = (FRHICommandBase*) MemManager.Alloc(AllocSize, Alignment);
572 ++NumCommands;
573 *CommandLink = Result;
574 CommandLink = &Result->Next;
575 return Result;
576 }
577
578 template <typename TCmd>
579 inline void* AllocCommand()
580 {
581 return AllocCommand(sizeof(TCmd), alignof(TCmd));
582 }
583
584 template <typename LAMBDA>
585 inline void EnqueueLambda(const TCHAR* LambdaName, LAMBDA&& Lambda)
586 {
587 if (IsBottomOfPipe())
588 {
589 Lambda(*this);
590 }
591 else
592 {
594 }
595 }
596
597 template <typename LAMBDA>
598 inline void EnqueueLambda(LAMBDA&& Lambda)
599 {
600 FRHICommandListBase::EnqueueLambda(TEXT("TRHILambdaCommand"), Forward<LAMBDA>(Lambda));
601 }
602
603 enum class EThreadFence
604 {
605 Enabled,
607 };
608
609 template <typename LAMBDA>
611 {
612 checkf(IsTopOfPipe() || Bypass(), TEXT("Cannot enqueue a multi-pipe lambda from the bottom of pipe."));
613
615 ActivatePipelines(Pipelines);
616
617 if (IsBottomOfPipe())
618 {
619 FRHIContextArray LocalContexts { InPlace, nullptr };
620 for (ERHIPipeline Pipeline : MakeFlagsRange(Pipelines))
621 {
622 LocalContexts[Pipeline] = Contexts[Pipeline];
623 check(LocalContexts[Pipeline]);
624 }
625
626 // Static cast to enforce const type in lambda args
627 Lambda(static_cast<FRHIContextArray const&>(LocalContexts));
628 }
629 else
630 {
632 }
633
635
637 {
638 RHIThreadFence(true);
639 }
640 }
641
642 inline bool HasCommands() const
643 {
644 // Assume we have commands if anything is allocated.
645 return !MemManager.IsEmpty();
646 }
647
648 inline bool IsExecuting() const
649 {
650 return bExecuting;
651 }
652
653 inline bool IsBottomOfPipe() const
654 {
655 return Bypass() || IsExecuting();
656 }
657
658 inline bool IsTopOfPipe() const
659 {
660 return !IsBottomOfPipe();
661 }
662
663 inline bool IsGraphics() const
664 {
665 // Exact equality is deliberate. Only return true if the graphics pipe is the only active pipe.
667 }
668
669 inline bool IsAsyncCompute() const
670 {
671 // Exact equality is deliberate. Only return true if the compute pipe is the only active pipe.
673 }
674
680
682 {
683 return ActivePipelines;
684 }
685
687 {
688 checkf(IsSingleRHIPipeline(ActivePipelines), TEXT("Exactly one pipeline must be active to call GetContext(). Current pipeline mask is '0x%02x'."), static_cast<std::underlying_type_t<ERHIPipeline>>(ActivePipelines));
689 checkf(GraphicsContext, TEXT("There is no active graphics context on this command list. There may be a missing call to SwitchPipeline()."));
690 return *GraphicsContext;
691 }
692
694 {
695 checkf(IsSingleRHIPipeline(ActivePipelines), TEXT("Exactly one pipeline must be active to call GetComputeContext(). Current pipeline mask is '0x%02x'."), static_cast<std::underlying_type_t<ERHIPipeline>>(ActivePipelines));
696 checkf(ComputeContext, TEXT("There is no active compute context on this command list. There may be a missing call to SwitchPipeline()."));
697 return *ComputeContext;
698 }
699
701 {
702 if(!UploadContext)
703 {
705 }
706 return *UploadContext;
707 }
708
709 inline bool Bypass() const;
710
711 inline bool IsSubCommandList() const
712 {
713 return SubRenderPassInfo.IsValid();
714 }
715
716private:
717 RHI_API void InvalidBufferFatalError(const FRHIBufferCreateDesc& CreateDesc);
718
719protected:
720 RHI_API void ActivatePipelines(ERHIPipeline Pipelines);
721
722 // Takes the array of sub command lists and inserts them logically into a render pass at this point in time.
724
725public:
731
733
735
736 bool IsRecursive () const { return PersistentState.bRecursive; }
740
741#if HAS_GPU_STATS
743#endif
744
746
748 {
749 checkf(IsTopOfPipe() || Bypass(), TEXT("Buffers may only be locked while recording RHI command lists, not during RHI command list execution."));
750
752 return GDynamicRHI->RHILockBuffer(*this, Buffer, Offset, SizeRHI, LockMode);
753 }
754
756 {
757 checkf(IsTopOfPipe() || Bypass(), TEXT("Buffers may only be unlocked while recording RHI command lists, not during RHI command list execution."));
758
761 }
762
763#if ENABLE_LOW_LEVEL_MEM_TRACKER || UE_MEMORY_TRACE_ENABLED
765#endif
766
767 // LockBufferMGPU / UnlockBufferMGPU may ONLY be called for buffers with the EBufferUsageFlags::MultiGPUAllocate flag set!
768 // And buffers with that flag set may not call the regular (single GPU) LockBuffer / UnlockBuffer. The single GPU version
769 // of LockBuffer uses driver mirroring to propagate the updated buffer to other GPUs, while the MGPU / MultiGPUAllocate
770 // version requires the caller to manually lock and initialize the buffer separately on each GPU. This can be done by
771 // iterating over FRHIGPUMask::All() and calling LockBufferMGPU / UnlockBufferMGPU for each version.
772 //
773 // EBufferUsageFlags::MultiGPUAllocate is only needed for cases where CPU initialized data needs to be different per GPU,
774 // which is a rare edge case. Currently, this is only used for the ray tracing acceleration structure address buffer,
775 // which contains virtual address references to other GPU resources, which may be in a different location on each GPU.
776 //
778 {
779 checkf(IsTopOfPipe() || Bypass(), TEXT("Buffers may only be locked while recording RHI command lists, not during RHI command list execution."));
780
781 return GDynamicRHI->RHILockBufferMGPU(*this, Buffer, GPUIndex, Offset, SizeRHI, LockMode);
782 }
783
784 inline void UnlockBufferMGPU(FRHIBuffer* Buffer, uint32 GPUIndex)
785 {
786 checkf(IsTopOfPipe() || Bypass(), TEXT("Buffers may only be unlocked while recording RHI command lists, not during RHI command list execution."));
787
788 GDynamicRHI->RHIUnlockBufferMGPU(*this, Buffer, GPUIndex);
789 }
790
791 [[nodiscard]]
797
798 // Shortcut for creating a buffer without writing to an initializer
799 [[nodiscard]]
801 {
802 if (CreateDesc.Size == 0 && !CreateDesc.IsNull())
803 {
804 InvalidBufferFatalError(CreateDesc);
805 }
806
807 checkf(CreateDesc.InitAction != ERHIBufferInitAction::Initializer, TEXT("Buffer InitAction set to Initializer when calling CreateBuffer which doesn't write to its initializer"));
808
811 return Initializer.Finalize();
812 }
813
815 UE_DEPRECATED(5.6, "CreateBuffer without FRHIBufferCreateDesc is deprecated")
817 {
818 const FRHIBufferCreateDesc CreateDesc =
819 FRHIBufferCreateDesc::CreateNull(CreateInfo.DebugName)
820 .SetGPUMask(CreateInfo.GPUMask)
821 .SetInitialState(ResourceState)
822 .SetClassName(CreateInfo.ClassName)
823 .SetOwnerName(CreateInfo.OwnerName);
824
825 return CreateBuffer(CreateDesc);
826 }
827
828 UE_DEPRECATED(5.6, "CreateBuffer without FRHIBufferCreateDesc is deprecated")
830 {
831 if (CreateInfo.bWithoutNativeResource)
832 {
833 return CreateNullBuffer(ResourceState, CreateInfo);
834 }
835
836 FRHIBufferCreateDesc CreateDesc =
837 FRHIBufferCreateDesc::Create(CreateInfo.DebugName, Size, Stride, Usage)
838 .SetGPUMask(CreateInfo.GPUMask)
839 .SetInitialState(ResourceState)
840 .SetClassName(CreateInfo.ClassName)
841 .SetOwnerName(CreateInfo.OwnerName);
842
843 if (CreateInfo.ResourceArray)
844 {
845 CreateDesc.SetInitActionResourceArray(CreateInfo.ResourceArray);
846 }
847
848 return CreateBuffer(CreateDesc);
849 }
850
851 UE_DEPRECATED(5.6, "CreateBuffer without FRHIBufferCreateDesc is deprecated")
853 {
854 return CreateBuffer(Size, Usage | EBufferUsageFlags::VertexBuffer, 0, ResourceState, CreateInfo);
855 }
856
857 UE_DEPRECATED(5.6, "CreateBuffer without FRHIBufferCreateDesc is deprecated")
859 {
861 return CreateVertexBuffer(Size, Usage, ResourceState, CreateInfo);
862 }
863
864 UE_DEPRECATED(5.6, "CreateBuffer without FRHIBufferCreateDesc is deprecated")
866 {
867 return CreateBuffer(Size, Usage | EBufferUsageFlags::StructuredBuffer, Stride, ResourceState, CreateInfo);
868 }
869
870 UE_DEPRECATED(5.6, "CreateBuffer without FRHIBufferCreateDesc is deprecated")
872 {
874 return CreateStructuredBuffer(Stride, Size, Usage, ResourceState, CreateInfo);
875 }
876
877 UE_DEPRECATED(5.6, "CreateBuffer without FRHIBufferCreateDesc is deprecated")
879 {
880 return CreateBuffer(Size, Usage | EBufferUsageFlags::IndexBuffer, Stride, ResourceState, CreateInfo);
881 }
882
883 UE_DEPRECATED(5.6, "CreateBuffer without FRHIBufferCreateDesc is deprecated")
885 {
887 return CreateIndexBuffer(Stride, Size, Usage, ResourceState, CreateInfo);
888 }
890
891 inline void UpdateUniformBuffer(FRHIUniformBuffer* UniformBufferRHI, const void* Contents)
892 {
894 GDynamicRHI->RHIUpdateUniformBuffer(*this, UniformBufferRHI, Contents);
895 }
896
898 {
900 if (Bypass())
901 {
902 StreamSourceSlotRHI->Buffer = BufferRHI;
903 }
904 else
905 {
907 {
908 StreamSourceSlotRHI->Buffer = BufferRHI;
909 });
910 RHIThreadFence(true);
911 }
912 }
913
914 inline void UpdateTexture2D(FRHITexture* Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D& UpdateRegion, uint32 SourcePitch, const uint8* SourceData)
915 {
916 checkf(UpdateRegion.DestX + UpdateRegion.Width <= Texture->GetSizeX(), TEXT("UpdateTexture2D out of bounds on X. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestX, UpdateRegion.Width, Texture->GetSizeX());
917 checkf(UpdateRegion.DestY + UpdateRegion.Height <= Texture->GetSizeY(), TEXT("UpdateTexture2D out of bounds on Y. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestY, UpdateRegion.Height, Texture->GetSizeY());
918 LLM_SCOPE(ELLMTag::Textures);
919
921 GDynamicRHI->RHIUpdateTexture2D(*this, Texture, MipIndex, UpdateRegion, SourcePitch, SourceData);
922 }
923
924 [[nodiscard]]
926 {
927 LLM_SCOPE(EnumHasAnyFlags(CreateDesc.Flags, TexCreate_RenderTargetable | TexCreate_DepthStencilTargetable) ? ELLMTag::RenderTargets : ELLMTag::Textures);
928
929 if (CreateDesc.InitialState == ERHIAccess::Unknown)
930 {
931 // Need to copy the incoming descriptor since we need to override the initial state.
933 NewCreateDesc.SetInitialState(RHIGetDefaultResourceState(CreateDesc.Flags, CreateDesc.BulkData != nullptr));
934
936 }
937
938 return GDynamicRHI->RHICreateTextureInitializer(*this, CreateDesc);
939 }
940
942 {
944 return Initializer.Finalize();
945 }
946
947 inline void UpdateFromBufferTexture2D(FRHITexture* Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D& UpdateRegion, uint32 SourcePitch, FRHIBuffer* Buffer, uint32 BufferOffset)
948 {
949 checkf(UpdateRegion.DestX + UpdateRegion.Width <= Texture->GetSizeX(), TEXT("UpdateFromBufferTexture2D out of bounds on X. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestX, UpdateRegion.Width, Texture->GetSizeX());
950 checkf(UpdateRegion.DestY + UpdateRegion.Height <= Texture->GetSizeY(), TEXT("UpdateFromBufferTexture2D out of bounds on Y. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestY, UpdateRegion.Height, Texture->GetSizeY());
951 LLM_SCOPE(ELLMTag::Textures);
952
954 GDynamicRHI->RHIUpdateFromBufferTexture2D(*this, Texture, MipIndex, UpdateRegion, SourcePitch, Buffer, BufferOffset);
955 }
956
957 inline void UpdateTexture3D(FRHITexture* Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D& UpdateRegion, uint32 SourceRowPitch, uint32 SourceDepthPitch, const uint8* SourceData)
958 {
959 checkf(UpdateRegion.DestX + UpdateRegion.Width <= Texture->GetSizeX(), TEXT("UpdateTexture3D out of bounds on X. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestX, UpdateRegion.Width, Texture->GetSizeX());
960 checkf(UpdateRegion.DestY + UpdateRegion.Height <= Texture->GetSizeY(), TEXT("UpdateTexture3D out of bounds on Y. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestY, UpdateRegion.Height, Texture->GetSizeY());
961 checkf(UpdateRegion.DestZ + UpdateRegion.Depth <= Texture->GetSizeZ(), TEXT("UpdateTexture3D out of bounds on Z. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestZ, UpdateRegion.Depth, Texture->GetSizeZ());
962 LLM_SCOPE(ELLMTag::Textures);
963
965 GDynamicRHI->RHIUpdateTexture3D(*this, Texture, MipIndex, UpdateRegion, SourceRowPitch, SourceDepthPitch, SourceData);
966 }
967
972
974
976 {
977 LLM_SCOPE_BYNAME(TEXT("RHIMisc/CreateShaderResourceView"));
978 return GDynamicRHI->RHICreateShaderResourceView(*this, Buffer, ViewDesc);
979 }
980
982 {
983 LLM_SCOPE_BYNAME(TEXT("RHIMisc/CreateShaderResourceView"));
984 checkf(Texture->GetTextureReference() == nullptr, TEXT("Creating a shader resource view of an FRHITextureReference is not supported."));
985
986 return GDynamicRHI->RHICreateShaderResourceView(*this, Texture, ViewDesc);
987 }
988
990 {
991 LLM_SCOPE_BYNAME(TEXT("RHIMisc/CreateUnorderedAccessView"));
992 return GDynamicRHI->RHICreateUnorderedAccessView(*this, Buffer, ViewDesc);
993 }
994
996 {
997 LLM_SCOPE_BYNAME(TEXT("RHIMisc/CreateUnorderedAccessView"));
998 checkf(Texture->GetTextureReference() == nullptr, TEXT("Creating an unordered access view of an FRHITextureReference is not supported."));
999
1000 return GDynamicRHI->RHICreateUnorderedAccessView(*this, Texture, ViewDesc);
1001 }
1002
1007
1008 UE_DEPRECATED(5.6, "Use the CreateUnorderedAccessView function that takes an FRHIViewDesc.")
1010 {
1012 .SetTypeFromBuffer(Buffer)
1013 .SetAtomicCounter(bUseUAVCounter)
1014 .SetAppendBuffer(bAppendBuffer)
1015 );
1016 }
1017
1018 UE_DEPRECATED(5.6, "Use the CreateUnorderedAccessView function that takes an FRHIViewDesc.")
1020 {
1021 // For back-compat reasons, SRVs of byte-address buffers created via this function ignore the Format, and instead create raw views.
1022 if (Buffer && EnumHasAnyFlags(Buffer->GetDesc().Usage, BUF_ByteAddressBuffer))
1023 {
1026 );
1027 }
1028 else
1029 {
1032 .SetFormat(EPixelFormat(Format))
1033 );
1034 }
1035 }
1036
1037 UE_DEPRECATED(5.6, "Use the CreateUnorderedAccessView function that takes an FRHIViewDesc.")
1039 {
1040 check(MipLevel < 256);
1041
1043 .SetDimensionFromTexture(Texture)
1044 .SetMipLevel(uint8(MipLevel))
1045 .SetArrayRange(FirstArraySlice, NumArraySlices)
1046 );
1047 }
1048
1049 UE_DEPRECATED(5.6, "Use the CreateUnorderedAccessView function that takes an FRHIViewDesc.")
1051 {
1052 check(MipLevel < 256);
1053
1055 .SetDimensionFromTexture(Texture)
1056 .SetMipLevel(uint8(MipLevel))
1057 .SetFormat(EPixelFormat(Format))
1058 .SetArrayRange(FirstArraySlice, NumArraySlices)
1059 );
1060 }
1061
1062 UE_DEPRECATED(5.6, "Use the CreateShaderResourceView function that takes an FRHIViewDesc.")
1064 {
1066 .SetTypeFromBuffer(Buffer));
1067 checkf(SRVRef->GetDesc().Buffer.SRV.BufferType != FRHIViewDesc::EBufferType::Typed,
1068 TEXT("Typed buffer should be created using CreateShaderResourceView where Format is specified."));
1069 return SRVRef;
1070 }
1071
1072 UE_DEPRECATED(5.6, "Use the CreateShaderResourceView function that takes an FRHIViewDesc.")
1074 {
1076 check(Stride == GPixelFormats[Format].BlockBytes);
1077
1078 // For back-compat reasons, SRVs of byte-address buffers created via this function ignore the Format, and instead create raw views.
1079 if (Buffer && EnumHasAnyFlags(Buffer->GetDesc().Usage, BUF_ByteAddressBuffer))
1080 {
1083 );
1084 }
1085 else
1086 {
1089 .SetFormat(EPixelFormat(Format))
1090 );
1091 }
1092 }
1093
1094 UE_DEPRECATED(5.6, "Use the CreateShaderResourceView function that takes an FRHIViewDesc.")
1096 {
1098 .SetDimensionFromTexture(Texture)
1099 .SetFormat (CreateInfo.Format)
1100 .SetMipRange (CreateInfo.MipLevel, CreateInfo.NumMipLevels)
1101 .SetDisableSRGB(CreateInfo.SRGBOverride == SRGBO_ForceDisable)
1102 .SetArrayRange (CreateInfo.FirstArraySlice, CreateInfo.NumArraySlices)
1103 .SetPlane (CreateInfo.MetaData)
1104 );
1105 }
1106
1107 UE_DEPRECATED(5.6, "Use the CreateShaderResourceView function that takes an FRHIViewDesc.")
1109 {
1111 .SetDimensionFromTexture(Texture)
1112 .SetMipRange(MipLevel, 1)
1113 );
1114 }
1115
1116 UE_DEPRECATED(5.6, "Use the CreateShaderResourceView function that takes an FRHIViewDesc.")
1118 {
1120 .SetDimensionFromTexture(Texture)
1121 .SetMipRange(MipLevel, NumMipLevels)
1122 .SetFormat(Format)
1123 );
1124 }
1125
1126 UE_DEPRECATED(5.6, "Use the CreateShaderResourceView function that takes an FRHIViewDesc.")
1128 {
1130 .SetDimensionFromTexture(Texture2DRHI)
1131 .SetPlane(ERHITexturePlane::CMask)
1132 );
1133 }
1134
1135 UE_DEPRECATED(5.6, "Use the CreateShaderResourceView function that takes an FRHIViewDesc.")
1137 {
1139 .SetDimensionFromTexture(Texture2DRHI)
1140 .SetPlane(ERHITexturePlane::FMask)
1141 );
1142 }
1143
1149
1154
1159
1164
1166 {
1167 if (ReplaceInfos.Num() == 0)
1168 {
1169 return;
1170 }
1171
1173 }
1174
1176 {
1178 }
1179
1181 {
1183 }
1184
1185 inline void BindDebugLabelName(FRHIUnorderedAccessView* UnorderedAccessViewRHI, const TCHAR* Name)
1186 {
1187 GDynamicRHI->RHIBindDebugLabelName(*this, UnorderedAccessViewRHI, Name);
1188 }
1189
1191 {
1193
1194 if (!ScratchShaderParameters)
1195 {
1197 }
1198
1199 if (!ensureMsgf(!ScratchShaderParameters->HasParameters(), TEXT("Scratch shader parameters left without committed parameters")))
1200 {
1201 ScratchShaderParameters->Reset();
1202 }
1203
1204 return *ScratchShaderParameters;
1205 }
1206
1208 {
1209 if (!ensureMsgf(!ScratchShaderUnbinds.HasParameters(), TEXT("Scratch shader parameters left without committed parameters")))
1210 {
1212 }
1213 return ScratchShaderUnbinds;
1214 }
1215
1216 // Returns true if the RHI needs unbind commands
1218 {
1220 }
1221
1222 // Returns true if the underlying RHI needs implicit transitions inside of certain methods.
1227
1228 // Returns old state of bAllowExtraTransitions
1229 bool SetAllowExtraTransitions(bool NewState)
1230 {
1231 bool OldState = bAllowExtraTransitions;
1232 bAllowExtraTransitions = NewState;
1233 return OldState;
1234 }
1235
1240
1241protected:
1243
1251
1253 {
1254#if DO_GUARD_SLOW
1255 switch (ShaderRHI->GetFrequency())
1256 {
1262 default: checkfSlow(false, TEXT("Unexpected graphics shader type %d"), ShaderRHI->GetFrequency());
1263 }
1264#endif // DO_GUARD_SLOW
1265 }
1266
1267 inline void ValidateShaderParameters(const FRHIBatchedShaderParameters& ShaderParameters)
1268 {
1269#if RHI_VALIDATE_BATCHED_SHADER_PARAMETERS
1270 check(this == &ShaderParameters.Allocator.RHICmdList);
1271#endif
1272 }
1273
1275 {
1276#if RHI_VALIDATE_BATCHED_SHADER_PARAMETERS
1277 for (const FRHIShaderBundleComputeDispatch& Dispatch : Dispatches)
1278 {
1279 if (Dispatch.IsValid())
1280 {
1281 ValidateShaderParameters(*Dispatch.Parameters);
1282 }
1283 }
1284#endif
1285 }
1286
1288 {
1290 Info.ConvertToRenderTargetsInfo(RTInfo);
1291
1292 for (int32 RTIdx = 0; RTIdx < RTInfo.NumColorRenderTargets; ++RTIdx)
1293 {
1295 }
1296
1298 PersistentState.CachedDepthStencilTarget = RTInfo.DepthStencilRenderTarget;
1299 PersistentState.bHasFragmentDensityAttachment = RTInfo.ShadingRateTexture != nullptr;
1300 PersistentState.MultiViewCount = RTInfo.MultiViewCount;
1301 }
1302
1304 {
1306 }
1307
1308 void ResetSubpass(ESubpassHint SubpassHint)
1309 {
1310 PersistentState.SubpassHint = SubpassHint;
1312 }
1313
1318
1324
1329
1335
1336protected:
1339
1340 // The active context into which graphics commands are recorded.
1342
1343 // The active compute context into which (possibly async) compute commands are recorded.
1345
1346 // The active upload context into which RHI specific commands are recorded.
1348
1349 // The RHI contexts available to the command list during execution.
1350 // These are always set for the immediate command list, see InitializeImmediateContexts().
1352
1354 bool bExecuting = false;
1358 bool bUsesLockFence = false;
1360
1361 // The currently selected pipelines that RHI commands are directed to, during command list recording.
1362 // This is also adjusted during command list execution based on recorded use of ActivatePipeline().
1364
1365#if DO_CHECK
1366 // Used to check for valid pipelines passed to ActivatePipeline().
1368#endif
1369
1371
1373
1377
1378 // Graph event used to gate the execution of the command list on the completion of any dependent tasks
1379 // e.g. PSO async compilation and parallel RHICmdList recording tasks.
1381
1383 {
1386
1388
1390 {
1391 AllocatorsRoot = RHS.AllocatorsRoot;
1392 ScratchShaderParameters = RHS.ScratchShaderParameters;
1393 RHS.AllocatorsRoot = nullptr;
1394 RHS.ScratchShaderParameters = nullptr;
1395 }
1396
1398 {
1400 {
1401 ScratchShaderParameters->~FRHIBatchedShaderParameters();
1402 ScratchShaderParameters = nullptr;
1403 }
1404
1405 for (FRHIBatchedShaderParametersAllocator* Node = AllocatorsRoot; Node; Node = Node->Next)
1406 {
1407 Node->~FRHIBatchedShaderParametersAllocator();
1408 }
1409 AllocatorsRoot = nullptr;
1410 }
1411 };
1412
1415
1416#if WITH_RHI_BREADCRUMBS
1417
1418 struct
1419 {
1420 FRHIBreadcrumbNode* Current = FRHIBreadcrumbNode::Sentinel;
1422 bool bEmitBreadcrumbs = false;
1423 } CPUBreadcrumbState {};
1424
1425 struct FBreadcrumbState
1426 {
1427 FRHIBreadcrumbNode* Current = FRHIBreadcrumbNode::Sentinel;
1429 FRHIBreadcrumbNode* Prev = nullptr;
1431 };
1432
1434
1437
1439 {
1440 FActivatePipelineCommand* Next = nullptr;
1441 FRHIBreadcrumbNode* Target = nullptr;
1442 ERHIPipeline Pipelines;
1443 };
1444 struct
1445 {
1447 FActivatePipelineCommand* Prev = nullptr;
1449#endif
1450
1451#if HAS_GPU_STATS
1453#endif
1454
1455 // The values in this struct are preserved when the command list is moved or reset.
1457 {
1461
1465
1467
1474
1477
1482
1483#if WITH_RHI_BREADCRUMBS
1484 FRHIBreadcrumbNode* LocalBreadcrumb = FRHIBreadcrumbNode::Sentinel;
1485#endif
1486
1487#if HAS_GPU_STATS
1489#endif
1490
1493
1505
1507
1509
1512
1513public:
1514#if WITH_RHI_BREADCRUMBS
1516 friend FRHIBreadcrumbScope;
1517
1519 {
1520 return PersistentState.LocalBreadcrumb;
1521 }
1522
1524#endif
1525
1527 {
1528#if HAS_GPU_STATS
1529 DrawStats.AddDraw(PersistentState.CurrentGPUMask, PersistentState.CurrentDrawStatsCategory.GetValue());
1530#else
1532#endif
1533 }
1534
1535 void Stats_AddDrawAndPrimitives(EPrimitiveType PrimitiveType, uint32 NumPrimitives)
1536 {
1537#if HAS_GPU_STATS
1538 DrawStats.AddDrawAndPrimitives(PersistentState.CurrentGPUMask, PersistentState.CurrentDrawStatsCategory.GetValue(), PrimitiveType, NumPrimitives);
1539#else
1540 DrawStats.AddDrawAndPrimitives(PersistentState.CurrentGPUMask, nullptr, PrimitiveType, NumPrimitives);
1541#endif
1542 }
1543
1545 {
1546 switch (QueryType)
1547 {
1548 default: checkNoEntry(); [[fallthrough]];
1551 }
1552 }
1553
1554private:
1555 FRHICommandListBase(FPersistentState const& InPersistentState);
1556
1557 // Replays recorded commands. Used internally, do not call directly.
1558 RHI_EXECUTE_API void Execute();
1559
1573
1574 template <typename RHICmdListType, typename LAMBDA>
1576
1577#if WITH_RHI_BREADCRUMBS
1578 friend bool IRHIComputeContext::ShouldEmitBreadcrumbs() const;
1579#endif
1580};
1581
1582#if WITH_RHI_BREADCRUMBS
1583//
1584// Returns true if RHI breadcrumb strings should be emitted to platform GPU profiling APIs.
1585// Platform RHI implementations should check for this inside RHIBeginBreadcrumbGPU and RHIEndBreadcrumbGPU.
1586//
1587inline bool IRHIComputeContext::ShouldEmitBreadcrumbs() const
1588{
1589#if WITH_RHI_BREADCRUMBS_FULL
1590 return GetExecutingCommandList().CPUBreadcrumbState.bEmitBreadcrumbs;
1591#else
1592 return false;
1593#endif
1594}
1595#endif
1596
1598{
1599 static const TCHAR* TStr() { return TEXT("FUnnamedRhiCommand"); }
1600};
1601
1602template<typename TCmd, typename NameType = FUnnamedRhiCommand>
1604{
1605#if RHICOMMAND_CALLSTACK
1606 uint64 StackFrames[16];
1607
1608 FRHICommand()
1609 {
1611 }
1612#endif
1613
1614 void ExecuteAndDestruct(FRHICommandListBase& CmdList) override final
1615 {
1616 LLM_SCOPE_BYNAME(TEXT("RHIMisc/CommandList/ExecuteAndDestruct"));
1618
1619 TCmd* ThisCmd = static_cast<TCmd*>(this);
1620 ThisCmd->Execute(CmdList);
1621 ThisCmd->~TCmd();
1622 }
1623};
1624
1625#define FRHICOMMAND_UNNAMED(CommandName) \
1626 struct CommandName final : public FRHICommand<CommandName, FUnnamedRhiCommand>
1627
1628#define FRHICOMMAND_UNNAMED_TPL(TemplateType, CommandName) \
1629 template<typename TemplateType> \
1630 struct CommandName final : public FRHICommand<CommandName<TemplateType>, FUnnamedRhiCommand>
1631
1632#define FRHICOMMAND_MACRO(CommandName) \
1633 struct PREPROCESSOR_JOIN(CommandName##String, __LINE__) \
1634 { \
1635 static const TCHAR* TStr() { return TEXT(#CommandName); } \
1636 }; \
1637 struct CommandName final : public FRHICommand<CommandName, PREPROCESSOR_JOIN(CommandName##String, __LINE__)>
1638
1639#define FRHICOMMAND_MACRO_TPL(TemplateType, CommandName) \
1640 struct PREPROCESSOR_JOIN(CommandName##String, __LINE__) \
1641 { \
1642 static const TCHAR* TStr() { return TEXT(#CommandName); } \
1643 }; \
1644 template<typename TemplateType> \
1645 struct CommandName final : public FRHICommand<CommandName<TemplateType>, PREPROCESSOR_JOIN(CommandName##String, __LINE__)>
1646
1656
1666
1676
1686
1687#if WITH_MGPU
1688FRHICOMMAND_MACRO(FRHICommandSetGPUMask)
1689{
1690 FRHIGPUMask GPUMask;
1691 inline FRHICommandSetGPUMask(FRHIGPUMask InGPUMask)
1692 : GPUMask(InGPUMask)
1693 {
1694 }
1696};
1697
1699{
1701
1703 : Params(InParams)
1704 {
1705 }
1706
1708};
1709
1711{
1714
1718 {
1719 }
1720
1722};
1723
1725{
1727
1730 {
1731 }
1732
1734};
1735
1737{
1741
1743 : Params(InParams)
1746 {
1747 }
1748
1750};
1751
1753{
1756
1758 : Params(InParams)
1760 {
1761 }
1762
1764};
1765
1767{
1769
1771 : SyncPoints(InSyncPoints)
1772 {
1773 }
1774
1776};
1777#endif // WITH_MGPU
1778
1788
1813
1826
1828{
1829 uint32 BaseVertexIndex;
1830 uint32 NumPrimitives;
1831 uint32 NumInstances;
1833 : BaseVertexIndex(InBaseVertexIndex)
1834 , NumPrimitives(InNumPrimitives)
1835 , NumInstances(InNumInstances)
1836 {
1837 }
1839};
1840
1842{
1844 int32 BaseVertexIndex;
1845 uint32 FirstInstance;
1846 uint32 NumVertices;
1847 uint32 StartIndex;
1848 uint32 NumPrimitives;
1849 uint32 NumInstances;
1852 , BaseVertexIndex(InBaseVertexIndex)
1853 , FirstInstance(InFirstInstance)
1854 , NumVertices(InNumVertices)
1855 , StartIndex(InStartIndex)
1856 , NumPrimitives(InNumPrimitives)
1857 , NumInstances(InNumInstances)
1858 {
1859 }
1861};
1862
1864{
1865 FLinearColor BlendFactor;
1867 : BlendFactor(InBlendFactor)
1868 {
1869 }
1871};
1872
1874{
1875 uint32 StreamIndex;
1877 uint32 Offset;
1879 : StreamIndex(InStreamIndex)
1881 , Offset(InOffset)
1882 {
1883 }
1885};
1886
1888{
1889 float MinX;
1890 float MinY;
1891 float MinZ;
1892 float MaxX;
1893 float MaxY;
1894 float MaxZ;
1895 inline FRHICommandSetViewport(float InMinX, float InMinY, float InMinZ, float InMaxX, float InMaxY, float InMaxZ)
1896 : MinX(InMinX)
1897 , MinY(InMinY)
1898 , MinZ(InMinZ)
1899 , MaxX(InMaxX)
1900 , MaxY(InMaxY)
1901 , MaxZ(InMaxZ)
1902 {
1903 }
1905};
1906
1908{
1909 float LeftMinX;
1910 float RightMinX;
1911 float LeftMinY;
1912 float RightMinY;
1913 float MinZ;
1914 float LeftMaxX;
1915 float RightMaxX;
1916 float LeftMaxY;
1917 float RightMaxY;
1918 float MaxZ;
1919 inline FRHICommandSetStereoViewport(float InLeftMinX, float InRightMinX, float InLeftMinY, float InRightMinY, float InMinZ, float InLeftMaxX, float InRightMaxX, float InLeftMaxY, float InRightMaxY, float InMaxZ)
1924 , MinZ(InMinZ)
1929 , MaxZ(InMaxZ)
1930 {
1931 }
1933};
1934
1936{
1937 bool bEnable;
1938 uint32 MinX;
1939 uint32 MinY;
1940 uint32 MaxX;
1941 uint32 MaxY;
1943 : bEnable(InbEnable)
1944 , MinX(InMinX)
1945 , MinY(InMinY)
1946 , MaxX(InMaxX)
1947 , MaxY(InMaxY)
1948 {
1949 }
1951};
1952
1954{
1956 const TCHAR* Name;
1957
1959 : Info(InInfo)
1960 , Name(InName)
1961 {
1962 }
1963
1965};
1966
1975
1984
1994
2008
2009#if PLATFORM_USE_FALLBACK_PSO
2011{
2019 {
2020 }
2022};
2023#endif
2024
2026{
2027 uint32 ThreadGroupCountX;
2028 uint32 ThreadGroupCountY;
2029 uint32 ThreadGroupCountZ;
2031 : ThreadGroupCountX(InThreadGroupCountX)
2032 , ThreadGroupCountY(InThreadGroupCountY)
2033 , ThreadGroupCountZ(InThreadGroupCountZ)
2034 {
2035 }
2037};
2038
2040{
2041 FRHIBuffer* ArgumentBuffer;
2042 uint32 ArgumentOffset;
2044 : ArgumentBuffer(InArgumentBuffer)
2045 , ArgumentOffset(InArgumentOffset)
2046 {
2047 }
2049};
2050
2053
2083
2116
2118{
2119 const FUint32Vector4 Constants;
2121 : Constants()
2122 {
2123 }
2126 )
2127 : Constants(InConstants)
2128 {
2129 }
2131};
2132
2137
2142
2149
2156
2158{
2159 FRHIBuffer* ArgumentBuffer;
2160 uint32 ArgumentOffset;
2162 : ArgumentBuffer(InArgumentBuffer)
2163 , ArgumentOffset(InArgumentOffset)
2164 {
2165 }
2167};
2168
2185
2200
2220
2222{
2223 uint32 ThreadGroupCountX;
2224 uint32 ThreadGroupCountY;
2225 uint32 ThreadGroupCountZ;
2226
2228 : ThreadGroupCountX(InThreadGroupCountX)
2229 , ThreadGroupCountY(InThreadGroupCountY)
2230 , ThreadGroupCountZ(InThreadGroupCountZ)
2231 {
2232 }
2234};
2235
2237{
2238 FRHIBuffer* ArgumentBuffer;
2239 uint32 ArgumentOffset;
2240
2242 : ArgumentBuffer(InArgumentBuffer)
2243 , ArgumentOffset(InArgumentOffset)
2244 {
2245 }
2247};
2248
2250{
2251 float MinDepth;
2252 float MaxDepth;
2253
2255 : MinDepth(InMinDepth)
2256 , MaxDepth(InMaxDepth)
2257 {
2258 }
2260};
2261
2267
2269{
2270 EVRSShadingRate ShadingRate;
2271 EVRSRateCombiner Combiner;
2272
2274 : ShadingRate(InShadingRate),
2275 Combiner(InCombiner)
2276 {
2277 }
2279};
2280
2282{
2283 FRHIUnorderedAccessView* UnorderedAccessViewRHI;
2284 FVector4f Values;
2285
2287 : UnorderedAccessViewRHI(InUnorderedAccessViewRHI)
2288 , Values(InValues)
2289 {
2290 }
2292};
2293
2295{
2296 FRHIUnorderedAccessView* UnorderedAccessViewRHI;
2297 FUintVector4 Values;
2298
2300 : UnorderedAccessViewRHI(InUnorderedAccessViewRHI)
2301 , Values(InValues)
2302 {
2303 }
2305};
2306
2308{
2310 FRHITexture* SourceTexture;
2311 FRHITexture* DestTexture;
2312
2315 , SourceTexture(InSourceTexture)
2316 , DestTexture(InDestTexture)
2317 {
2318 ensure(SourceTexture);
2319 ensure(DestTexture);
2320 }
2322};
2323
2325{
2326 FRHITexture* DepthTexture;
2327
2329 : DepthTexture(InDepthTexture)
2330 {
2331 }
2333};
2334
2335FRHICOMMAND_MACRO(FRHICommandBeginTransitions)
2336{
2338
2339 FRHICommandBeginTransitions(TArrayView<const FRHITransition*> InTransitions)
2340 : Transitions(InTransitions)
2341 {
2342 }
2343
2345};
2346
2347FRHICOMMAND_MACRO(FRHICommandEndTransitions)
2348{
2350
2351 FRHICommandEndTransitions(TArrayView<const FRHITransition*> InTransitions)
2352 : Transitions(InTransitions)
2353 {
2354 }
2355
2357};
2358
2359FRHICOMMAND_MACRO(FRHICommandResourceTransition)
2360{
2361 FRHITransition* Transition;
2362
2363 FRHICommandResourceTransition(FRHITransition* InTransition)
2364 : Transition(InTransition)
2365 {
2366 }
2367
2369};
2370
2382
2393
2404
2421
2423{
2424 FRHIGPUFence* Fence;
2425
2427 : Fence(InFence)
2428 {
2429 if (Fence)
2430 {
2432 }
2433 }
2435};
2436
2447
2460
2473
2484
2495
2496#if (RHI_NEW_GPU_PROFILER == 0)
2498{
2500
2503 {
2504 }
2506};
2507#endif
2508
2513
2515{
2516 FRHIViewport* Viewport;
2517 bool bPresent;
2518 bool bLockToVsync;
2519
2521 : Viewport(InViewport)
2523 , bLockToVsync(InbLockToVsync)
2524 {
2525 }
2527};
2528
2530{
2531 FRHIBuffer* DestBuffer;
2532 uint64 DstOffset;
2533 FRHIBuffer* SourceBuffer;
2534 uint64 SrcOffset;
2535 uint64 NumBytes;
2536
2538 : DestBuffer(InDestBuffer)
2539 , DstOffset(InDstOffset)
2540 , SourceBuffer(InSourceBuffer)
2541 , SrcOffset(InSrcOffset)
2542 , NumBytes(InNumBytes)
2543 {}
2544
2546};
2547
2562
2573
2585
2596
2611
2622
2624{
2630 FRHIBuffer* ArgumentBuffer;
2631 uint32 ArgumentOffset;
2632 uint32 Width;
2633 uint32 Height;
2634
2637 , Scene(InScene)
2638 , SBT(nullptr)
2641 , ArgumentBuffer(nullptr)
2642 , ArgumentOffset(0)
2643 , Width(InWidth)
2644 , Height(InHeight)
2645 {}
2646
2649 , Scene(nullptr)
2650 , SBT(InSBT)
2653 , ArgumentBuffer(nullptr)
2654 , ArgumentOffset(0)
2655 , Width(InWidth)
2656 , Height(InHeight)
2657 {}
2658
2661 , Scene(InScene)
2662 , SBT(nullptr)
2665 , ArgumentBuffer(InArgumentBuffer)
2666 , ArgumentOffset(InArgumentOffset)
2667 , Width(0)
2668 , Height(0)
2669 {}
2670
2673 , Scene(nullptr)
2674 , SBT(InSBT)
2677 , ArgumentBuffer(InArgumentBuffer)
2678 , ArgumentOffset(InArgumentOffset)
2679 , Width(0)
2680 , Height(0)
2681 {}
2682
2684};
2685
2719
2720template<> RHI_EXECUTE_API void FRHICommandSetShaderParameters <FRHIComputeShader>::Execute(FRHICommandListBase& CmdList);
2721template<> RHI_EXECUTE_API void FRHICommandSetShaderUnbinds <FRHIComputeShader>::Execute(FRHICommandListBase& CmdList);
2722
2733
2735{
2736protected:
2741
2742 FRHIComputeCommandList(FRHIGPUMask GPUMask, bool bImmediate)
2743 : FRHICommandListBase(GPUMask, bImmediate)
2744 {}
2745
2746public:
2748 {
2749 return static_cast<FRHIComputeCommandList&>(RHICmdList);
2750 }
2751
2755
2759
2760 template <typename LAMBDA>
2761 inline void EnqueueLambda(const TCHAR* LambdaName, LAMBDA&& Lambda)
2762 {
2763 if (IsBottomOfPipe())
2764 {
2765 Lambda(*this);
2766 }
2767 else
2768 {
2770 }
2771 }
2772
2773 // Same as EnqueueLambda, but skips the Insights marker surrounding the lambda. Used by the RHI breadcrumb system.
2774 template <typename LAMBDA>
2775 inline void EnqueueLambda_NoMarker(LAMBDA&& Lambda)
2776 {
2777 if (IsBottomOfPipe())
2778 {
2779 Lambda(*this);
2780 }
2781 else
2782 {
2784 }
2785 }
2786
2787 template <typename LAMBDA>
2788 inline void EnqueueLambda(LAMBDA&& Lambda)
2789 {
2790 FRHIComputeCommandList::EnqueueLambda(TEXT("TRHILambdaCommand"), Forward<LAMBDA>(Lambda));
2791 }
2792
2794
2804
2814
2824
2849
2851 {
2852 if (InBatchedParameters.HasParameters())
2853 {
2855 {
2856 InBatchedParameters.Reset();
2857 };
2858
2859 if (Bypass())
2860 {
2861 GetComputeContext().RHISetShaderParameters(InShader, InBatchedParameters.ParametersData, InBatchedParameters.Parameters, InBatchedParameters.ResourceParameters, InBatchedParameters.BindlessParameters);
2862 return;
2863 }
2864
2868 }
2869 }
2870
2886
2888 {
2889 if (InBatchedUnbinds.HasParameters())
2890 {
2892
2893 InBatchedUnbinds.Reset();
2894 }
2895 }
2896
2908
2910 {
2911 if (Bypass())
2912 {
2914 return;
2915 }
2917 }
2918
2920 {
2921 if (Bypass())
2922 {
2924 return;
2925 }
2927 }
2928
2929 inline void DispatchComputeShader(uint32 ThreadGroupCountX, uint32 ThreadGroupCountY, uint32 ThreadGroupCountZ)
2930 {
2931 if (Bypass())
2932 {
2933 GetComputeContext().RHIDispatchComputeShader(ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ);
2934 return;
2935 }
2936 ALLOC_COMMAND(FRHICommandDispatchComputeShader)(ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ);
2937 }
2938
2939 inline void DispatchIndirectComputeShader(FRHIBuffer* ArgumentBuffer, uint32 ArgumentOffset)
2940 {
2941 if (Bypass())
2942 {
2943 GetComputeContext().RHIDispatchIndirectComputeShader(ArgumentBuffer, ArgumentOffset);
2944 return;
2945 }
2946 ALLOC_COMMAND(FRHICommandDispatchIndirectComputeShader)(ArgumentBuffer, ArgumentOffset);
2947 }
2948
2949 inline void ClearUAVFloat(FRHIUnorderedAccessView* UnorderedAccessViewRHI, const FVector4f& Values)
2950 {
2951 if (Bypass())
2952 {
2953 GetComputeContext().RHIClearUAVFloat(UnorderedAccessViewRHI, Values);
2954 return;
2955 }
2956 ALLOC_COMMAND(FRHICommandClearUAVFloat)(UnorderedAccessViewRHI, Values);
2957 }
2958
2959 inline void ClearUAVUint(FRHIUnorderedAccessView* UnorderedAccessViewRHI, const FUintVector4& Values)
2960 {
2961 if (Bypass())
2962 {
2963 GetComputeContext().RHIClearUAVUint(UnorderedAccessViewRHI, Values);
2964 return;
2965 }
2966 ALLOC_COMMAND(FRHICommandClearUAVUint)(UnorderedAccessViewRHI, Values);
2967 }
2968
2969#if WITH_PROFILEGPU && (RHI_NEW_GPU_PROFILER == 0)
2971#endif
2972
2974 {
2975#if WITH_PROFILEGPU && (RHI_NEW_GPU_PROFILER == 0)
2976 RHI_BREADCRUMB_EVENT_CONDITIONAL(*this, GetGProfileGPUTransitions() != 0, "RHIBeginTransitions");
2977#endif
2978 if (Bypass())
2979 {
2981
2982 for (const FRHITransition* Transition : Transitions)
2983 {
2984 Transition->MarkBegin(GetPipeline());
2985 }
2986 }
2987 else
2988 {
2989 // Copy the transition array into the command list
2990 FRHITransition** DstTransitionArray = (FRHITransition**)Alloc(sizeof(FRHITransition*) * Transitions.Num(), alignof(FRHITransition*));
2991 FMemory::Memcpy(DstTransitionArray, Transitions.GetData(), sizeof(FRHITransition*) * Transitions.Num());
2992 ALLOC_COMMAND(FRHICommandBeginTransitions)(MakeArrayView((const FRHITransition**)DstTransitionArray, Transitions.Num()));
2993 }
2994 }
2995
2997 {
2998#if WITH_PROFILEGPU && (RHI_NEW_GPU_PROFILER == 0)
2999 RHI_BREADCRUMB_EVENT_CONDITIONAL(*this, GetGProfileGPUTransitions() != 0, "RHIEndTransitions");
3000#endif
3001 if (Bypass())
3002 {
3003 GetComputeContext().RHIEndTransitions(Transitions);
3004
3005 for (const FRHITransition* Transition : Transitions)
3006 {
3007 Transition->MarkEnd(GetPipeline());
3008 }
3009 }
3010 else
3011 {
3012 // Copy the transition array into the command list
3013 FRHITransition** DstTransitionArray = (FRHITransition**)Alloc(sizeof(FRHITransition*) * Transitions.Num(), alignof(FRHITransition*));
3014 FMemory::Memcpy(DstTransitionArray, Transitions.GetData(), sizeof(FRHITransition*) * Transitions.Num());
3015
3016 ALLOC_COMMAND(FRHICommandEndTransitions)(MakeArrayView((const FRHITransition**)DstTransitionArray, Transitions.Num()));
3017 }
3018 }
3019
3021
3026
3028 {
3030 }
3031
3033 {
3034 Transition(MakeArrayView(&Info, 1), CreateFlags);
3035 }
3036
3037 //
3038 // Performs an immediate transition with the option of broadcasting to multiple pipelines.
3039 // Uses both the immediate and async compute contexts. Falls back to graphics-only if async compute is not supported.
3040 //
3042
3044 {
3045 if (Bypass())
3046 {
3047 for (const FRHITrackedAccessInfo& Info : Infos)
3048 {
3050 }
3051 }
3052 else
3053 {
3055 RHIThreadFence(true);
3056 }
3057 }
3058
3060 {
3063
3064 for (const FRHITransitionInfo& Info : Infos)
3065 {
3066 ensureMsgf(Info.IsWholeResource(), TEXT("The Transition method only supports whole resource transitions."));
3067
3069 {
3070 new (&TrackedAccessInfos[NumTrackedAccessInfos++]) FRHITrackedAccessInfo(Resource, Info.AccessAfter, PipelinesAfter);
3071 }
3072 }
3073
3074 if (NumTrackedAccessInfos > 0)
3075 {
3077 }
3078 }
3079
3080 inline void SetShaderRootConstants(const FUint32Vector4& Constants)
3081 {
3082 if (Bypass())
3083 {
3085 return;
3086 }
3088 }
3089
3090 inline void SetComputeShaderRootConstants(const FUint32Vector4& Constants)
3091 {
3092 if (Bypass())
3093 {
3095 return;
3096 }
3098 }
3099
3118
3121 )
3122 {
3123 bUsesShaderBundles = true;
3124
3125 // Need to explicitly enqueue the RHI command so we can avoid an unnecessary copy of the dispatches array.
3126 if (Bypass())
3127 {
3130 DispatchBundleCommand.Execute(*this);
3131 }
3132 else
3133 {
3137 }
3138 }
3139
3158
3161 )
3162 {
3163 bUsesShaderBundles = true;
3164
3165 // Need to explicitly enqueue the RHI command so we can avoid an unnecessary copy of the dispatches array.
3166 if (Bypass())
3167 {
3170 DispatchBundleCommand.Execute(*this);
3171 }
3172 else
3173 {
3176 }
3177 }
3178
3179 inline void BeginUAVOverlap()
3180 {
3181 if (Bypass())
3182 {
3184 return;
3185 }
3187 }
3188
3189 inline void EndUAVOverlap()
3190 {
3191 if (Bypass())
3192 {
3194 return;
3195 }
3197 }
3198
3200 {
3201 FRHIUnorderedAccessView* UAVs[1] = { UAV };
3203 }
3204
3206 {
3207 FRHIUnorderedAccessView* UAVs[1] = { UAV };
3208 EndUAVOverlap(MakeArrayView(UAVs, 1));
3209 }
3210
3212 {
3213 if (Bypass())
3214 {
3216 return;
3217 }
3218
3219 const uint32 AllocSize = UAVs.Num() * sizeof(FRHIUnorderedAccessView*);
3221 FMemory::Memcpy(InlineUAVs, UAVs.GetData(), AllocSize);
3223 }
3224
3226 {
3227 if (Bypass())
3228 {
3230 return;
3231 }
3232
3233 const uint32 AllocSize = UAVs.Num() * sizeof(FRHIUnorderedAccessView*);
3235 FMemory::Memcpy(InlineUAVs, UAVs.GetData(), AllocSize);
3237 }
3238
3239#if WITH_RHI_BREADCRUMBS
3241 {
3242 if (!BreadcrumbAllocator.IsValid())
3243 {
3245 }
3246
3247 return *BreadcrumbAllocator;
3248 }
3249
3251 {
3252 check(Breadcrumb && Breadcrumb != FRHIBreadcrumbNode::Sentinel);
3253 BreadcrumbAllocatorRefs.AddUnique(Breadcrumb->Allocator);
3254
3255 if (IsTopOfPipe())
3256 {
3257 // Recording thread
3258 Breadcrumb->TraceBeginCPU();
3259 PersistentState.LocalBreadcrumb = Breadcrumb;
3260
3261 if (bLink)
3262 {
3264
3265 if (Breadcrumb->GetParent() == FRHIBreadcrumbNode::Sentinel)
3266 {
3267 CPUBreadcrumbState.UnknownParentList.Append(Breadcrumb);
3268 }
3269 }
3270 }
3271
3273 {
3274 // Translating thread
3275 ExecutingCmdList.PersistentState.LocalBreadcrumb = Breadcrumb;
3276
3277 if (bLink)
3278 {
3279 ExecutingCmdList.CPUBreadcrumbState.Current = Breadcrumb;
3280 Breadcrumb->TraceBeginCPU();
3281 }
3282 });
3283 }
3284
3286 {
3287 check(Breadcrumb && Breadcrumb != FRHIBreadcrumbNode::Sentinel);
3288 BreadcrumbAllocatorRefs.AddUnique(Breadcrumb->Allocator);
3289
3290 if (IsTopOfPipe())
3291 {
3292 // Recording thread
3293 Breadcrumb->TraceEndCPU();
3294 PersistentState.LocalBreadcrumb = Breadcrumb->GetParent();
3295
3296 if (bLink)
3297 {
3298 CPUBreadcrumbState.Current = Breadcrumb->GetParent();
3299 }
3300 }
3301
3303 {
3304 // Translating thread
3305 ExecutingCmdList.PersistentState.LocalBreadcrumb = Breadcrumb->GetParent();
3306 check(ExecutingCmdList.PersistentState.LocalBreadcrumb != FRHIBreadcrumbNode::Sentinel);
3307
3308 if (bLink)
3309 {
3310 ExecutingCmdList.CPUBreadcrumbState.Current = Breadcrumb->GetParent();
3311 check(ExecutingCmdList.CPUBreadcrumbState.Current != FRHIBreadcrumbNode::Sentinel);
3312
3313 Breadcrumb->TraceEndCPU();
3314 }
3315 });
3316 }
3317
3319 {
3320 check(Breadcrumb && Breadcrumb != FRHIBreadcrumbNode::Sentinel);
3323#if DO_CHECK
3324 check(!EnumHasAnyFlags(ERHIPipeline(Breadcrumb->BeginPipes.fetch_or(std::underlying_type_t<ERHIPipeline>(Pipeline))), Pipeline));
3325#endif
3326
3327 BreadcrumbAllocatorRefs.AddUnique(Breadcrumb->Allocator);
3328
3330 State.Current = Breadcrumb;
3331 State.Latest = Breadcrumb;
3332
3333 EnqueueLambda(TEXT("BeginBreadcrumbGPU"), [Breadcrumb, Pipeline](FRHICommandListBase& ExecutingCmdList)
3334 {
3335 auto& State = ExecutingCmdList.GPUBreadcrumbState[Pipeline];
3336
3337 State.Range.InsertAfter(Breadcrumb, State.Prev, Pipeline);
3338 State.Prev = Breadcrumb;
3339
3340 State.Current = Breadcrumb;
3341 State.Latest = Breadcrumb;
3342
3343 ExecutingCmdList.Contexts[Pipeline]->RHIBeginBreadcrumbGPU(Breadcrumb);
3344 });
3345 }
3346
3348 {
3349 check(Breadcrumb && Breadcrumb != FRHIBreadcrumbNode::Sentinel);
3352#if DO_CHECK
3353 check(!EnumHasAnyFlags(ERHIPipeline(Breadcrumb->EndPipes.fetch_or(std::underlying_type_t<ERHIPipeline>(Pipeline))), Pipeline));
3354#endif
3355
3356 BreadcrumbAllocatorRefs.AddUnique(Breadcrumb->Allocator);
3357
3359 State.Current = Breadcrumb->GetParent();
3360 State.Latest = Breadcrumb->GetParent();
3361
3362 EnqueueLambda(TEXT("EndBreadcrumbGPU"), [Breadcrumb, Pipeline](FRHICommandListBase& ExecutingCmdList)
3363 {
3364 auto& State = ExecutingCmdList.GPUBreadcrumbState[Pipeline];
3365
3366 State.Current = Breadcrumb->GetParent();
3367 check(State.Current != FRHIBreadcrumbNode::Sentinel);
3368
3369 State.Latest = Breadcrumb->GetParent();
3370 check(State.Latest != FRHIBreadcrumbNode::Sentinel);
3371
3372 ExecutingCmdList.Contexts[Pipeline]->RHIEndBreadcrumbGPU(Breadcrumb);
3373 });
3374 }
3375#endif // WITH_RHI_BREADCRUMBS
3376
3377 //UE_DEPRECATED(5.1, "SubmitCommandsHint is deprecated, and has no effect if called on a non-immediate RHI command list. Consider calling ImmediateFlush(EImmediateFlushType::DispatchToRHIThread) on the immediate command list instead.")
3378 inline void SubmitCommandsHint();
3379
3381 {
3382 if (Bypass())
3383 {
3385 return;
3386 }
3388 }
3389
3390 inline void WriteGPUFence(FRHIGPUFence* Fence)
3391 {
3393 }
3394
3396 {
3398 {
3400#if WITH_MGPU
3401 if (Bypass())
3402 {
3403 // Apply the new mask to all contexts owned by this command list.
3405 {
3406 if (Context)
3407 {
3408 Context->RHISetGPUMask(PersistentState.CurrentGPUMask);
3409 }
3410 }
3411 return;
3412 }
3413 else
3414 {
3416 }
3417#endif // WITH_MGPU
3418 }
3419 }
3420
3422 {
3423#if WITH_MGPU
3424 FRHIGPUMask PrevGPUMask = GetGPUMask();
3425
3427 {
3428 for (const FTransferResourceParams& Param : Params)
3429 {
3430 FRHIGPUMask GPUMaskSrc = FRHIGPUMask::FromIndex(Param.SrcGPUIndex);
3431 FRHIGPUMask GPUMaskDest = FRHIGPUMask::FromIndex(Param.DestGPUIndex);
3432
3433 if (Param.Texture)
3434 {
3438
3442
3443 }
3444 else
3445 {
3452 }
3453 }
3454 }
3455
3456 SetGPUMask(PrevGPUMask);
3457
3458 if (Bypass())
3459 {
3460 GetComputeContext().RHITransferResources(Params);
3461 }
3462 else
3463 {
3465 }
3466
3468 {
3469 for (const FTransferResourceParams& Param : Params)
3470 {
3471 FRHIGPUMask GPUMaskSrc = FRHIGPUMask::FromIndex(Param.SrcGPUIndex);
3472 FRHIGPUMask GPUMaskDest = FRHIGPUMask::FromIndex(Param.DestGPUIndex);
3473
3474 if (Param.Texture)
3475 {
3479
3483
3484 }
3485 else
3486 {
3490
3494 }
3495 }
3496 }
3497
3498 SetGPUMask(PrevGPUMask);
3499
3500#endif // WITH_MGPU
3501 }
3502
3504 {
3505#if WITH_MGPU
3506 if (Bypass())
3507 {
3508 GetComputeContext().RHITransferResourceSignal(FenceDatas, SrcGPUMask);
3509 }
3510 else
3511 {
3513 }
3514#endif // WITH_MGPU
3515 }
3516
3518 {
3519#if WITH_MGPU
3520 if (Bypass())
3521 {
3522 GetComputeContext().RHITransferResourceWait(FenceDatas);
3523 }
3524 else
3525 {
3527 }
3528#endif // WITH_MGPU
3529 }
3530
3532 {
3533#if WITH_MGPU
3534 FRHIGPUMask PrevGPUMask = GetGPUMask();
3535
3537 {
3538 for (const FTransferResourceParams& Param : Params)
3539 {
3540 FRHIGPUMask GPUMask = FRHIGPUMask::FromIndex(Param.SrcGPUIndex);
3541 SetGPUMask(GPUMask);
3542
3543 if (Param.Texture)
3544 {
3545
3548 }
3549 else
3550 {
3553 }
3554 }
3555 }
3556
3557 SetGPUMask(PrevGPUMask);
3558
3559 if (Bypass())
3560 {
3561 GetComputeContext().RHICrossGPUTransfer(Params, PreTransfer, PostTransfer);
3562 }
3563 else
3564 {
3566 }
3567
3569 {
3570 for (const FTransferResourceParams& Param : Params)
3571 {
3572 FRHIGPUMask GPUMask = FRHIGPUMask::FromIndex(Param.SrcGPUIndex);
3573 SetGPUMask(GPUMask);
3574
3575 if (Param.Texture)
3576 {
3579 }
3580 else
3581 {
3584 }
3585 }
3586 }
3587
3588 SetGPUMask(PrevGPUMask);
3589
3590#endif // WITH_MGPU
3591 }
3592
3594 {
3595#if WITH_MGPU
3596
3597 FRHIGPUMask PrevGPUMask = GetGPUMask();
3598
3600 {
3601 for (const FTransferResourceParams& Param : Params)
3602 {
3603 FRHIGPUMask GPUMask = FRHIGPUMask::FromIndex(Param.DestGPUIndex);
3604 SetGPUMask(GPUMask);
3605
3606 if (Param.Texture)
3607 {
3610 }
3611 else
3612 {
3615 }
3616 }
3617 }
3618
3619 SetGPUMask(PrevGPUMask);
3620
3621 if (Bypass())
3622 {
3623 GetComputeContext().RHICrossGPUTransferSignal(Params, PreTransfer);
3624 }
3625 else
3626 {
3628 }
3629
3631 {
3632 for (const FTransferResourceParams& Param : Params)
3633 {
3634 FRHIGPUMask GPUMask = FRHIGPUMask::FromIndex(Param.DestGPUIndex);
3635 SetGPUMask(GPUMask);
3636
3637 if (Param.Texture)
3638 {
3641 }
3642 else
3643 {
3646 }
3647 }
3648 }
3649
3650 SetGPUMask(PrevGPUMask);
3651#endif // WITH_MGPU
3652 }
3653
3655 {
3656#if WITH_MGPU
3657 if (Bypass())
3658 {
3659 GetComputeContext().RHICrossGPUTransferWait(SyncPoints);
3660 }
3661 else
3662 {
3664 }
3665#endif // WITH_MGPU
3666 }
3667
3680
3681 /*
3682 * Compatibility adaptor that operates on the new FRHIBatchedShaderParameters instead of legacy FRayTracingShaderBindings (planned for deprecation).
3683 * This will become the default native code path in a future UE version.
3684 */
3686
3699
3700 /*
3701 * Compatibility adaptor that operates on the new FRHIBatchedShaderParameters instead of legacy FRayTracingShaderBindings (planned for deprecation).
3702 * This will become the default native code path in a future UE version.
3703 */
3705
3718
3721
3723 {
3724 if (Bypass())
3725 {
3727 }
3728 else
3729 {
3730 // Copy the params themselves as well their segment lists, if there are any.
3731 // AllocArray() can't be used here directly, as we have to modify the params after copy.
3732 size_t DataSize = sizeof(FRayTracingGeometryBuildParams) * Params.Num();
3734 FMemory::Memcpy(InlineParams, Params.GetData(), DataSize);
3735 for (int32 i=0; i<Params.Num(); ++i)
3736 {
3737 if (Params[i].Segments.Num())
3738 {
3739 InlineParams[i].Segments = AllocArray(Params[i].Segments);
3740 }
3741 }
3743
3744 RHIThreadFence(true);
3745 }
3746 }
3747
3752
3754 {
3755 if (Bypass())
3756 {
3758 }
3759 else
3760 {
3761 // Copy the params themselves as well their ReferencedGeometries, if there are any.
3762 // AllocArray() can't be used here directly, as we have to modify the params after copy.
3763 size_t DataSize = sizeof(FRayTracingSceneBuildParams) * Params.Num();
3765 FMemory::Memcpy(InlineParams, Params.GetData(), DataSize);
3766 for (int32 Index = 0; Index < Params.Num(); ++Index)
3767 {
3768 if (Params[Index].ReferencedGeometries.Num())
3769 {
3770 InlineParams[Index].ReferencedGeometries = AllocArray(Params[Index].ReferencedGeometries);
3771 }
3773 if (Params[Index].PerInstanceGeometries.Num())
3774 {
3775 InlineParams[Index].PerInstanceGeometries = AllocArray(Params[Index].PerInstanceGeometries);
3776 }
3778 }
3779
3781
3782 // This RHI command modifies members of the FRHIRayTracingScene inside platform RHI implementations.
3783 // It therefore needs the RHI lock fence to prevent races on those members.
3784 RHIThreadFence(true);
3785 }
3786 }
3787
3789 {
3790 if (Bypass())
3791 {
3793 }
3794 else
3795 {
3797
3798 // This RHI command modifies members of the FRHIRayTracingScene inside platform RHI implementations.
3799 // It therefore needs the RHI lock fence to prevent races on those members.
3800 RHIThreadFence(true);
3801 }
3802 }
3803
3805 {
3806 if (Bypass())
3807 {
3809 return;
3810 }
3812 }
3813};
3814
3815template<> RHI_EXECUTE_API void FRHICommandSetShaderParameters <FRHIGraphicsShader>::Execute(FRHICommandListBase& CmdList);
3816template<> RHI_EXECUTE_API void FRHICommandSetShaderUnbinds <FRHIGraphicsShader>::Execute(FRHICommandListBase& CmdList);
3817
3819{
3820protected:
3822
3827
3828 FRHICommandList(FRHIGPUMask GPUMask, bool bImmediate)
3829 : FRHIComputeCommandList(GPUMask, bImmediate)
3830 {}
3831
3832public:
3833 static inline FRHICommandList& Get(FRHICommandListBase& RHICmdList)
3834 {
3835 return static_cast<FRHICommandList&>(RHICmdList);
3836 }
3837
3841
3845
3851
3852 template <typename LAMBDA>
3853 inline void EnqueueLambda(const TCHAR* LambdaName, LAMBDA&& Lambda)
3854 {
3855 if (IsBottomOfPipe())
3856 {
3857 Lambda(*this);
3858 }
3859 else
3860 {
3862 }
3863 }
3864
3865 template <typename LAMBDA>
3866 inline void EnqueueLambda(LAMBDA&& Lambda)
3867 {
3868 FRHICommandList::EnqueueLambda(TEXT("TRHILambdaCommand"), Forward<LAMBDA>(Lambda));
3869 }
3870
3872
3897
3899
3901 {
3902 if (InBatchedParameters.HasParameters())
3903 {
3905 {
3906 InBatchedParameters.Reset();
3907 };
3908
3909 if (Bypass())
3910 {
3911 GetContext().RHISetShaderParameters(InShader, InBatchedParameters.ParametersData, InBatchedParameters.Parameters, InBatchedParameters.ResourceParameters, InBatchedParameters.BindlessParameters);
3912 return;
3913 }
3914
3918 }
3919 }
3920
3922
3938
3940
3942 {
3943 if (InBatchedUnbinds.HasParameters())
3944 {
3946
3947 InBatchedUnbinds.Reset();
3948 }
3949 }
3950
3951 inline void SetBlendFactor(const FLinearColor& BlendFactor = FLinearColor::White)
3952 {
3953 //check(IsOutsideRenderPass());
3954 if (Bypass())
3955 {
3956 GetContext().RHISetBlendFactor(BlendFactor);
3957 return;
3958 }
3960 }
3961
3962 inline void DrawPrimitive(uint32 BaseVertexIndex, uint32 NumPrimitives, uint32 NumInstances)
3963 {
3964 //check(IsOutsideRenderPass());
3965 if (Bypass())
3966 {
3967 GetContext().RHIDrawPrimitive(BaseVertexIndex, NumPrimitives, NumInstances);
3968 return;
3969 }
3970 ALLOC_COMMAND(FRHICommandDrawPrimitive)(BaseVertexIndex, NumPrimitives, NumInstances);
3971 }
3972
3973 inline void DrawIndexedPrimitive(FRHIBuffer* IndexBuffer, int32 BaseVertexIndex, uint32 FirstInstance, uint32 NumVertices, uint32 StartIndex, uint32 NumPrimitives, uint32 NumInstances)
3974 {
3975 //check(IsOutsideRenderPass());
3976 if (Bypass())
3977 {
3978 GetContext().RHIDrawIndexedPrimitive(IndexBuffer, BaseVertexIndex, FirstInstance, NumVertices, StartIndex, NumPrimitives, NumInstances);
3979 return;
3980 }
3981 ALLOC_COMMAND(FRHICommandDrawIndexedPrimitive)(IndexBuffer, BaseVertexIndex, FirstInstance, NumVertices, StartIndex, NumPrimitives, NumInstances);
3982 }
3983
3985 {
3986 if (Bypass())
3987 {
3989 return;
3990 }
3992 }
3993
3994 inline void SetStreamSourceSlot(uint32 StreamIndex, FRHIStreamSourceSlot* StreamSourceSlot, uint32 Offset)
3995 {
3996 EnqueueLambda([StreamIndex, StreamSourceSlot, Offset] (FRHICommandListBase& RHICmdList)
3997 {
3998 FRHICommandSetStreamSource Command(StreamIndex, StreamSourceSlot ? StreamSourceSlot->Buffer : nullptr, Offset);
3999 Command.Execute(RHICmdList);
4000 });
4001 }
4002
4004 {
4005 //check(IsOutsideRenderPass());
4006 if (Bypass())
4007 {
4009 return;
4010 }
4011
4013 }
4014
4015 inline void SetViewport(float MinX, float MinY, float MinZ, float MaxX, float MaxY, float MaxZ)
4016 {
4017 //check(IsOutsideRenderPass());
4018 if (Bypass())
4019 {
4020 GetContext().RHISetViewport(MinX, MinY, MinZ, MaxX, MaxY, MaxZ);
4021 return;
4022 }
4023 ALLOC_COMMAND(FRHICommandSetViewport)(MinX, MinY, MinZ, MaxX, MaxY, MaxZ);
4024 }
4025
4026 inline void SetStereoViewport(float LeftMinX, float RightMinX, float LeftMinY, float RightMinY, float MinZ, float LeftMaxX, float RightMaxX, float LeftMaxY, float RightMaxY, float MaxZ)
4027 {
4028 //check(IsOutsideRenderPass());
4029 if (Bypass())
4030 {
4032 return;
4033 }
4035 }
4036
4037 inline void SetScissorRect(bool bEnable, uint32 MinX, uint32 MinY, uint32 MaxX, uint32 MaxY)
4038 {
4039 //check(IsOutsideRenderPass());
4040 if (Bypass())
4041 {
4042 GetContext().RHISetScissorRect(bEnable, MinX, MinY, MaxX, MaxY);
4043 return;
4044 }
4045 ALLOC_COMMAND(FRHICommandSetScissorRect)(bEnable, MinX, MinY, MaxX, MaxY);
4046 }
4047
4049 FGraphicsPipelineStateInitializer& GraphicsPSOInit
4050 )
4051 {
4053
4054 for (uint32 i = 0; i < GraphicsPSOInit.RenderTargetsEnabled; ++i)
4055 {
4056 if (PersistentState.CachedRenderTargets[i].Texture)
4057 {
4058 GraphicsPSOInit.RenderTargetFormats[i] = UE_PIXELFORMAT_TO_UINT8(PersistentState.CachedRenderTargets[i].Texture->GetFormat());
4059 GraphicsPSOInit.RenderTargetFlags[i] = PersistentState.CachedRenderTargets[i].Texture->GetFlags();
4060 }
4061 else
4062 {
4063 GraphicsPSOInit.RenderTargetFormats[i] = PF_Unknown;
4064 }
4065
4066 if (GraphicsPSOInit.RenderTargetFormats[i] != PF_Unknown)
4067 {
4068 GraphicsPSOInit.NumSamples = static_cast<uint16>(PersistentState.CachedRenderTargets[i].Texture->GetNumSamples());
4069 }
4070 }
4071
4073 {
4077 }
4078 else
4079 {
4080 GraphicsPSOInit.DepthStencilTargetFormat = PF_Unknown;
4081 }
4082
4088
4089 if (GraphicsPSOInit.DepthStencilTargetFormat != PF_Unknown)
4090 {
4092 }
4093
4094 GraphicsPSOInit.SubpassHint = PersistentState.SubpassHint;
4095 GraphicsPSOInit.SubpassIndex = PersistentState.SubpassIndex;
4098 }
4099
4112
4113#if PLATFORM_USE_FALLBACK_PSO
4115 {
4116 //check(IsOutsideRenderPass());
4117 OnBoundShaderChanged(PsoInit.BoundShaderState);
4118 if (Bypass())
4119 {
4121 return;
4122 }
4124 }
4125#endif
4126
4127 inline void DrawPrimitiveIndirect(FRHIBuffer* ArgumentBuffer, uint32 ArgumentOffset)
4128 {
4129 //check(IsOutsideRenderPass());
4130 if (Bypass())
4131 {
4132 GetContext().RHIDrawPrimitiveIndirect(ArgumentBuffer, ArgumentOffset);
4133 return;
4134 }
4135 ALLOC_COMMAND(FRHICommandDrawPrimitiveIndirect)(ArgumentBuffer, ArgumentOffset);
4136 }
4137
4139 {
4140 //check(IsOutsideRenderPass());
4141 if (Bypass())
4142 {
4144 return;
4145 }
4147 }
4148
4159
4160 inline void DispatchMeshShader(uint32 ThreadGroupCountX, uint32 ThreadGroupCountY, uint32 ThreadGroupCountZ)
4161 {
4162 if (Bypass())
4163 {
4164 GetContext().RHIDispatchMeshShader(ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ);
4165 return;
4166 }
4167 ALLOC_COMMAND(FRHICommandDispatchMeshShader)(ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ);
4168 }
4169
4170 inline void DispatchIndirectMeshShader(FRHIBuffer* ArgumentBuffer, uint32 ArgumentOffset)
4171 {
4172 if (Bypass())
4173 {
4174 GetContext().RHIDispatchIndirectMeshShader(ArgumentBuffer, ArgumentOffset);
4175 return;
4176 }
4177 ALLOC_COMMAND(FRHICommandDispatchIndirectMeshShader)(ArgumentBuffer, ArgumentOffset);
4178 }
4179
4180 inline void SetDepthBounds(float MinDepth, float MaxDepth)
4181 {
4182 //check(IsOutsideRenderPass());
4183 if (Bypass())
4184 {
4185 GetContext().RHISetDepthBounds(MinDepth, MaxDepth);
4186 return;
4187 }
4188 ALLOC_COMMAND(FRHICommandSetDepthBounds)(MinDepth, MaxDepth);
4189 }
4190
4192 {
4193 if (Bypass())
4194 {
4196 return;
4197 }
4199 }
4200
4201 inline void SetShadingRate(EVRSShadingRate ShadingRate, EVRSRateCombiner Combiner)
4202 {
4203#if PLATFORM_SUPPORTS_VARIABLE_RATE_SHADING
4204 if (Bypass())
4205 {
4206 GetContext().RHISetShadingRate(ShadingRate, Combiner);
4207 return;
4208 }
4209 ALLOC_COMMAND(FRHICommandSetShadingRate)(ShadingRate, Combiner);
4210#endif
4211 }
4212
4226
4227 inline void ResummarizeHTile(FRHITexture* DepthTexture)
4228 {
4229 if (Bypass())
4230 {
4231 GetContext().RHIResummarizeHTile(DepthTexture);
4232 return;
4233 }
4235 }
4236
4241
4246
4247#if (RHI_NEW_GPU_PROFILER == 0)
4248 inline void CalibrateTimers(FRHITimestampCalibrationQuery* CalibrationQuery)
4249 {
4250 if (Bypass())
4251 {
4252 GetContext().RHICalibrateTimers(CalibrationQuery);
4253 return;
4254 }
4256 }
4257#endif
4258
4260 {
4263
4264 InInfo.Validate();
4265
4266 if (Bypass())
4267 {
4269 }
4270 else
4271 {
4272 // Copy the transition array into the command list
4275
4278 }
4279
4281 ResetSubpass(InInfo.SubpassHint);
4283
4284 if (InInfo.NumOcclusionQueries)
4285 {
4288 }
4289 }
4290
4313
4314 // Takes the array of sub command lists and inserts them logically into a render pass at this point in time.
4319
4320 inline void NextSubpass()
4321 {
4323 if (Bypass())
4324 {
4326 }
4327 else
4328 {
4330 }
4332 }
4333
4334 inline void CopyBufferRegion(FRHIBuffer* DestBuffer, uint64 DstOffset, FRHIBuffer* SourceBuffer, uint64 SrcOffset, uint64 NumBytes)
4335 {
4336 // No copy/DMA operation inside render passes
4338
4339 RHI_BREADCRUMB_CHECK_SHIPPING(*this, SourceBuffer != DestBuffer);
4340 RHI_BREADCRUMB_CHECK_SHIPPING(*this, DstOffset + NumBytes <= DestBuffer->GetSize());
4341 RHI_BREADCRUMB_CHECK_SHIPPING(*this, SrcOffset + NumBytes <= SourceBuffer->GetSize());
4342
4343 if (Bypass())
4344 {
4345 GetContext().RHICopyBufferRegion(DestBuffer, DstOffset, SourceBuffer, SrcOffset, NumBytes);
4346 }
4347 else
4348 {
4349 ALLOC_COMMAND(FRHICommandCopyBufferRegion)(DestBuffer, DstOffset, SourceBuffer, SrcOffset, NumBytes);
4350 }
4351 }
4352
4353 // Ray tracing API
4354
4356 {
4357 checkf(!EnumHasAnyFlags(SBT->GetInitializer().ShaderBindingMode, ERayTracingShaderBindingMode::Inline), TEXT("Use CommitShaderBindingTable function which also provides the InlineBindingDataBuffer when SBT has inline binding mode set"));
4358 CommitShaderBindingTable(SBT, nullptr);
4359 }
4360
4362 {
4363 if (Bypass())
4364 {
4366 }
4367 else
4368 {
4370
4371 // This RHI command modifies members of the FRHIShaderBindingTable inside platform RHI implementations.
4372 // It therefore needs the RHI lock fence to prevent races on those members.
4373 RHIThreadFence(true);
4374 }
4375 }
4376
4378 {
4379 if (Bypass())
4380 {
4382 }
4383 else
4384 {
4386
4387 // This RHI command modifies members of the FRHIShaderBindingTable inside platform RHI implementations.
4388 // It therefore needs the RHI lock fence to prevent races on those members.
4389 RHIThreadFence(true);
4390 }
4391 }
4392
4396 ERayTracingBindingType BindingType,
4397 bool bCopyDataToInlineStorage = true)
4398 {
4399 if (Bypass())
4400 {
4402 }
4403 else
4404 {
4405 check(GetRHIRayTracingPipelineStateMaxLocalBindingDataSize(Pipeline) <= SBT->GetInitializer().LocalBindingDataSize);
4406
4408
4409 // By default all batch binding data is stored in the command list memory.
4410 // However, user may skip this copy if they take responsibility for keeping data alive until this command is executed.
4412 {
4413 if (NumBindings)
4414 {
4418 }
4419
4420 for (uint32 i = 0; i < NumBindings; ++i)
4421 {
4422 if (InlineBindings[i].NumUniformBuffers)
4423 {
4424 InlineBindings[i].UniformBuffers = (FRHIUniformBuffer**)Alloc(sizeof(FRHIUniformBuffer*) * InlineBindings[i].NumUniformBuffers, alignof(FRHIUniformBuffer*));
4425 for (uint32 Index = 0; Index < InlineBindings[i].NumUniformBuffers; ++Index)
4426 {
4427 InlineBindings[i].UniformBuffers[Index] = Bindings[i].UniformBuffers[Index];
4428 }
4429 }
4430
4431 if (InlineBindings[i].LooseParameterDataSize)
4432 {
4433 InlineBindings[i].LooseParameterData = (uint8*)Alloc(InlineBindings[i].LooseParameterDataSize, 16);
4434 FMemory::Memcpy(InlineBindings[i].LooseParameterData, Bindings[i].LooseParameterData, InlineBindings[i].LooseParameterDataSize);
4435 }
4436 }
4437
4439 }
4440 else
4441 {
4443 }
4444
4445 RHIThreadFence(true);
4446 }
4447 }
4448
4456
4464
4472
4474 FRHIShaderBindingTable* SBT, uint32 RecordIndex, FRHIRayTracingGeometry* Geometry, uint32 GeometrySegmentIndex,
4476 uint32 NumUniformBuffers, FRHIUniformBuffer* const* UniformBuffers,
4477 uint32 LooseParameterDataSize, const void* LooseParameterData,
4478 uint32 UserData)
4479 {
4480 check(NumUniformBuffers <= UINT16_MAX);
4481 check(LooseParameterDataSize <= UINT16_MAX);
4482
4484 InlineBindings->RecordIndex = RecordIndex;
4485 InlineBindings->Geometry = Geometry;
4486 InlineBindings->SegmentIndex = GeometrySegmentIndex;
4487 InlineBindings->ShaderIndexInPipeline = HitGroupIndex;
4488 InlineBindings->UserData = UserData;
4489 InlineBindings->NumUniformBuffers = (uint16)NumUniformBuffers;
4490 InlineBindings->LooseParameterDataSize = (uint16)LooseParameterDataSize;
4491
4492 if (NumUniformBuffers)
4493 {
4494 InlineBindings->UniformBuffers = (FRHIUniformBuffer**)Alloc(sizeof(FRHIUniformBuffer*) * NumUniformBuffers, alignof(FRHIUniformBuffer*));
4495 for (uint32 Index = 0; Index < NumUniformBuffers; ++Index)
4496 {
4497 InlineBindings->UniformBuffers[Index] = UniformBuffers[Index];
4498 }
4499 }
4500
4501 if (LooseParameterDataSize)
4502 {
4503 InlineBindings->LooseParameterData = (uint8*)Alloc(LooseParameterDataSize, 16);
4504 FMemory::Memcpy(InlineBindings->LooseParameterData, LooseParameterData, LooseParameterDataSize);
4505 }
4506
4508 }
4509
4519
4521 FRHIShaderBindingTable* SBT, uint32 RecordIndex,
4522 FRayTracingPipelineState* Pipeline, uint32 ShaderIndexInPipeline,
4523 uint32 NumUniformBuffers, FRHIUniformBuffer* const* UniformBuffers,
4524 uint32 UserData)
4525 {
4527 InlineBindings->RecordIndex = RecordIndex;
4528 InlineBindings->ShaderIndexInPipeline = ShaderIndexInPipeline;
4529 InlineBindings->UserData = UserData;
4530 InlineBindings->NumUniformBuffers = (uint16)NumUniformBuffers;
4531
4532 if (NumUniformBuffers)
4533 {
4534 InlineBindings->UniformBuffers = (FRHIUniformBuffer**)Alloc(sizeof(FRHIUniformBuffer*) * NumUniformBuffers, alignof(FRHIUniformBuffer*));
4535 for (uint32 Index = 0; Index < NumUniformBuffers; ++Index)
4536 {
4537 InlineBindings->UniformBuffers[Index] = UniformBuffers[Index];
4538 }
4539 }
4540
4542 }
4543
4545 FRHIShaderBindingTable* SBT, uint32 RecordIndex,
4546 FRayTracingPipelineState* Pipeline, uint32 ShaderIndexInPipeline,
4547 uint32 NumUniformBuffers, FRHIUniformBuffer* const* UniformBuffers,
4548 uint32 UserData)
4549 {
4551 InlineBindings->RecordIndex = RecordIndex;
4552 InlineBindings->ShaderIndexInPipeline = ShaderIndexInPipeline;
4553 InlineBindings->UserData = UserData;
4554 InlineBindings->NumUniformBuffers = (uint16)NumUniformBuffers;
4555
4556 if (NumUniformBuffers)
4557 {
4559 InlineBindings->UniformBuffers = (FRHIUniformBuffer**)Alloc(sizeof(FRHIUniformBuffer*) * NumUniformBuffers, alignof(FRHIUniformBuffer*));
4560 for (uint32 Index = 0; Index < NumUniformBuffers; ++Index)
4561 {
4562 InlineBindings->UniformBuffers[Index] = UniformBuffers[Index];
4563 }
4564 }
4565
4567 }
4568};
4569
4580
4582{
4583 class FRHICommandListImmediate* Immed; // non-null if we need to unstall
4584public:
4588};
4589
4592
4594{
4595 None = 0,
4596
4597 // All submitted work will be processed, and the resulting platform command lists will be submitted to the GPU.
4598 SubmitToGPU = 1 << 0,
4599
4600 // Processes the delete queue until it is empty.
4601 DeleteResources = 1 << 1,
4602
4603 // Indicates that the entire RHI thread pipeline will be flushed.
4604 // If combined with DeleteResources, the pending deletes queue is processed in a loop until all released resources have been deleted.
4605 FlushRHIThread = 1 << 2,
4606
4607 // Marks the end of an engine frame. Causes RHI draw stats etc to be accumulated,
4608 // and calls RHIEndFrame for platform RHIs to do various cleanup tasks.
4609 EndFrame = 1 << 3,
4610
4611#if CAN_TOGGLE_COMMAND_LIST_BYPASS
4612 // Used when toggling RHI command bypass.
4613 EnableBypass = 1 << 4,
4614 DisableBypass = 1 << 5,
4615#endif
4616
4617#if WITH_RHI_BREADCRUMBS
4618 EnableDrawEvents = 1 << 6,
4619 DisableDrawEvents = 1 << 7
4620#endif
4621};
4622
4624
4626{
4629
4631
4634 {
4635#if WITH_RHI_BREADCRUMBS
4636 PersistentState.LocalBreadcrumb = nullptr;
4637#endif
4638
4639#if HAS_GPU_STATS
4640 PersistentState.CurrentDrawStatsCategory = nullptr;
4641#endif
4642 }
4643
4645 {
4647 }
4648
4649public:
4650 static inline FRHICommandListImmediate& Get();
4651
4653 {
4654 check(RHICmdList.IsImmediate());
4655 return static_cast<FRHICommandListImmediate&>(RHICmdList);
4656 }
4657
4658 UE_DEPRECATED(5.7, "FRHICommandListImmediate::BeginDrawingViewport is deprecated. Calls to this function are unnecessary and can be removed. There is no replacement.")
4660 RHI_API void EndDrawingViewport(FRHIViewport* Viewport, bool bPresent, bool bLockToVsync);
4661
4662 RHI_API void EndFrame();
4663
4665 {
4666 // The command list to enqueue.
4668
4673 };
4674
4676 {
4677 Disabled, // Parallel translate is disabled. Command lists will be replayed by the RHI thread into the default context.
4678 Normal, // Parallel translate is enabled, and runs on a normal priority task thread.
4679 High // Parallel translate is enabled, and runs on a high priority task thread.
4680 };
4681
4682 //
4683 // Chains together one or more RHI command lists into the immediate command list, allowing in-order submission of parallel rendering work.
4684 // The provided command lists are not dispatched until FinishRecording() is called on them, and their dispatch prerequisites have been completed.
4685 //
4686
4687 // @todo dev-pr : deprecate
4689
4690 // @todo dev-pr : deprecate
4695
4696 //
4697 // Dispatches work to the RHI thread and the GPU.
4698 // Also optionally waits for its completion on the RHI thread. Does not wait for the GPU.
4699 //
4701
4702 RHI_API bool StallRHIThread();
4704 RHI_API static bool IsStalled();
4705
4707
4708 template <typename LAMBDA>
4709 inline void EnqueueLambda(const TCHAR* LambdaName, LAMBDA&& Lambda)
4710 {
4711 if (IsBottomOfPipe())
4712 {
4713 Lambda(*this);
4714 }
4715 else
4716 {
4718 }
4719 }
4720
4721 template <typename LAMBDA>
4722 inline void EnqueueLambda(LAMBDA&& Lambda)
4723 {
4724 FRHICommandListImmediate::EnqueueLambda(TEXT("TRHILambdaCommand"), Forward<LAMBDA>(Lambda));
4725 }
4726
4728 {
4729 return GDynamicRHI->LockStagingBuffer_RenderThread(*this, StagingBuffer, Fence, Offset, SizeRHI);
4730 }
4731
4732 inline void UnlockStagingBuffer(FRHIStagingBuffer* StagingBuffer)
4733 {
4734 GDynamicRHI->UnlockStagingBuffer_RenderThread(*this, StagingBuffer);
4735 }
4736
4743
4749
4750 UE_DEPRECATED(5.6, "FinalizeAsyncReallocateTexture2D is no longer implemented.")
4756
4757 UE_DEPRECATED(5.6, "CancelAsyncReallocateTexture2D is no longer implemented.")
4762
4764 {
4765 LLM_SCOPE(ELLMTag::Textures);
4766 return GDynamicRHI->RHILockTexture(*this, Arguments);
4767 }
4768
4769 inline void UnlockTexture(const FRHILockTextureArgs& Arguments)
4770 {
4771 LLM_SCOPE(ELLMTag::Textures);
4772 GDynamicRHI->RHIUnlockTexture(*this, Arguments);
4773 }
4774
4775 //UE_DEPRECATED(5.6, "LockTexture should be used for all texture type locks.")
4776 inline void* LockTexture2D(FRHITexture* Texture, uint32 MipIndex, EResourceLockMode LockMode, uint32& DestStride, bool bLockWithinMiptail, bool bFlushRHIThread = true, uint64* OutLockedByteCount = nullptr)
4777 {
4778 LLM_SCOPE(ELLMTag::Textures);
4779
4780 const FRHILockTextureResult Result = LockTexture(FRHILockTextureArgs::Lock2D(Texture, MipIndex, LockMode, bLockWithinMiptail, bFlushRHIThread));
4781 DestStride = Result.Stride;
4783 {
4784 *OutLockedByteCount = Result.ByteCount;
4785 }
4786 return Result.Data;
4787 }
4788
4789 //UE_DEPRECATED(5.6, "UnlockTexture should be used for all texture type unlocks.")
4790 inline void UnlockTexture2D(FRHITexture* Texture, uint32 MipIndex, bool bLockWithinMiptail, bool bFlushRHIThread = true)
4791 {
4793 }
4794
4795 //UE_DEPRECATED(5.6, "LockTexture should be used for all texture type locks.")
4796 inline void* LockTexture2DArray(FRHITexture* Texture, uint32 ArrayIndex, uint32 MipIndex, EResourceLockMode LockMode, uint32& DestStride, bool bLockWithinMiptail)
4797 {
4798 LLM_SCOPE(ELLMTag::Textures);
4799 const FRHILockTextureResult Result = LockTexture(FRHILockTextureArgs::Lock2DArray(Texture, ArrayIndex, MipIndex, LockMode, bLockWithinMiptail));
4800 DestStride = Result.Stride;
4801 return Result.Data;
4802 }
4803
4804 //UE_DEPRECATED(5.6, "UnlockTexture should be used for all texture type unlocks.")
4805 inline void UnlockTexture2DArray(FRHITexture* Texture, uint32 ArrayIndex, uint32 MipIndex, bool bLockWithinMiptail)
4806 {
4807 LLM_SCOPE(ELLMTag::Textures);
4808 UnlockTexture(FRHILockTextureArgs::Lock2DArray(Texture, ArrayIndex, MipIndex, RLM_Num, bLockWithinMiptail));
4809 }
4810
4811 //UE_DEPRECATED(5.6, "LockTexture should be used for all texture type locks.")
4812 inline void* LockTextureCubeFace(FRHITexture* Texture, uint32 FaceIndex, uint32 ArrayIndex, uint32 MipIndex, EResourceLockMode LockMode, uint32& DestStride, bool bLockWithinMiptail)
4813 {
4814 LLM_SCOPE(ELLMTag::Textures);
4815 const FRHILockTextureResult Result = LockTexture(FRHILockTextureArgs::LockCubeFace(Texture, FaceIndex, ArrayIndex, MipIndex, LockMode, bLockWithinMiptail));
4816 DestStride = Result.Stride;
4817 return Result.Data;
4818 }
4819
4820 //UE_DEPRECATED(5.6, "UnlockTexture should be used for all texture type unlocks.")
4821 inline void UnlockTextureCubeFace(FRHITexture* Texture, uint32 FaceIndex, uint32 ArrayIndex, uint32 MipIndex, bool bLockWithinMiptail)
4822 {
4823 LLM_SCOPE(ELLMTag::Textures);
4824 UnlockTexture(FRHILockTextureArgs::LockCubeFace(Texture, FaceIndex, ArrayIndex, MipIndex, RLM_Num, bLockWithinMiptail));
4825 }
4826
4828 {
4829 checkf(UpdateRegion.DestX + UpdateRegion.Width <= Texture->GetSizeX(), TEXT("UpdateTexture3D out of bounds on X. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestX, UpdateRegion.Width, Texture->GetSizeX());
4830 checkf(UpdateRegion.DestY + UpdateRegion.Height <= Texture->GetSizeY(), TEXT("UpdateTexture3D out of bounds on Y. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestY, UpdateRegion.Height, Texture->GetSizeY());
4831 checkf(UpdateRegion.DestZ + UpdateRegion.Depth <= Texture->GetSizeZ(), TEXT("UpdateTexture3D out of bounds on Z. Texture: %s, %i, %i, %i"), *Texture->GetName().ToString(), UpdateRegion.DestZ, UpdateRegion.Depth, Texture->GetSizeZ());
4832 LLM_SCOPE(ELLMTag::Textures);
4833 return GDynamicRHI->RHIBeginUpdateTexture3D(*this, Texture, MipIndex, UpdateRegion);
4834 }
4835
4837 {
4838 LLM_SCOPE(ELLMTag::Textures);
4839 GDynamicRHI->RHIEndUpdateTexture3D(*this, UpdateData);
4840 }
4841
4847
4848 // ReadSurfaceFloatData reads texture data into FColor
4849 // pixels in other formats are converted to FColor
4857
4858 // ReadSurfaceFloatData reads texture data into FLinearColor
4859 // pixels in other formats are converted to FLinearColor
4860 // reading from float surfaces remaps the values into an interpolation of their {min,max} ; use RCM_MinMax to prevent that
4868
4870 {
4871 LLM_SCOPE(ELLMTag::Textures);
4872 GDynamicRHI->RHIMapStagingSurface_RenderThread(*this, Texture, GPUIndex, nullptr, OutData, OutWidth, OutHeight);
4873 }
4874
4875 inline void MapStagingSurface(FRHITexture* Texture, FRHIGPUFence* Fence, void*& OutData, int32& OutWidth, int32& OutHeight, uint32 GPUIndex = INDEX_NONE)
4876 {
4877 LLM_SCOPE(ELLMTag::Textures);
4878 GDynamicRHI->RHIMapStagingSurface_RenderThread(*this, Texture, GPUIndex, Fence, OutData, OutWidth, OutHeight);
4879 }
4880
4882 {
4883 LLM_SCOPE(ELLMTag::Textures);
4885 }
4886
4887 // ReadSurfaceFloatData reads texture data into FFloat16Color
4888 // it only works if Texture is exactly PF_FloatRGBA (RGBA16F) !
4889 // no conversion is done
4891 {
4892 LLM_SCOPE(ELLMTag::Textures);
4893 GDynamicRHI->RHIReadSurfaceFloatData_RenderThread(*this, Texture,Rect,OutData,CubeFace,ArrayIndex,MipIndex);
4894 }
4895
4901
4909
4917
4918 UE_DEPRECATED(5.6, "GetGPUFrameCycles is deprecated. Use the global scope RHIGetGPUFrameCycles() function.")
4923
4925 {
4927
4928 // Ensure all prior work is submitted down to the GPU, and the RHI thread is idle.
4930
4931 // Block the calling thread (the render thread) until the GPU completes all work.
4933 }
4934
4935 //UE_DEPRECATED(5.3, "BlockUntilGPUIdle() is deprecated. Call SubmitAndBlockUntilGPUIdle() instead.")
4936 inline void BlockUntilGPUIdle()
4937 {
4939 }
4940
4941 //UE_DEPRECATED(5.3, "SubmitCommandsAndFlushGPU() is deprecated. Call SubmitAndBlockUntilGPUIdle() instead.")
4943 {
4945 }
4946
4953
4958
4963
4964#if !UE_BUILD_SHIPPING
4969#endif
4970
4978
4986
4994
5002
5010
5012 {
5014 }
5015
5016 //UE_DEPRECATED(5.1, "SubmitCommandsHint is deprecated. Consider calling ImmediateFlush(EImmediateFlushType::DispatchToRHIThread) instead.")
5021};
5022
5023// All command list members should be contained within FRHICommandListBase. The Immediate/Compute/regular types are just interfaces.
5024static_assert(sizeof(FRHICommandListImmediate) == sizeof(FRHICommandListBase), "FRHICommandListImmediate should not contain additional members.");
5025static_assert(sizeof(FRHIComputeCommandList ) == sizeof(FRHICommandListBase), "FRHIComputeCommandList should not contain additional members.");
5026static_assert(sizeof(FRHICommandList ) == sizeof(FRHICommandListBase), "FRHICommandList should not contain additional members.");
5027
5029{
5030 FRHICommandListImmediate& RHICmdList;
5031
5032public:
5041 {
5042 RHICmdList.bExecuting = false;
5043 }
5044};
5045
5047void RHI_API RHIResourceLifetimeAddRef(int32 NumRefs = 1);
5048
5051
5069
5070//
5071// Helper to activate a specific RHI pipeline within a block of renderer code.
5072// Allows command list recording code to switch between graphics / async compute etc.
5073// Restores the previous active pipeline when the scope is ended.
5074//
5076{
5077 FRHICommandListBase& RHICmdList;
5078 ERHIPipeline PreviousPipeline;
5079
5080public:
5082 : RHICmdList(RHICmdList)
5083 , PreviousPipeline(RHICmdList.SwitchPipeline(Pipeline))
5084 {
5085 }
5086
5088 {
5089 RHICmdList.SwitchPipeline(PreviousPipeline);
5090 }
5091};
5092
5113
5114#if WITH_MGPU
5115 #define SCOPED_GPU_MASK(RHICmdList, GPUMask) FRHIScopedGPUMask PREPROCESSOR_JOIN(ScopedGPUMask, __LINE__){ RHICmdList, GPUMask }
5116#else
5117 #define SCOPED_GPU_MASK(RHICmdList, GPUMask)
5118#endif // WITH_MGPU
5119
5121{
5124 {
5125#if VALIDATE_UNIFORM_BUFFER_STATIC_BINDINGS
5126 OnScopeEnter();
5127#endif
5128
5130 }
5131
5132 template <typename... TArgs>
5136
5138 {
5140
5141#if VALIDATE_UNIFORM_BUFFER_STATIC_BINDINGS
5142 OnScopeExit();
5143#endif
5144 }
5145
5147
5148private:
5149#if VALIDATE_UNIFORM_BUFFER_STATIC_BINDINGS
5150 RHI_API static void OnScopeEnter();
5151 RHI_API static void OnScopeExit();
5152#endif
5153};
5154
5155#define SCOPED_UNIFORM_BUFFER_STATIC_BINDINGS(RHICmdList, UniformBuffers) FScopedUniformBufferStaticBindings PREPROCESSOR_JOIN(UniformBuffers, __LINE__){ RHICmdList, UniformBuffers }
5156
5157// Helper to enable the use of graphics RHI command lists from within platform RHI implementations.
5158// Recorded commands are dispatched when the command list is destructed. Intended for use on the stack / in a scope block.
5165
5166// Helper class used internally by RHIs to make use of FRHICommandList_RecursiveHazardous safer.
5167// Access to the underlying context is exposed via RunOnContext() to ensure correct ordering of commands.
5168template <typename ContextType>
5170{
5171 template <typename LAMBDA>
5172 struct TRHILambdaCommand final : public FRHICommandBase
5173 {
5174 LAMBDA Lambda;
5175
5176 TRHILambdaCommand(LAMBDA&& InLambda)
5177 : Lambda(Forward<LAMBDA>(InLambda))
5178 {}
5179
5180 void ExecuteAndDestruct(FRHICommandListBase& CmdList) override final
5181 {
5182 // RunOnContext always requires the lowest level (platform) context, not the validation RHI context.
5183 ContextType& Context = static_cast<ContextType&>(CmdList.GetContext().GetLowestLevelContext());
5184 Context.BeginRecursiveCommand();
5185
5186 Lambda(Context);
5187 Lambda.~LAMBDA();
5188 }
5189 };
5190
5191public:
5195
5196 template <typename LAMBDA>
5197 inline void RunOnContext(LAMBDA&& Lambda)
5198 {
5199 if (Bypass())
5200 {
5201 // RunOnContext always requires the lowest level (platform) context, not the validation RHI context.
5202 ContextType& Context = static_cast<ContextType&>(GetContext().GetLowestLevelContext());
5203 Context.BeginRecursiveCommand();
5204
5205 Lambda(Context);
5206 }
5207 else
5208 {
5210 }
5211 }
5212};
5213
5214// Helper to enable the use of compute RHI command lists from within platform RHI implementations.
5215// Recorded commands are dispatched when the command list is destructed. Intended for use on the stack / in a scope block.
5222
5223// Helper class used internally by RHIs to make use of FRHIComputeCommandList_RecursiveHazardous safer.
5224// Access to the underlying context is exposed via RunOnContext() to ensure correct ordering of commands.
5225template <typename ContextType>
5227{
5228 template <typename LAMBDA>
5229 struct TRHILambdaCommand final : public FRHICommandBase
5230 {
5231 LAMBDA Lambda;
5232
5233 TRHILambdaCommand(LAMBDA&& InLambda)
5234 : Lambda(Forward<LAMBDA>(InLambda))
5235 {}
5236
5237 void ExecuteAndDestruct(FRHICommandListBase& CmdList) override final
5238 {
5239 // RunOnContext always requires the lowest level (platform) context, not the validation RHI context.
5240 ContextType& Context = static_cast<ContextType&>(CmdList.GetComputeContext().GetLowestLevelContext());
5241 Context.BeginRecursiveCommand();
5242
5243 Lambda(Context);
5244 Lambda.~LAMBDA();
5245 }
5246 };
5247
5248public:
5252
5253 template <typename LAMBDA>
5254 inline void RunOnContext(LAMBDA&& Lambda)
5255 {
5256 if (Bypass())
5257 {
5258 // RunOnContext always requires the lowest level (platform) context, not the validation RHI context.
5259 ContextType& Context = static_cast<ContextType&>(GetComputeContext().GetLowestLevelContext());
5260 Context.BeginRecursiveCommand();
5261
5262 Lambda(Context);
5263 }
5264 else
5265 {
5267 }
5268 }
5269};
5270
5272{
5273public:
5275 : FRHICommandList(GPUMask)
5276 {
5277 RenderPassInfo->Validate();
5278 SubRenderPassInfo = RenderPassInfo;
5279 CacheActiveRenderTargets(*RenderPassInfo);
5280 }
5281};
5282
5284{
5285public:
5287 RHI_API void LatchBypass();
5288
5290
5291 RHI_API static void WaitOnRHIThreadFence(FGraphEventRef& Fence);
5292
5293 //
5294 // Blocks the calling thread until all dispatch prerequisites of enqueued parallel command lists are completed.
5295 //
5300
5301 //
5302 // Blocks the calling thread until all specified tasks are completed.
5303 //
5304 RHI_API void WaitForTasks(FGraphEventArray& OutstandingTasks);
5305
5306 // Global graph events must be destroyed explicitly to avoid undefined order of static destruction, as they can be destroyed after their allocator.
5307 void CleanupGraphEvents();
5308
5309 inline bool Bypass() const
5310 {
5311#if CAN_TOGGLE_COMMAND_LIST_BYPASS
5312 return bLatchedBypass;
5313#else
5314 return false;
5315#endif
5316 }
5317
5318 inline bool UseParallelAlgorithms() const
5319 {
5320#if CAN_TOGGLE_COMMAND_LIST_BYPASS
5321 return bLatchedUseParallelAlgorithms;
5322#else
5324#endif
5325 }
5326
5327 //
5328 // Returns true if any RHI dispatch, translate or submission tasks are currently running.
5329 // This works regardless of engine threading mode (i.e. with or without an RHI thread and parallel translate).
5330 //
5331 // When this function returns false, we can be sure there are no threads active within the platform RHI, besides the render thread.
5332 //
5333 RHI_API static bool AreRHITasksActive();
5334
5335 //
5336 // Adds a prerequisite for subsequent Submit dispatch tasks.
5337 //
5338 // This function should only be called from the render thread.
5339 //
5341
5342 //
5343 // Gets the CompletionEvent for the most recent submit to GPU
5344 //
5345 // This function should only be called from the render thread.
5346 //
5348 {
5349 return CompletionEvent;
5350 }
5351
5353
5354private:
5355 bool bLatchedBypass = false;
5356 bool bLatchedUseParallelAlgorithms = false;
5357#if WITH_RHI_BREADCRUMBS
5358 bool bEmitBreadcrumbs = false;
5359#endif
5360
5363 FRHICommandListImmediate CommandListImmediate;
5364
5365 //
5366 // Helper for efficiently enqueuing work to TaskGraph threads. Work items within a single pipe are always executed in-order (FIFO) even if they have no prerequisites.
5367 // Uses an atomic compare-and-swap mechanism to append new tasks to the end of existing ones, avoiding the overhead of having the TaskGraph itself do the task scheduling.
5368 //
5369 class FTaskPipe
5370 {
5371 struct FTask;
5372
5373 FTask* Current = nullptr;
5374 FGraphEventRef LastEvent = nullptr;
5375 TOptional<ENamedThreads::Type> LastThread {};
5376
5377 FGraphEventRef LaunchTask(FTask* Task) const;
5378 void Execute(FTask* Task, FGraphEventRef const& CurrentEvent) const;
5379
5380 public:
5381 // Enqueues the given lambda to run on the named thread.
5382 void Enqueue(ENamedThreads::Type NamedThread, FGraphEventArray&& Prereqs, TFunction<void()>&& Lambda);
5383
5384 // Returns a graph event that will be signalled once all work submitted prior to calling Close() has completed.
5386
5387 void CleanupGraphEvents()
5388 {
5389 LastEvent = nullptr;
5390 }
5391 };
5392
5393 FTaskPipe DispatchPipe;
5394 FTaskPipe RHIThreadPipe;
5395
5396 // One per RHI context array, multiple RHICmdLists replayed into it
5397 struct FTranslateState
5398 {
5400 {
5401#if WITH_RHI_BREADCRUMBS
5402 FRHIBreadcrumbRange Range {};
5403#endif
5406 };
5407 TRHIPipelineArray<FPipelineState> PipelineStates {};
5408 IRHIUploadContext* UploadContextState = nullptr;
5409
5410
5411#if WITH_RHI_BREADCRUMBS
5413#endif
5414
5415 FTaskPipe TranslatePipe;
5416 uint32 NumCommands = 0;
5417 bool bParallel = false;
5418 bool bUsingSubCmdLists = false;
5419 bool bShouldFinalize = true;
5420
5421 FRHIDrawStats DrawStats{};
5422
5423 FTaskPipe* GetTranslateTaskPipe(ENamedThreads::Type& NamedThread);
5424 FTaskPipe* EnqueueTranslateTask(FGraphEventArray&& Prereqs, TFunction<void()>&& Lambda);
5425
5426 void Translate(FRHICommandListBase* CmdList);
5428 };
5429
5430 // One per call to RHISubmitCommandLists
5431 struct FSubmitState
5432 {
5433 FGraphEventRef CompletionEvent;
5434
5436 FGraphEventArray TranslateEvents;
5437 FTranslateState* CurrentTranslateJob = nullptr;
5438
5439 int32 MaxCommandsPerTranslate = 0;
5440 bool bAllowSingleParallelCombine = false;
5441 bool bAllowParallelTranslate = true;
5442
5443#if WITH_RHI_BREADCRUMBS
5444 bool bEmitBreadcrumbs = false;
5445#endif
5446
5447 FRHIDrawStats DrawStats {};
5448
5450 TArray<FRHIResource*> ResourcesToDelete {};
5451 bool bIncludeExtendedLifetimeResources = false;
5452
5453 bool ShouldSplitTranslateJob(FRHICommandListBase* CmdList);
5454 void ConditionalSplitTranslateJob(FRHICommandListBase* CmdList);
5455
5456 FGraphEventRef BeginGraphEvent;
5457 FGraphEventArray ChildGraphEvents;
5458
5459 void Dispatch(FRHICommandListBase* CmdList);
5460
5462 {
5463 #if WITH_RHI_BREADCRUMBS
5465 #endif
5466 #if STATS
5468 #endif
5469 };
5470 void Submit(const FSubmitArgs& Args);
5471 FGraphEventRef FinalizeCurrent();
5472 } *SubmitState = nullptr;
5473
5474 FGraphEventRef LastMutate;
5475 FGraphEventRef LastSubmit;
5476 FGraphEventRef CompletionEvent;
5477
5478 FTaskPipe* EnqueueDispatchTask(FGraphEventArray&& Prereqs, TFunction<void()>&& Lambda);
5479 FTaskPipe* EnqueueSubmitTask (FGraphEventArray&& Prereqs, TFunction<void()>&& Lambda);
5480 FGraphEventArray NextDispatchTaskPrerequisites;
5481
5482#if WITH_RHI_BREADCRUMBS
5483
5484 struct FBreadcrumbState
5485 {
5486 FRHIBreadcrumbNodeRef Current{}; // Used by dispatch thread
5487 FRHIBreadcrumbNodeRef Last {}; // Used by submit thread
5488 };
5489
5490 struct
5491 {
5494 } Breadcrumbs {};
5495
5496#endif
5497
5498#if HAS_GPU_STATS
5500#endif
5501 FRHIDrawStats FrameDrawStats;
5502
5503 // Counts the number of calls to RHIEndFrame, and is used in GPU profiler frame boundary events.
5504 uint32 FrameNumber = 0;
5505
5506 bool AllowParallel() const;
5507};
5508
5510
5512
5514{
5515public:
5517 {
5519 }
5520};
5521
5527
5529{
5530 // @todo - fix remaining use of the immediate command list on other threads, then uncomment this check.
5531 //check(IsInRenderingThread());
5532 return GRHICommandList.CommandListImmediate;
5533}
5534
5535UE_DEPRECATED(5.7, "RHICreateTextureReference with an implied immediate command list is deprecated")
5540
5541UE_DEPRECATED(5.7, "RHIUpdateTextureReference with an implied immediate command list is deprecated")
5546
5547// Temporary workaround until we figure out if we want to route a command list through ReleaseRHI()
5552
5554{
5555 return FRHICommandListImmediate::Get().CreateTexture(CreateDesc);
5556}
5557
5564
5569
5570UE_DEPRECATED(5.6, "RHIFinalizeAsyncReallocateTexture2D is no longer implemented.")
5575
5576UE_DEPRECATED(5.6, "RHICancelAsyncReallocateTexture2D is no longer implemented.")
5581
5582//UE_DEPRECATED(5.6, "RHICmdList.LockTexture should be used for all texture type locks.")
5583inline void* RHILockTexture2D(FRHITexture* Texture, uint32 MipIndex, EResourceLockMode LockMode, uint32& DestStride, bool bLockWithinMiptail, bool bFlushRHIThread = true, uint64* OutLockedByteCount = nullptr)
5584{
5586}
5587
5588//UE_DEPRECATED(5.6, "RHICmdList.UnlockTexture should be used for all texture type unlocks.")
5589inline void RHIUnlockTexture2D(FRHITexture* Texture, uint32 MipIndex, bool bLockWithinMiptail, bool bFlushRHIThread = true)
5590{
5592}
5593
5594//UE_DEPRECATED(5.6, "RHICmdList.LockTexture should be used for all texture type locks.")
5595inline void* RHILockTexture2DArray(FRHITexture* Texture, uint32 TextureIndex, uint32 MipIndex, EResourceLockMode LockMode, uint32& DestStride, bool bLockWithinMiptail)
5596{
5597 return FRHICommandListExecutor::GetImmediateCommandList().LockTexture2DArray(Texture, TextureIndex, MipIndex, LockMode, DestStride, bLockWithinMiptail);
5598}
5599
5600//UE_DEPRECATED(5.6, "RHICmdList.UnlockTexture should be used for all texture type unlocks.")
5601inline void RHIUnlockTexture2DArray(FRHITexture* Texture, uint32 TextureIndex, uint32 MipIndex, bool bLockWithinMiptail)
5602{
5603 FRHICommandListExecutor::GetImmediateCommandList().UnlockTexture2DArray(Texture, TextureIndex, MipIndex, bLockWithinMiptail);
5604}
5605
5606//UE_DEPRECATED(5.6, "RHICmdList.LockTexture should be used for all texture type locks.")
5607inline void* RHILockTextureCubeFace(FRHITexture* Texture, uint32 FaceIndex, uint32 ArrayIndex, uint32 MipIndex, EResourceLockMode LockMode, uint32& DestStride, bool bLockWithinMiptail)
5608{
5609 return FRHICommandListExecutor::GetImmediateCommandList().LockTextureCubeFace(Texture, FaceIndex, ArrayIndex, MipIndex, LockMode, DestStride, bLockWithinMiptail);
5610}
5611
5612//UE_DEPRECATED(5.6, "RHICmdList.UnlockTexture should be used for all texture type unlocks.")
5613inline void RHIUnlockTextureCubeFace(FRHITexture* Texture, uint32 FaceIndex, uint32 ArrayIndex, uint32 MipIndex, bool bLockWithinMiptail)
5614{
5616}
5617
5618inline void RHIUpdateTexture2D(FRHITexture* Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D& UpdateRegion, uint32 SourcePitch, const uint8* SourceData)
5619{
5621}
5622
5627
5632
5637
5638inline void RHIUpdateTexture3D(FRHITexture* Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D& UpdateRegion, uint32 SourceRowPitch, uint32 SourceDepthPitch, const uint8* SourceData)
5639{
5641}
5642
5647
5652
5657
5662
5667
5672
5677
5682
5687
5688inline FRHIShaderLibraryRef RHICreateShaderLibrary(EShaderPlatform Platform, FString const& FilePath, FString const& Name)
5689{
5690 return GDynamicRHI->RHICreateShaderLibrary(Platform, FilePath, Name);
5691}
5692
5694{
5696}
5697
5699{
5701}
5702
5707
5712
5717
5722
5727
5728UE_DEPRECATED(5.7, "BindDebugLabelName with an implied immediate command list is deprecated")
5733
5734UE_DEPRECATED(5.7, "BindDebugLabelName with an implied immediate command list is deprecated")
5739
5740UE_DEPRECATED(5.7, "BindDebugLabelName with an implied immediate command list is deprecated")
5742{
5743 FRHICommandListImmediate::Get().BindDebugLabelName(UnorderedAccessViewRHI, Name);
5744}
5745
5746namespace UE::RHI
5747{
5748
5749 //
5750 // Copies shared mip levels from one texture to another.
5751 // Both textures must have full mip chains, share the same format, and have the same aspect ratio.
5752 // The source texture must be in the CopySrc state, and the destination texture must be in the CopyDest state.
5753 //
5755
5756 //
5757 // Same as CopySharedMips(), but assumes both source and destination textures are in the SRVMask state.
5758 // Adds transitions to move the textures to/from the CopySrc/CopyDest states, restoring SRVMask when done.
5759 //
5760 // Provided for backwards compatibility. Caller should prefer CopySharedMips() with optimally batched transitions.
5761 //
5763
5764 // Backwards compatibility adaptor to convert new FRHIBatchedShaderParameters to legacy FRayTracingShaderBindings.
5765 // This function will be deprecated in a future release, once legacy FRayTracingShaderBindings is removed.
5767
5768}
5769
5770#undef RHICOMMAND_CALLSTACK
5771
5772#include "RHICommandList.inl"
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define FORCEINLINE
Definition AndroidPlatform.h:140
constexpr auto MakeArrayView(OtherRangeType &&Other)
Definition ArrayView.h:873
constexpr auto MakeConstArrayView(OtherRangeType &&Other)
Definition ArrayView.h:904
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define checkfSlow(expr, format,...)
Definition AssertionMacros.h:333
#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
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define FORCEINLINE_DEBUGGABLE
Definition CoreMiscDefines.h:74
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
@ InPlace
Definition CoreMiscDefines.h:162
#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::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
#define QUICK_SCOPE_CYCLE_COUNTER(Stat)
Definition Stats.h:652
#define DECLARE_STATS_GROUP(GroupDesc, GroupId, GroupCat)
Definition Stats.h:689
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define TRACE_CPUPROFILER_EVENT_SCOPE_TEXT_ON_CHANNEL(Name, Channel)
Definition CpuProfilerTrace.h:534
#define CPUPROFILERTRACE_ENABLED
Definition CpuProfilerTrace.h:19
#define TRACE_CPUPROFILER_EVENT_SCOPE_ON_CHANNEL_STR(NameStr, Channel)
Definition CpuProfilerTrace.h:525
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
#define CSV_DECLARE_CATEGORY_MODULE_EXTERN(Module_API, CategoryName)
Definition CsvProfiler.h:80
D3D12_DESCRIPTOR_HEAP_TYPE Translate(ERHIDescriptorHeapType InHeapType)
Definition D3D12Descriptors.h:19
FDynamicRHI * GDynamicRHI
Definition DynamicRHI.cpp:35
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:35
constexpr bool EnumHasAllFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:28
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
UE::EnumFlags::Private::TRange< EnumType > MakeFlagsRange(EnumType Flags)
Definition EnumRange.h:285
return true
Definition ExternalRpcRegistry.cpp:601
JsonWriter Close()
RHI_API uint32 RHIGetGPUFrameCycles(uint32 GPUIndex)
Definition GPUProfiler.cpp:2722
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
FORCEINLINE uint32 ToIndex(FHairStrandsTiles::ETileType Type)
Definition HairStrandsData.h:93
#define LLM_SCOPE_BYNAME(...)
Definition LowLevelMemTracker.h:1098
#define LLM_SCOPE(...)
Definition LowLevelMemTracker.h:1095
UE::Math::TIntRect< int32 > FIntRect
Definition MathFwd.h:133
@ Num
Definition MetalRHIPrivate.h:234
FPixelFormatInfo GPixelFormats[PF_MAX]
Definition PixelFormat.cpp:31
#define UE_PIXELFORMAT_TO_UINT8(argument)
Definition PixelFormat.h:268
EPixelFormat
Definition PixelFormat.h:16
@ PF_Unknown
Definition PixelFormat.h:17
ERHIAccess
Definition RHIAccess.h:11
#define RHI_BREADCRUMB_EVENT_CONDITIONAL( ...)
Definition RHIBreadcrumbs.h:1429
#define RHI_BREADCRUMB_CHECK_SHIPPING(RHICmdList_Or_RHIContext, Condition)
Definition RHIBreadcrumbs.h:1463
FTextureReferenceRHIRef RHICreateTextureReference(FRHITexture *InReferencedTexture=nullptr)
Definition RHICommandList.h:5536
FRayTracingGeometryRHIRef RHICreateRayTracingGeometry(const FRayTracingGeometryInitializer &Initializer)
Definition RHICommandList.h:5708
void * RHIGetNativeCommandBuffer()
Definition RHICommandList.h:5683
RHI_API FRHICommandListExecutor GRHICommandList
Definition RHICommandList.cpp:119
FRHIShaderLibraryRef RHICreateShaderLibrary(EShaderPlatform Platform, FString const &FilePath, FString const &Name)
Definition RHICommandList.h:5688
void RHI_API RHIResourceLifetimeReleaseRef(FRHICommandListImmediate &RHICmdList, int32 NumRefs=1)
Definition RHIResources.cpp:89
RHI_API uint32 GetRHIRayTracingPipelineStateMaxLocalBindingDataSize(FRayTracingPipelineState *)
Definition PipelineStateCache.cpp:1378
ERayTracingBindingType
Definition RHICommandList.h:281
void * RHILockTextureCubeFace(FRHITexture *Texture, uint32 FaceIndex, uint32 ArrayIndex, uint32 MipIndex, EResourceLockMode LockMode, uint32 &DestStride, bool bLockWithinMiptail)
Definition RHICommandList.h:5607
ETextureReallocationStatus RHICancelAsyncReallocateTexture2D(FRHITexture *Texture2D, bool bBlockUntilCompleted)
Definition RHICommandList.h:5577
void * RHILockStagingBuffer(FRHIStagingBuffer *StagingBuffer, uint32 Offset, uint32 Size)
Definition RHICommandList.h:5693
#define FRHICOMMAND_MACRO_TPL(TemplateType, CommandName)
Definition RHICommandList.h:1639
#define FRHICOMMAND_MACRO(CommandName)
Definition RHICommandList.h:1632
RHI_API FGraphicsPipelineState * GetGraphicsPipelineState(FRHICommandList &RHICmdList, const FGraphicsPipelineStateInitializer &Initializer, bool bVerifyUse=true)
Definition PipelineStateCache.cpp:1473
RHI_API TAutoConsoleVariable< int32 > CVarRHICmdWidth
#define ALLOC_COMMAND_CL(RHICmdList,...)
Definition RHICommandList.h:415
FTextureRHIRef RHIAsyncCreateTexture2D(uint32 SizeX, uint32 SizeY, uint8 Format, uint32 NumMips, ETextureCreateFlags Flags, ERHIAccess InResourceState, void **InitialMipData, uint32 NumInitialMips, const TCHAR *DebugName, FGraphEventRef &OutCompletionEvent)
Definition RHICommandList.h:5558
#define ALLOC_COMMAND(...)
Definition RHICommandList.h:414
bool IsRunningRHIInTaskThread()
Definition RHICommandList.h:175
RHI_API FRHIComputePipelineState * GetRHIComputePipelineState(FComputePipelineState *)
Definition PipelineStateCache.cpp:1271
bool IsRunningRHIInDedicatedThread()
Definition RHICommandList.h:167
void RHIUpdateTextureReference(FRHITextureReference *TextureRef, FRHITexture *NewTexture)
Definition RHICommandList.h:5542
RHI_API FAutoConsoleTaskPriority CPrio_SceneRenderingTask
ERHISubmitFlags
Definition RHICommandList.h:4594
void * RHIGetNativeInstance()
Definition RHICommandList.h:5678
RHI_API FRHIRayTracingPipelineState * GetRHIRayTracingPipelineState(FRayTracingPipelineState *)
Definition PipelineStateCache.cpp:1367
RHI_API FGraphicsPipelineState * FindGraphicsPipelineState(const FGraphicsPipelineStateInitializer &Initializer, bool bVerifyUse=true)
Definition PipelineStateCache.cpp:1453
void RHIVirtualTextureSetFirstMipInMemory(FRHITexture *Texture, uint32 FirstMip)
Definition RHICommandList.h:5648
void RHI_API RHIResourceLifetimeAddRef(int32 NumRefs=1)
Definition RHIResources.cpp:83
void RHIClearTextureReference(FRHITextureReference *TextureRef)
Definition RHICommandList.h:5548
FTextureRHIRef RHIAsyncReallocateTexture2D(FRHITexture *Texture2D, int32 NewMipCount, int32 NewSizeX, int32 NewSizeY, FThreadSafeCounter *RequestStatus)
Definition RHICommandList.h:5565
void RHIUnlockStagingBuffer(FRHIStagingBuffer *StagingBuffer)
Definition RHICommandList.h:5703
void * RHILockTexture2D(FRHITexture *Texture, uint32 MipIndex, EResourceLockMode LockMode, uint32 &DestStride, bool bLockWithinMiptail, bool bFlushRHIThread=true, uint64 *OutLockedByteCount=nullptr)
Definition RHICommandList.h:5583
FTextureRHIRef RHICreateTexture(const FRHITextureCreateDesc &CreateDesc)
Definition RHICommandList.h:5553
void RHIUnlockTextureCubeFace(FRHITexture *Texture, uint32 FaceIndex, uint32 ArrayIndex, uint32 MipIndex, bool bLockWithinMiptail)
Definition RHICommandList.h:5613
RHI_API FRHIWorkGraphPipelineState * GetRHIWorkGraphPipelineState(FWorkGraphPipelineState *)
Definition PipelineStateCache.cpp:1277
RHI_API ERHIAccess RHIGetDefaultResourceState(ETextureCreateFlags InUsage, bool bInHasInitialData)
Definition RHIUtilities.cpp:639
RHI_API FRHIGraphicsPipelineState * ExecuteSetGraphicsPipelineState(class FGraphicsPipelineState *GraphicsPipelineState)
Definition PipelineStateCache.cpp:4625
RHI_API FComputePipelineState * GetComputePipelineState(FRHIComputeCommandList &RHICmdList, FRHIComputeShader *ComputeShader, bool bVerifyUse=true)
Definition PipelineStateCache.cpp:1437
void RHIUnlockTexture2D(FRHITexture *Texture, uint32 MipIndex, bool bLockWithinMiptail, bool bFlushRHIThread=true)
Definition RHICommandList.h:5589
void * RHIGetNativeComputeQueue()
Definition RHICommandList.h:5673
RHI_API uint32 GRenderThreadIdle[ERenderThreadIdleTypes::Num]
Definition RHICommandList.cpp:114
ERHIThreadMode
Definition RHICommandList.h:100
void RHIUpdateTexture3D(FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D &UpdateRegion, uint32 SourceRowPitch, uint32 SourceDepthPitch, const uint8 *SourceData)
Definition RHICommandList.h:5638
RHI_API FComputePipelineState * FindComputePipelineState(FRHIComputeShader *ComputeShader, bool bVerifyUse=true)
Definition PipelineStateCache.cpp:1432
void * RHILockTexture2DArray(FRHITexture *Texture, uint32 TextureIndex, uint32 MipIndex, EResourceLockMode LockMode, uint32 &DestStride, bool bLockWithinMiptail)
Definition RHICommandList.h:5595
RHI_API FRHIComputePipelineState * ExecuteSetComputePipelineState(FComputePipelineState *ComputePipelineState)
Definition PipelineStateCache.cpp:4135
void * RHIGetNativeDevice()
Definition RHICommandList.h:5658
#define FRHICOMMAND_UNNAMED(CommandName)
Definition RHICommandList.h:1625
void RHIUpdateTexture2D(FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D &UpdateRegion, uint32 SourcePitch, const uint8 *SourceData)
Definition RHICommandList.h:5618
void RHIFlushResources()
Definition RHICommandList.h:5643
void RHIUnlockTexture2DArray(FRHITexture *Texture, uint32 TextureIndex, uint32 MipIndex, bool bLockWithinMiptail)
Definition RHICommandList.h:5601
RHI_API TOptional< ERHIThreadMode > GPendingRHIThreadMode
Definition RHICommandList.cpp:111
void * RHIGetNativePhysicalDevice()
Definition RHICommandList.h:5663
void RHIBindDebugLabelName(FRHITexture *Texture, const TCHAR *Name)
Definition RHICommandList.h:5729
#define RHI_EXECUTE_API
Definition RHICommandList.h:96
FRayTracingAccelerationStructureSize RHICalcRayTracingGeometrySize(const FRayTracingGeometryInitializer &Initializer)
Definition RHICommandList.h:5713
void RHIEndMultiUpdateTexture3D(TArray< FUpdateTexture3DData > &UpdateDataArray)
Definition RHICommandList.h:5633
RHI_API uint64 GInputLatencyTime
Definition RHICommandList.cpp:117
void RHIEndUpdateTexture3D(FUpdateTexture3DData &UpdateData)
Definition RHICommandList.h:5628
void * RHIGetNativeGraphicsQueue()
Definition RHICommandList.h:5668
FRayTracingAccelerationStructureOfflineMetadata RHIGetRayTracingGeometryOfflineMetadata(const FRayTracingGeometryOfflineDataHeader &OfflineDataHeader)
Definition RHICommandList.h:5723
void RHIVirtualTextureSetFirstMipVisible(FRHITexture *Texture, uint32 FirstMip)
Definition RHICommandList.h:5653
FORCEINLINE FRayTracingClusterOperationSize RHICalcRayTracingClusterOperationSize(const FRayTracingClusterOperationInitializer &Initializer)
Definition RHICommandList.h:5718
FUpdateTexture3DData RHIBeginUpdateTexture3D(FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D &UpdateRegion)
Definition RHICommandList.h:5623
ERayTracingLocalShaderBindingType
Definition RHICommandList.h:259
ETextureReallocationStatus RHIFinalizeAsyncReallocateTexture2D(FRHITexture *Texture2D, bool bBlockUntilCompleted)
Definition RHICommandList.h:5571
bool IsRunningRHIInSeparateThread()
Definition RHICommandList.h:159
#define TexCreate_DepthStencilTargetable
Definition RHIDefinitions.h:1194
@ 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_Pixel
Definition RHIDefinitions.h:206
#define TexCreate_RenderTargetable
Definition RHIDefinitions.h:1192
EBufferUsageFlags
Definition RHIDefinitions.h:892
ERHITransitionCreateFlags
Definition RHIDefinitions.h:1495
ECubeFace
Definition RHIDefinitions.h:525
EResourceLockMode
Definition RHIDefinitions.h:785
@ RLM_WriteOnly
Definition RHIDefinitions.h:787
@ RLM_Num
Definition RHIDefinitions.h:789
uint8 FUniformBufferStaticSlot
Definition RHIDefinitions.h:722
ESyncComputeBudget
Definition RHIDefinitions.h:1331
EVRSRateCombiner
Definition RHIDefinitions.h:873
#define BUF_ByteAddressBuffer
Definition RHIDefinitions.h:984
EAsyncComputeBudget
Definition RHIDefinitions.h:1317
ETextureReallocationStatus
Definition RHIDefinitions.h:1243
@ TexRealloc_Succeeded
Definition RHIDefinitions.h:1244
ETextureCreateFlags
Definition RHIDefinitions.h:1091
ERenderQueryType
Definition RHIDefinitions.h:258
@ RQT_AbsoluteTime
Definition RHIDefinitions.h:264
@ RQT_Occlusion
Definition RHIDefinitions.h:262
EPrimitiveType
Definition RHIDefinitions.h:822
EVRSShadingRate
Definition RHIDefinitions.h:860
FRHIGlobals GRHIGlobals
Definition RHIGlobals.cpp:6
#define GRHISupportsShaderBundleParallel
Definition RHIGlobals.h:905
#define GSupportsParallelRenderingTasksWithSeparateRHIThread
Definition RHIGlobals.h:794
constexpr bool IsSingleRHIPipeline(ERHIPipeline Pipelines)
Definition RHIPipeline.h:23
ERHIPipeline
Definition RHIPipeline.h:13
ESubpassHint
Definition RHIResources.h:4526
@ SRGBO_ForceDisable
Definition RHIResources.h:5565
ERHIBatchedShaderParameterAllocatorPageSize
Definition RHIShaderParameters.h:90
EShaderPlatform
Definition RHIShaderPlatform.h:11
FRHIViewableResource * GetViewableResource(const FRHITransitionInfo &Info)
Definition RHITransition.cpp:9
#define ON_SCOPE_EXIT
Definition ScopeExit.h:73
CORE_API bool GIsRunningRHIInTaskThread_InternalUseOnly
Definition ThreadingBase.cpp:332
CORE_API bool GIsRunningRHIInDedicatedThread_InternalUseOnly
Definition ThreadingBase.cpp:331
CORE_API bool IsInRHIThread()
Definition ThreadingBase.cpp:339
CORE_API bool GIsRunningRHIInSeparateThread_InternalUseOnly
Definition ThreadingBase.cpp:330
CORE_API bool IsInRenderingThread()
Definition ThreadingBase.cpp:273
#define UE_TRACE_CHANNEL_EXTERN(ChannelName,...)
Definition Trace.h:448
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 App.h:35
static CORE_API bool ShouldUseThreadingForPerformance()
Definition App.cpp:300
Definition TaskGraphInterfaces.h:213
ENamedThreads::Type Get(ENamedThreads::Type Thread=ENamedThreads::AnyThread)
Definition TaskGraphInterfaces.h:228
Definition RHI.h:403
Definition PipelineStateCache.cpp:1124
virtual void RHIEndRenderQueryBatch_TopOfPipe(FRHICommandListBase &RHICmdList, ERenderQueryType QueryType)
Definition DynamicRHI.h:650
virtual void RHIUpdateResourceCollection(FRHICommandListBase &RHICmdList, FRHIResourceCollection *InResourceCollection, uint32 InStartIndex, TConstArrayView< FRHIResourceCollectionMember > InMemberUpdates)
Definition DynamicRHI.h:534
virtual FShaderResourceViewRHIRef RHICreateShaderResourceView(class FRHICommandListBase &RHICmdList, FRHIViewableResource *Resource, FRHIViewDesc const &ViewDesc)=0
virtual void * RHIGetNativeDevice()=0
virtual RHI_API void RHIVirtualTextureSetFirstMipInMemory(class FRHICommandListImmediate &RHICmdList, FRHITexture *Texture, uint32 FirstMip)
Definition DynamicRHI.cpp:569
virtual FShaderBindingTableRHIRef RHICreateShaderBindingTable(FRHICommandListBase &RHICmdList, const FRayTracingShaderBindingTableInitializer &Initializer)
Definition DynamicRHI.h:1034
virtual RHI_API void RHIBindDebugLabelName(FRHICommandListBase &RHICmdList, FRHITexture *Texture, const TCHAR *Name)
Definition DynamicRHI.cpp:900
virtual RHI_API void RHIUnlockBuffer(FRHICommandListBase &RHICmdList, FRHIBuffer *Buffer)
Definition RHICommandList.cpp:2099
virtual void RHIBeginRenderQueryBatch_TopOfPipe(FRHICommandListBase &RHICmdList, ERenderQueryType QueryType)
Definition DynamicRHI.h:649
virtual FTextureRHIRef RHIAsyncCreateTexture2D(uint32 SizeX, uint32 SizeY, uint8 Format, uint32 NumMips, ETextureCreateFlags Flags, ERHIAccess InResourceState, void **InitialMipData, uint32 NumInitialMips, const TCHAR *DebugName, FGraphEventRef &OutCompletionEvent)=0
virtual RHI_API void RHIWriteGPUFence_TopOfPipe(FRHICommandListBase &RHICmdList, FRHIGPUFence *FenceRHI)
Definition RHICommandList.cpp:2140
virtual void RHIReadSurfaceData(FRHITexture *Texture, FIntRect Rect, TArray< FColor > &OutData, FReadSurfaceDataFlags InFlags)=0
virtual RHI_API void RHIEndUpdateTexture3D(FRHICommandListBase &RHICmdList, FUpdateTexture3DData &UpdateData)
Definition RHICommandList.cpp:2242
virtual FRHIBufferInitializer RHICreateBufferInitializer(FRHICommandListBase &RHICmdList, const FRHIBufferCreateDesc &CreateDesc)=0
virtual RHI_API void RHIVirtualTextureSetFirstMipVisible(class FRHICommandListImmediate &RHICmdList, FRHITexture *Texture, uint32 FirstMip)
Definition DynamicRHI.cpp:574
virtual void * RHIGetNativeCommandBuffer()
Definition DynamicRHI.h:849
virtual bool RHIIsRenderingSuspended()
Definition DynamicRHI.h:767
virtual void RHIReplaceResources(FRHICommandListBase &RHICmdList, TArray< FRHIResourceReplaceInfo > &&ReplaceInfos)=0
virtual FRayTracingClusterOperationSize RHICalcRayTracingClusterOperationSize(const FRayTracingClusterOperationInitializer &Initializer)
Definition DynamicRHI.h:998
virtual FRHIResourceCollectionRef RHICreateResourceCollection(FRHICommandListBase &RHICmdList, TConstArrayView< FRHIResourceCollectionMember > InMembers)
Definition DynamicRHI.h:529
virtual RHI_API void * RHILockBuffer(FRHICommandListBase &RHICmdList, FRHIBuffer *Buffer, uint32 Offset, uint32 Size, EResourceLockMode LockMode)
Definition RHICommandList.cpp:2064
virtual RHI_API FTextureReferenceRHIRef RHICreateTextureReference(FRHICommandListBase &RHICmdList, FRHITexture *InReferencedTexture)
Definition DynamicRHI.cpp:547
virtual RHI_API void RHIMapStagingSurface_RenderThread(class FRHICommandListImmediate &RHICmdList, FRHITexture *Texture, uint32 GPUIndex, FRHIGPUFence *Fence, void *&OutData, int32 &OutWidth, int32 &OutHeight)
Definition RHICommandList.cpp:2265
virtual RHI_API void UnlockStagingBuffer_RenderThread(class FRHICommandListImmediate &RHICmdList, FRHIStagingBuffer *StagingBuffer)
Definition RHICommandList.cpp:2205
virtual IRHIUploadContext * RHIGetUploadContext()
Definition DynamicRHI.h:882
virtual RHI_API void * RHILockBufferMGPU(FRHICommandListBase &RHICmdList, FRHIBuffer *Buffer, uint32 GPUIndex, uint32 Offset, uint32 Size, EResourceLockMode LockMode)
Definition DynamicRHI.cpp:823
virtual FRayTracingGeometryRHIRef RHICreateRayTracingGeometry(FRHICommandListBase &RHICmdList, const FRayTracingGeometryInitializer &Initializer)
Definition DynamicRHI.h:1010
virtual RHI_API void * LockStagingBuffer_RenderThread(class FRHICommandListImmediate &RHICmdList, FRHIStagingBuffer *StagingBuffer, FRHIGPUFence *Fence, uint32 Offset, uint32 SizeRHI)
Definition RHICommandList.cpp:2183
virtual void RHIBlockUntilGPUIdle()=0
virtual FRayTracingAccelerationStructureSize RHICalcRayTracingGeometrySize(const FRayTracingGeometryInitializer &Initializer)
Definition DynamicRHI.h:992
virtual FRHITextureInitializer RHICreateTextureInitializer(FRHICommandListBase &RHICmdList, const FRHITextureCreateDesc &CreateDesc)=0
virtual bool RHIGetTextureMemoryVisualizeData(FColor *TextureData, int32 SizeX, int32 SizeY, int32 Pitch, int32 PixelSize)=0
virtual RHI_API void RHIBeginRenderQuery_TopOfPipe(FRHICommandListBase &RHICmdList, FRHIRenderQuery *RenderQuery)
Definition RHICommandList.cpp:2150
virtual void RHIUpdateFromBufferTexture2D(FRHICommandListBase &RHICmdList, FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D &UpdateRegion, uint32 SourcePitch, FRHIBuffer *Buffer, uint32 BufferOffset)
Definition DynamicRHI.h:587
virtual RHI_API void RHIReadSurfaceFloatData_RenderThread(class FRHICommandListImmediate &RHICmdList, FRHITexture *Texture, FIntRect Rect, TArray< FFloat16Color > &OutData, ECubeFace CubeFace, int32 ArrayIndex, int32 MipIndex)
Definition RHICommandList.cpp:2299
virtual FRHIShaderLibraryRef RHICreateShaderLibrary(EShaderPlatform Platform, FString const &FilePath, FString const &Name)
Definition DynamicRHI.h:307
virtual RHI_API FUpdateTexture3DData RHIBeginUpdateTexture3D(FRHICommandListBase &RHICmdList, FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D &UpdateRegion)
Definition RHICommandList.cpp:2228
virtual RHI_API void RHIEndMultiUpdateTexture3D(FRHICommandListBase &RHICmdList, TArray< FUpdateTexture3DData > &UpdateDataArray)
Definition RHICommandList.cpp:2251
virtual void RHIRead3DSurfaceFloatData(FRHITexture *Texture, FIntRect Rect, FIntPoint ZMinMax, TArray< FFloat16Color > &OutData)=0
virtual FUnorderedAccessViewRHIRef RHICreateUnorderedAccessView(class FRHICommandListBase &RHICmdList, FRHIViewableResource *Resource, FRHIViewDesc const &ViewDesc)=0
virtual RHI_API void RHIUnmapStagingSurface_RenderThread(class FRHICommandListImmediate &RHICmdList, FRHITexture *Texture, uint32 GPUIndex)
Definition RHICommandList.cpp:2286
virtual void * RHIGetNativeInstance()=0
virtual void RHIUpdateTexture3D(FRHICommandListBase &RHICmdList, FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D &UpdateRegion, uint32 SourceRowPitch, uint32 SourceDepthPitch, const uint8 *SourceData)=0
virtual FRHILockTextureResult RHILockTexture(FRHICommandListImmediate &RHICmdList, const FRHILockTextureArgs &Arguments)=0
virtual FRayTracingAccelerationStructureOfflineMetadata RHIGetRayTracingGeometryOfflineMetadata(const FRayTracingGeometryOfflineDataHeader &OfflineDataHeader)
Definition DynamicRHI.h:1004
virtual void RHISerializeAccelerationStructure(FRHICommandListImmediate &RHICmdList, FRHIRayTracingScene *Scene, const TCHAR *Path)
Definition DynamicRHI.h:1041
virtual void RHIUpdateTexture2D(FRHICommandListBase &RHICmdList, FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D &UpdateRegion, uint32 SourcePitch, const uint8 *SourceData)=0
virtual void RHIUpdateUniformBuffer(FRHICommandListBase &RHICmdList, FRHIUniformBuffer *UniformBufferRHI, const void *Contents)=0
virtual RHI_API FTextureRHIRef AsyncReallocateTexture2D_RenderThread(class FRHICommandListImmediate &RHICmdList, FRHITexture *Texture2D, int32 NewMipCount, int32 NewSizeX, int32 NewSizeY, FThreadSafeCounter *RequestStatus)
Definition RHICommandList.cpp:2220
virtual RHI_API void RHIEndRenderQuery_TopOfPipe(FRHICommandListBase &RHICmdList, FRHIRenderQuery *RenderQuery)
Definition RHICommandList.cpp:2160
virtual void RHIFlushResources()=0
virtual void * RHIGetNativeGraphicsQueue()
Definition DynamicRHI.h:825
virtual void RHIUnlockTexture(FRHICommandListImmediate &RHICmdList, const FRHILockTextureArgs &Arguments)=0
virtual void * RHIGetNativeComputeQueue()
Definition DynamicRHI.h:834
virtual RHI_API void RHIUnlockBufferMGPU(FRHICommandListBase &RHICmdList, FRHIBuffer *Buffer, uint32 GPUIndex)
Definition DynamicRHI.cpp:830
virtual void * RHIGetNativePhysicalDevice()
Definition DynamicRHI.h:815
Definition RHIResources.h:4572
ERenderTargetStoreAction DepthTargetStoreAction
Definition RHIResources.h:4767
EPixelFormat DepthStencilTargetFormat
Definition RHIResources.h:4764
uint32 RenderTargetsEnabled
Definition RHIResources.h:4761
ETextureCreateFlags DepthStencilTargetFlag
Definition RHIResources.h:4765
uint8 MultiViewCount
Definition RHIResources.h:4776
bool bHasFragmentDensityAttachment
Definition RHIResources.h:4777
ERenderTargetLoadAction StencilTargetLoadAction
Definition RHIResources.h:4768
uint8 SubpassIndex
Definition RHIResources.h:4773
ERenderTargetLoadAction DepthTargetLoadAction
Definition RHIResources.h:4766
ESubpassHint SubpassHint
Definition RHIResources.h:4772
TRenderTargetFormats RenderTargetFormats
Definition RHIResources.h:4762
FExclusiveDepthStencil DepthStencilAccess
Definition RHIResources.h:4770
TRenderTargetFlags RenderTargetFlags
Definition RHIResources.h:4763
ERenderTargetStoreAction StencilTargetStoreAction
Definition RHIResources.h:4769
uint16 NumSamples
Definition RHIResources.h:4771
Definition PipelineStateCache.cpp:1230
Definition RHIResources.h:1666
Definition MemStack.h:78
UE_FORCEINLINE_HINT bool IsEmpty() const
Definition MemStack.h:166
void * Alloc(size_t AllocSize, size_t Alignment)
Definition MemStack.h:132
Definition RHIResources.h:966
Definition RHIShaderParameters.h:96
FRHICommandListBase & RHICmdList
Definition RHIShaderParameters.h:99
FRHIBatchedShaderParametersAllocator * Next
Definition RHIShaderParameters.h:98
Definition RHIResources.h:1581
Definition RHICommandList.h:455
bool bExecuting
Definition RHICommandList.h:1354
void BindDebugLabelName(FRHITexture *Texture, const TCHAR *Name)
Definition RHICommandList.h:1175
void * LockBuffer(FRHIBuffer *Buffer, uint32 Offset, uint32 SizeRHI, EResourceLockMode LockMode)
Definition RHICommandList.h:747
TArray< FRHITexture * > PendingTextureUploads
Definition RHICommandList.h:1511
void AddPendingBufferUpload(FRHIBuffer *InBuffer)
Definition RHICommandList.h:1314
void ValidateBoundShader(FRHIComputeShader *ShaderRHI)
Definition RHICommandList.h:1247
bool bAllowExtraTransitions
Definition RHICommandList.h:1359
void BindDebugLabelName(FRHIUnorderedAccessView *UnorderedAccessViewRHI, const TCHAR *Name)
Definition RHICommandList.h:1185
bool NeedsExtraTransitions() const
Definition RHICommandList.h:1223
void ValidateBoundShader(FRHIGraphicsShader *ShaderRHI)
Definition RHICommandList.h:1252
PRAGMA_DISABLE_DEPRECATION_WARNINGS FBufferRHIRef CreateNullBuffer(ERHIAccess ResourceState, FRHIResourceCreateInfo &CreateInfo)
Definition RHICommandList.h:816
IRHIComputeContext & GetComputeContext()
Definition RHICommandList.h:693
IRHIUploadContext * UploadContext
Definition RHICommandList.h:1347
bool IsGraphics() const
Definition RHICommandList.h:663
void * AllocCopy(const void *InSourceData, int64 AllocSize, int64 Alignment)
Definition RHICommandList.h:527
FBufferRHIRef CreateBuffer(const FRHIBufferCreateDesc &CreateDesc)
Definition RHICommandList.h:800
RHI_API void TransitionInternal(TConstArrayView< FRHITransitionInfo > Infos, ERHITransitionCreateFlags CreateFlags=ERHITransitionCreateFlags::None)
Definition RHICommandList.cpp:2348
void ValidateBoundShader(FRHIPixelShader *ShaderRHI)
Definition RHICommandList.h:1245
bool SetAllowExtraTransitions(bool NewState)
Definition RHICommandList.h:1229
void UpdateTexture3D(FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D &UpdateRegion, uint32 SourceRowPitch, uint32 SourceDepthPitch, const uint8 *SourceData)
Definition RHICommandList.h:957
void * LockBufferMGPU(FRHIBuffer *Buffer, uint32 GPUIndex, uint32 Offset, uint32 SizeRHI, EResourceLockMode LockMode)
Definition RHICommandList.h:777
FRHIGPUMask GetGPUMask() const
Definition RHICommandList.h:734
bool AllowParallelTranslate() const
Definition RHICommandList.h:472
struct FRHICommandListBase::FPersistentState PersistentState
void EnqueueLambda(LAMBDA &&Lambda)
Definition RHICommandList.h:598
bool HasCommands() const
Definition RHICommandList.h:642
void UpdateFromBufferTexture2D(FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D &UpdateRegion, uint32 SourcePitch, FRHIBuffer *Buffer, uint32 BufferOffset)
Definition RHICommandList.h:947
ERHIPipeline GetPipeline() const
Definition RHICommandList.h:675
void ValidateBoundShader(FRHIVertexShader *ShaderRHI)
Definition RHICommandList.h:1244
bool IsRecursive() const
Definition RHICommandList.h:736
IRHICommandContext * GraphicsContext
Definition RHICommandList.h:1341
FShaderResourceViewRHIRef CreateShaderResourceViewFMask(FRHITexture *Texture2DRHI)
Definition RHICommandList.h:1136
void UnlockBuffer(FRHIBuffer *Buffer)
Definition RHICommandList.h:755
void * Alloc(int64 AllocSize, int64 Alignment)
Definition RHICommandList.h:522
struct FRHICommandRHIThreadFence * LastLockFenceCommand
Definition RHICommandList.h:1370
bool IsInsideRenderPass() const
Definition RHICommandList.h:738
FShaderParameterState ShaderParameterState
Definition RHICommandList.h:1413
FUnorderedAccessViewRHIRef CreateUnorderedAccessView(FRHIBuffer *Buffer, FRHIViewDesc::FBufferUAV::FInitializer const &ViewDesc)
Definition RHICommandList.h:989
void ValidateBoundShader(FRHIAmplificationShader *ShaderRHI)
Definition RHICommandList.h:1250
void RemovePendingBufferUpload(FRHIBuffer *InBuffer)
Definition RHICommandList.h:1319
FTextureRHIRef CreateTexture(const FRHITextureCreateDesc &CreateDesc)
Definition RHICommandList.h:941
bool IsBottomOfPipe() const
Definition RHICommandList.h:653
FTextureReferenceRHIRef CreateTextureReference(FRHITexture *InReferencedTexture=nullptr)
Definition RHICommandList.h:968
bool IsInsideComputePass() const
Definition RHICommandList.h:739
bool IsOutsideRenderPass() const
Definition RHICommandList.h:737
bool bUsesSetTrackedAccess
Definition RHICommandList.h:1356
FRHIBufferInitializer CreateBufferInitializer(const FRHIBufferCreateDesc &CreateDesc)
Definition RHICommandList.h:792
FRHICommandListBase(FRHICommandListBase const &)=delete
TStaticArray< void *, MAX_NUM_GPUS > & GetQueryBatchData(ERenderQueryType QueryType)
Definition RHICommandList.h:1544
void EnqueueLambdaMultiPipe(ERHIPipeline Pipelines, EThreadFence ThreadFence, const TCHAR *LambdaName, LAMBDA &&Lambda)
Definition RHICommandList.h:610
TSharedPtr< FRHIParallelRenderPassInfo > ParallelRenderPassBegin
Definition RHICommandList.h:1375
uint32 NumCommands
Definition RHICommandList.h:1353
bool bUsesShaderBundles
Definition RHICommandList.h:1357
EThreadFence
Definition RHICommandList.h:604
IRHIUploadContext & GetUploadContext()
Definition RHICommandList.h:700
RHI_API ~FRHICommandListBase()
Definition RHICommandList.cpp:153
FShaderResourceViewRHIRef CreateShaderResourceView(FRHIBuffer *Buffer, FRHIViewDesc::FBufferSRV::FInitializer const &ViewDesc)
Definition RHICommandList.h:975
FShaderResourceViewRHIRef CreateShaderResourceViewWriteMask(FRHITexture *Texture2DRHI)
Definition RHICommandList.h:1127
void EnqueueLambda(const TCHAR *LambdaName, LAMBDA &&Lambda)
Definition RHICommandList.h:585
void TransitionInternal(const FRHITransitionInfo &Info, ERHITransitionCreateFlags CreateFlags=ERHITransitionCreateFlags::None)
Definition RHICommandList.h:727
RHI_API FGraphEventRef RHIThreadFence(bool bSetLockFence=false)
Definition RHICommandList.cpp:1610
FRHICommandListImmediate & GetAsImmediate()
Definition RHICommandList.inl:21
FRHICommandListBase(FRHICommandListBase &&Other)=default
void UpdateTexture2D(FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D &UpdateRegion, uint32 SourcePitch, const uint8 *SourceData)
Definition RHICommandList.h:914
TArray< FRHIBuffer * > PendingBufferUploads
Definition RHICommandList.h:1510
bool IsExecuting() const
Definition RHICommandList.h:648
RHI_API void FinishRecording()
Definition RHICommandList.cpp:245
T * Alloc()
Definition RHICommandList.h:535
void ValidateShaderParameters(const FRHIBatchedShaderParameters &ShaderParameters)
Definition RHICommandList.h:1267
FMemStackBase & GetAllocator()
Definition RHICommandList.h:1242
void ResetSubpass(ESubpassHint SubpassHint)
Definition RHICommandList.h:1308
void * AllocCommand(int32 AllocSize, int32 Alignment)
Definition RHICommandList.h:567
TArray< FRHICommandListBase * > AttachedCmdLists
Definition RHICommandList.h:1372
void IncrementSubpass()
Definition RHICommandList.h:1303
ERHIPipeline GetPipelines() const
Definition RHICommandList.h:681
bool bAllowParallelTranslate
Definition RHICommandList.h:1355
FBufferRHIRef CreateStructuredBuffer(uint32 Stride, uint32 Size, EBufferUsageFlags Usage, ERHIAccess ResourceState, FRHIResourceCreateInfo &CreateInfo)
Definition RHICommandList.h:865
RHI_API void InsertParallelRenderPass_Base(TSharedPtr< FRHIParallelRenderPassInfo > const &InInfo, TArray< FRHISubCommandList * > &&SubCommandLists)
Definition RHICommandList.cpp:170
FRHITextureInitializer CreateTextureInitializer(const FRHITextureCreateDesc &CreateDesc)
Definition RHICommandList.h:925
RHI_API void AddDispatchPrerequisite(const FGraphEventRef &Prereq)
Definition RHICommandList.cpp:227
void CacheActiveRenderTargets(const FRHIRenderPassInfo &Info)
Definition RHICommandList.h:1287
FRHIBatchedShaderParameters & GetScratchShaderParameters()
Definition RHICommandList.h:1190
void Stats_AddDraw()
Definition RHICommandList.h:1526
void UpdateStreamSourceSlot(FRHIStreamSourceSlot *StreamSourceSlotRHI, FRHIBuffer *BufferRHI)
Definition RHICommandList.h:897
RHI_API void UpdateTextureReference(FRHITextureReference *TextureRef, FRHITexture *NewTexture)
Definition RHICommandList.cpp:2315
friend struct FRHICommandSetGPUMask
Definition RHICommandList.h:1570
FRHIContextArray Contexts
Definition RHICommandList.h:1351
bool NeedsShaderUnbinds() const
Definition RHICommandList.h:1217
bool IsSubCommandList() const
Definition RHICommandList.h:711
FRayTracingGeometryRHIRef CreateRayTracingGeometry(const FRayTracingGeometryInitializer &Initializer)
Definition RHICommandList.h:1155
bool Bypass() const
Definition RHICommandList.inl:27
void ValidateShaderBundleComputeDispatch(TConstArrayView< FRHIShaderBundleComputeDispatch > Dispatches)
Definition RHICommandList.h:1274
TSharedPtr< FRHIParallelRenderPassInfo > SubRenderPassInfo
Definition RHICommandList.h:1374
IRHICommandContext & GetContext()
Definition RHICommandList.h:686
FRHIResourceCollectionRef CreateResourceCollection(TConstArrayView< FRHIResourceCollectionMember > InMembers)
Definition RHICommandList.h:1144
FRHICommandBase * Root
Definition RHICommandList.h:1337
void ValidateBoundShader(FRHIGeometryShader *ShaderRHI)
Definition RHICommandList.h:1246
ERHIPipeline ActivePipelines
Definition RHICommandList.h:1363
FMemStackBase MemManager
Definition RHICommandList.h:457
void UpdateResourceCollection(FRHIResourceCollection *InResourceCollection, uint32 InStartIndex, TConstArrayView< FRHIResourceCollectionMember > InMemberUpdates)
Definition RHICommandList.h:1150
bool IsTopOfPipe() const
Definition RHICommandList.h:658
const TArrayView< T > AllocArray(TConstArrayView< T > InArray)
Definition RHICommandList.h:547
friend class FRHIScopedResourceBarrier
Definition RHICommandList.h:1560
const TArrayView< T > AllocArrayUninitialized(uint32 Num)
Definition RHICommandList.h:541
void Stats_AddDrawAndPrimitives(EPrimitiveType PrimitiveType, uint32 NumPrimitives)
Definition RHICommandList.h:1535
FBufferRHIRef CreateVertexBuffer(uint32 Size, EBufferUsageFlags Usage, ERHIAccess ResourceState, FRHIResourceCreateInfo &CreateInfo)
Definition RHICommandList.h:852
const int32 GetUsedMemory() const
Definition RHICommandList.cpp:222
IRHIComputeContext * ComputeContext
Definition RHICommandList.h:1344
FRHIBatchedShaderParametersAllocator * CreateBatchedShaderParameterAllocator(ERHIBatchedShaderParameterAllocatorPageSize PageSize)
Definition RHICommandList.h:1236
FRHICommandBase ** CommandLink
Definition RHICommandList.h:1338
FShaderResourceViewRHIRef CreateShaderResourceView(const FShaderResourceViewInitializer &Initializer)
Definition RHICommandList.h:1003
FUnorderedAccessViewRHIRef CreateUnorderedAccessView(FRHITexture *Texture, FRHIViewDesc::FTextureUAV::FInitializer const &ViewDesc)
Definition RHICommandList.h:995
FShaderBindingTableRHIRef CreateRayTracingShaderBindingTable(const FRayTracingShaderBindingTableInitializer &Initializer)
Definition RHICommandList.h:1160
void ReplaceResources(TArray< FRHIResourceReplaceInfo > &&ReplaceInfos)
Definition RHICommandList.h:1165
FShaderResourceViewRHIRef CreateShaderResourceView(FRHITexture *Texture, FRHIViewDesc::FTextureSRV::FInitializer const &ViewDesc)
Definition RHICommandList.h:981
void UnlockBufferMGPU(FRHIBuffer *Buffer, uint32 GPUIndex)
Definition RHICommandList.h:784
void ValidateBoundShader(FRHIWorkGraphShader *ShaderRHI)
Definition RHICommandList.h:1248
TCHAR * AllocString(const TCHAR *Name)
Definition RHICommandList.h:559
TSharedPtr< FRHIParallelRenderPassInfo > ParallelRenderPassEnd
Definition RHICommandList.h:1376
bool IsImmediate() const
Definition RHICommandList.inl:16
FRHIBatchedShaderUnbinds & GetScratchShaderUnbinds()
Definition RHICommandList.h:1207
FRHIBatchedShaderUnbinds ScratchShaderUnbinds
Definition RHICommandList.h:1414
PRAGMA_ENABLE_DEPRECATION_WARNINGS void UpdateUniformBuffer(FRHIUniformBuffer *UniformBufferRHI, const void *Contents)
Definition RHICommandList.h:891
FRHIDrawStats DrawStats
Definition RHICommandList.h:1508
void * AllocCommand()
Definition RHICommandList.h:579
bool IsAsyncCompute() const
Definition RHICommandList.h:669
FBufferRHIRef CreateIndexBuffer(uint32 Stride, uint32 Size, EBufferUsageFlags Usage, ERHIAccess ResourceState, FRHIResourceCreateInfo &CreateInfo)
Definition RHICommandList.h:878
FGraphEventRef DispatchEvent
Definition RHICommandList.h:1380
RHI_API ERHIPipeline SwitchPipeline(ERHIPipeline Pipeline)
Definition RHICommandList.cpp:510
bool bUsesLockFence
Definition RHICommandList.h:1358
void ValidateBoundShader(FRHIMeshShader *ShaderRHI)
Definition RHICommandList.h:1249
RHI_API void ActivatePipelines(ERHIPipeline Pipelines)
Definition RHICommandList.cpp:344
void BindDebugLabelName(FRHIBuffer *Buffer, const TCHAR *Name)
Definition RHICommandList.h:1180
void AddPendingTextureUpload(FRHITexture *InTexture)
Definition RHICommandList.h:1325
void RemovePendingTextureUpload(FRHITexture *InTexture)
Definition RHICommandList.h:1330
Definition RHICommandList.h:5284
void WaitForTasks()
Definition RHICommandList.h:5296
static RHI_API bool AreRHITasksActive()
Definition RHICommandList.cpp:1791
RHI_API void AddNextDispatchPrerequisite(FGraphEventRef Prereq)
Definition RHICommandList.cpp:765
FGraphEventArray WaitOutstandingTasks
Definition RHICommandList.h:5352
void CleanupGraphEvents()
Definition RHICommandList.cpp:2325
static FRHICommandListImmediate & GetImmediateCommandList()
Definition RHICommandList.h:5528
const FGraphEventRef & GetCompletionEvent() const
Definition RHICommandList.h:5347
static RHI_API void WaitOnRHIThreadFence(FGraphEventRef &Fence)
Definition RHICommandList.cpp:1797
RHI_API FGraphEventRef Submit(TConstArrayView< FRHICommandListBase * > AdditionalCommandLists, ERHISubmitFlags SubmitFlags)
Definition RHICommandList.cpp:1302
bool UseParallelAlgorithms() const
Definition RHICommandList.h:5318
RHI_API void LatchBypass()
Definition RHICommandList.cpp:1736
bool Bypass() const
Definition RHICommandList.h:5309
Definition RHICommandList.h:4626
void SubmitCommandsAndFlushGPU()
Definition RHICommandList.h:4942
void SubmitCommandsHint()
Definition RHICommandList.h:5017
static FRHICommandListImmediate & Get(FRHICommandListBase &RHICmdList)
Definition RHICommandList.h:4652
void MapStagingSurface(FRHITexture *Texture, FRHIGPUFence *Fence, void *&OutData, int32 &OutWidth, int32 &OutHeight, uint32 GPUIndex=INDEX_NONE)
Definition RHICommandList.h:4875
void UnlockTexture2DArray(FRHITexture *Texture, uint32 ArrayIndex, uint32 MipIndex, bool bLockWithinMiptail)
Definition RHICommandList.h:4805
RHI_API void EndDrawingViewport(FRHIViewport *Viewport, bool bPresent, bool bLockToVsync)
Definition RHICommandList.cpp:1908
RHI_API void EndFrame()
Definition RHICommandList.cpp:1934
friend void RHI_API RHIResourceLifetimeReleaseRef(FRHICommandListImmediate &, int32)
Definition RHIResources.cpp:89
void VirtualTextureSetFirstMipVisible(FRHITexture *Texture, uint32 FirstMip)
Definition RHICommandList.h:4959
void ReadSurfaceFloatData(FRHITexture *Texture, FIntRect Rect, TArray< FFloat16Color > &OutData, FReadSurfaceDataFlags Flags)
Definition RHICommandList.h:4896
FTextureRHIRef AsyncReallocateTexture2D(FRHITexture *Texture2D, int32 NewMipCount, int32 NewSizeX, int32 NewSizeY, FThreadSafeCounter *RequestStatus)
Definition RHICommandList.h:4744
RHI_API void ImmediateFlush(EImmediateFlushType::Type FlushType, ERHISubmitFlags SubmitFlags=ERHISubmitFlags::None)
Definition RHICommandList.cpp:1573
ETextureReallocationStatus FinalizeAsyncReallocateTexture2D(FRHITexture *Texture2D, bool bBlockUntilCompleted)
Definition RHICommandList.h:4751
void SerializeAccelerationStructure(FRHIRayTracingScene *Scene, const TCHAR *Path)
Definition RHICommandList.h:4965
bool GetTextureMemoryVisualizeData(FColor *TextureData, int32 SizeX, int32 SizeY, int32 Pitch, int32 PixelSize)
Definition RHICommandList.h:4737
bool IsRenderingSuspended()
Definition RHICommandList.h:4947
void UnlockTexture2D(FRHITexture *Texture, uint32 MipIndex, bool bLockWithinMiptail, bool bFlushRHIThread=true)
Definition RHICommandList.h:4790
RHI_API bool StallRHIThread()
Definition RHICommandList.cpp:1855
void EnqueueLambda(const TCHAR *LambdaName, LAMBDA &&Lambda)
Definition RHICommandList.h:4709
static RHI_API bool IsStalled()
Definition RHICommandList.cpp:1850
uint32 GetGPUFrameCycles()
Definition RHICommandList.h:4919
ETranslatePriority
Definition RHICommandList.h:4676
ETextureReallocationStatus CancelAsyncReallocateTexture2D(FRHITexture *Texture2D, bool bBlockUntilCompleted)
Definition RHICommandList.h:4758
void EndMultiUpdateTexture3D(TArray< FUpdateTexture3DData > &UpdateDataArray)
Definition RHICommandList.h:4842
void UnlockTexture(const FRHILockTextureArgs &Arguments)
Definition RHICommandList.h:4769
void BlockUntilGPUIdle()
Definition RHICommandList.h:4936
void BeginDrawingViewport(FRHIViewport *Viewport, FRHITexture *RenderTargetRHI)
Definition RHICommandList.h:4659
void EnqueueLambda(LAMBDA &&Lambda)
Definition RHICommandList.h:4722
void QueueAsyncCommandListSubmit(FQueuedCommandList QueuedCommandList, ETranslatePriority ParallelTranslatePriority=ETranslatePriority::Disabled, int32 MinDrawsPerTranslate=0)
Definition RHICommandList.h:4691
void FlushResources()
Definition RHICommandList.h:4910
void * GetNativeDevice()
Definition RHICommandList.h:4971
void * GetNativeGraphicsQueue()
Definition RHICommandList.h:4987
void * GetNativePhysicalDevice()
Definition RHICommandList.h:4979
void * LockTexture2DArray(FRHITexture *Texture, uint32 ArrayIndex, uint32 MipIndex, EResourceLockMode LockMode, uint32 &DestStride, bool bLockWithinMiptail)
Definition RHICommandList.h:4796
void SubmitAndBlockUntilGPUIdle()
Definition RHICommandList.h:4924
void UnmapStagingSurface(FRHITexture *Texture, uint32 GPUIndex=INDEX_NONE)
Definition RHICommandList.h:4881
RHI_API void InitializeImmediateContexts()
Definition RHICommandList.cpp:1542
void ReadSurfaceFloatData(FRHITexture *Texture, FIntRect Rect, TArray< FFloat16Color > &OutData, ECubeFace CubeFace, int32 ArrayIndex, int32 MipIndex)
Definition RHICommandList.h:4890
void * LockTextureCubeFace(FRHITexture *Texture, uint32 FaceIndex, uint32 ArrayIndex, uint32 MipIndex, EResourceLockMode LockMode, uint32 &DestStride, bool bLockWithinMiptail)
Definition RHICommandList.h:4812
RHI_API void UnStallRHIThread()
Definition RHICommandList.cpp:1897
void MapStagingSurface(FRHITexture *Texture, void *&OutData, int32 &OutWidth, int32 &OutHeight, uint32 GPUIndex=INDEX_NONE)
Definition RHICommandList.h:4869
void UnlockTextureCubeFace(FRHITexture *Texture, uint32 FaceIndex, uint32 ArrayIndex, uint32 MipIndex, bool bLockWithinMiptail)
Definition RHICommandList.h:4821
void VirtualTextureSetFirstMipInMemory(FRHITexture *Texture, uint32 FirstMip)
Definition RHICommandList.h:4954
void * LockStagingBuffer(FRHIStagingBuffer *StagingBuffer, FRHIGPUFence *Fence, uint32 Offset, uint32 SizeRHI)
Definition RHICommandList.h:4727
void * GetNativeCommandBuffer()
Definition RHICommandList.h:5011
void ReadSurfaceData(FRHITexture *Texture, FIntRect Rect, TArray< FLinearColor > &OutData, FReadSurfaceDataFlags InFlags)
Definition RHICommandList.h:4861
void EndUpdateTexture3D(FUpdateTexture3DData &UpdateData)
Definition RHICommandList.h:4836
FUpdateTexture3DData BeginUpdateTexture3D(FRHITexture *Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D &UpdateRegion)
Definition RHICommandList.h:4827
void ReadSurfaceData(FRHITexture *Texture, FIntRect Rect, TArray< FColor > &OutData, FReadSurfaceDataFlags InFlags)
Definition RHICommandList.h:4850
FRHILockTextureResult LockTexture(const FRHILockTextureArgs &Arguments)
Definition RHICommandList.h:4763
RHI_API void QueueAsyncCommandListSubmit(TArrayView< FQueuedCommandList > CommandLists, ETranslatePriority ParallelTranslatePriority=ETranslatePriority::Disabled, int32 MinDrawsPerTranslate=0)
Definition RHICommandList.cpp:1598
static FRHICommandListImmediate & Get()
Definition RHICommandList.h:5522
void * LockTexture2D(FRHITexture *Texture, uint32 MipIndex, EResourceLockMode LockMode, uint32 &DestStride, bool bLockWithinMiptail, bool bFlushRHIThread=true, uint64 *OutLockedByteCount=nullptr)
Definition RHICommandList.h:4776
void Read3DSurfaceFloatData(FRHITexture *Texture, FIntRect Rect, FIntPoint ZMinMax, TArray< FFloat16Color > &OutData, FReadSurfaceDataFlags Flags=FReadSurfaceDataFlags())
Definition RHICommandList.h:4902
void * GetNativeComputeQueue()
Definition RHICommandList.h:4995
void * GetNativeInstance()
Definition RHICommandList.h:5003
void UnlockStagingBuffer(FRHIStagingBuffer *StagingBuffer)
Definition RHICommandList.h:4732
Definition RHICommandList.inl:73
Definition RHICommandList.h:445
~FRHICommandListScopedAllowExtraTransitions()
Definition RHICommandList.inl:156
Definition RHICommandList.h:5053
FRHICommandListScopedExtendResourceLifetime(FRHICommandListImmediate &InRHICmdList)
Definition RHICommandList.h:5055
~FRHICommandListScopedExtendResourceLifetime()
Definition RHICommandList.h:5061
Definition RHICommandList.h:423
~FRHICommandListScopedFence()
Definition RHICommandList.inl:121
Definition RHICommandList.h:5029
FRHICommandListScopedFlushAndExecute(FRHICommandListImmediate &InRHICmdList)
Definition RHICommandList.h:5033
~FRHICommandListScopedFlushAndExecute()
Definition RHICommandList.h:5040
Definition RHICommandList.h:435
~FRHICommandListScopedPipelineGuard()
Definition RHICommandList.inl:142
Definition RHICommandList.h:5076
FRHICommandListScopedPipeline(FRHICommandListBase &RHICmdList, ERHIPipeline Pipeline)
Definition RHICommandList.h:5081
~FRHICommandListScopedPipeline()
Definition RHICommandList.h:5087
Definition RHICommandList.h:5160
RHI_API ~FRHICommandList_RecursiveHazardous()
Definition RHICommandList.cpp:1696
Definition RHICommandList.h:3819
FRHIMeshShader * GetBoundMeshShader() const
Definition RHICommandList.h:3847
void OnBoundShaderChanged(const FBoundShaderStateInput &InBoundShaderStateInput)
Definition RHICommandList.h:3823
void SetRayTracingMissShaders(FRHIShaderBindingTable *SBT, FRayTracingPipelineState *Pipeline, uint32 NumBindings, const FRayTracingLocalShaderBindings *Bindings, bool bCopyDataToInlineStorage=true)
Definition RHICommandList.h:4465
void SetBindingsOnShaderBindingTable(FRHIShaderBindingTable *SBT, FRayTracingPipelineState *Pipeline, uint32 NumBindings, const FRayTracingLocalShaderBindings *Bindings, ERayTracingBindingType BindingType, bool bCopyDataToInlineStorage=true)
Definition RHICommandList.h:4393
void SetShadingRate(EVRSShadingRate ShadingRate, EVRSRateCombiner Combiner)
Definition RHICommandList.h:4201
FRHICommandList(FRHICommandListBase &&Other)
Definition RHICommandList.h:3842
FRHIGeometryShader * GetBoundGeometryShader() const
Definition RHICommandList.h:3850
void BeginRenderPass(const FRHIRenderPassInfo &InInfo, const TCHAR *Name)
Definition RHICommandList.h:4259
void InsertParallelRenderPass(TSharedPtr< FRHIParallelRenderPassInfo > const &InInfo, TArray< FRHISubCommandList * > &&SubCommandLists)
Definition RHICommandList.h:4315
void EnqueueLambda(LAMBDA &&Lambda)
Definition RHICommandList.h:3866
void SetStreamSource(uint32 StreamIndex, FRHIBuffer *VertexBuffer, uint32 Offset)
Definition RHICommandList.h:3984
void DrawPrimitiveIndirect(FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset)
Definition RHICommandList.h:4127
void DispatchIndirectMeshShader(FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset)
Definition RHICommandList.h:4170
FRHIPixelShader * GetBoundPixelShader() const
Definition RHICommandList.h:3849
void SetRayTracingMissShader(FRHIShaderBindingTable *SBT, uint32 RecordIndex, FRayTracingPipelineState *Pipeline, uint32 ShaderIndexInPipeline, uint32 NumUniformBuffers, FRHIUniformBuffer *const *UniformBuffers, uint32 UserData)
Definition RHICommandList.h:4544
void SetBatchedShaderParameters(FRHIGraphicsShader *InShader, FRHIBatchedShaderParameters &InBatchedParameters)
Definition RHICommandList.h:3900
void SetRayTracingHitGroup(FRHIShaderBindingTable *SBT, uint32 RecordIndex, FRHIRayTracingGeometry *Geometry, uint32 GeometrySegmentIndex, FRayTracingPipelineState *Pipeline, uint32 HitGroupIndex, uint32 NumUniformBuffers, FRHIUniformBuffer *const *UniformBuffers, uint32 LooseParameterDataSize, const void *LooseParameterData, uint32 UserData)
Definition RHICommandList.h:4473
void CopyTexture(FRHITexture *SourceTextureRHI, FRHITexture *DestTextureRHI, const FRHICopyTextureInfo &CopyInfo)
Definition RHICommandList.h:4213
void SetRayTracingHitGroups(FRHIShaderBindingTable *SBT, FRayTracingPipelineState *Pipeline, uint32 NumBindings, const FRayTracingLocalShaderBindings *Bindings, bool bCopyDataToInlineStorage=true)
Definition RHICommandList.h:4449
void CopyBufferRegion(FRHIBuffer *DestBuffer, uint64 DstOffset, FRHIBuffer *SourceBuffer, uint64 SrcOffset, uint64 NumBytes)
Definition RHICommandList.h:4334
void EndRenderQuery(FRHIRenderQuery *RenderQuery)
Definition RHICommandList.h:4242
FRHICommandList(FRHIGPUMask GPUMask, bool bImmediate)
Definition RHICommandList.h:3828
void SetBatchedShaderUnbinds(FRHIGraphicsShader *InShader, FRHIBatchedShaderUnbinds &InBatchedUnbinds)
Definition RHICommandList.h:3941
void DispatchMeshShader(uint32 ThreadGroupCountX, uint32 ThreadGroupCountY, uint32 ThreadGroupCountZ)
Definition RHICommandList.h:4160
void SetShaderParameters(FRHIGraphicsShader *InShader, TConstArrayView< uint8 > InParametersData, TConstArrayView< FRHIShaderParameter > InParameters, TConstArrayView< FRHIShaderParameterResource > InResourceParameters, TConstArrayView< FRHIShaderParameterResource > InBindlessParameters)
Definition RHICommandList.h:3873
void CommitShaderBindingTable(FRHIShaderBindingTable *SBT, FRHIBuffer *InlineBindingDataBuffer)
Definition RHICommandList.h:4361
FRHICommandList(FRHIGPUMask GPUMask=FRHIGPUMask::All())
Definition RHICommandList.h:3838
void SetGraphicsPipelineState(class FGraphicsPipelineState *GraphicsPipelineState, const FBoundShaderStateInput &ShaderInput, uint32 StencilRef, bool bApplyAdditionalState)
Definition RHICommandList.h:4100
void MultiDrawIndexedPrimitiveIndirect(FRHIBuffer *IndexBuffer, FRHIBuffer *ArgumentsBuffer, uint32 ArgumentOffset, FRHIBuffer *CountBuffer, uint32 CountBufferOffset, uint32 MaxDrawArguments)
Definition RHICommandList.h:4149
void CommitShaderBindingTable(FRHIShaderBindingTable *SBT)
Definition RHICommandList.h:4355
void SetViewport(float MinX, float MinY, float MinZ, float MaxX, float MaxY, float MaxZ)
Definition RHICommandList.h:4015
void ClearShaderBindingTable(FRHIShaderBindingTable *SBT)
Definition RHICommandList.h:4377
void DrawPrimitive(uint32 BaseVertexIndex, uint32 NumPrimitives, uint32 NumInstances)
Definition RHICommandList.h:3962
void SetStereoViewport(float LeftMinX, float RightMinX, float LeftMinY, float RightMinY, float MinZ, float LeftMaxX, float RightMaxX, float LeftMaxY, float RightMaxY, float MaxZ)
Definition RHICommandList.h:4026
void SetDefaultRayTracingHitGroup(FRHIShaderBindingTable *SBT, FRayTracingPipelineState *Pipeline, uint32 HitGroupIndex)
Definition RHICommandList.h:4510
void ApplyCachedRenderTargets(FGraphicsPipelineStateInitializer &GraphicsPSOInit)
Definition RHICommandList.h:4048
void EnqueueLambda(const TCHAR *LambdaName, LAMBDA &&Lambda)
Definition RHICommandList.h:3853
void GpuHangCommandListCorruption()
Definition RHICommandList.h:4191
FRHIVertexShader * GetBoundVertexShader() const
Definition RHICommandList.h:3846
void SetStencilRef(uint32 StencilRef)
Definition RHICommandList.h:4003
void EndRenderPass()
Definition RHICommandList.h:4291
void SetDepthBounds(float MinDepth, float MaxDepth)
Definition RHICommandList.h:4180
void NextSubpass()
Definition RHICommandList.h:4320
void SetBlendFactor(const FLinearColor &BlendFactor=FLinearColor::White)
Definition RHICommandList.h:3951
void ResummarizeHTile(FRHITexture *DepthTexture)
Definition RHICommandList.h:4227
void SetRayTracingCallableShader(FRHIShaderBindingTable *SBT, uint32 RecordIndex, FRayTracingPipelineState *Pipeline, uint32 ShaderIndexInPipeline, uint32 NumUniformBuffers, FRHIUniformBuffer *const *UniformBuffers, uint32 UserData)
Definition RHICommandList.h:4520
FRHIAmplificationShader * GetBoundAmplificationShader() const
Definition RHICommandList.h:3848
void SetStreamSourceSlot(uint32 StreamIndex, FRHIStreamSourceSlot *StreamSourceSlot, uint32 Offset)
Definition RHICommandList.h:3994
void SetRayTracingCallableShaders(FRHIShaderBindingTable *SBT, FRayTracingPipelineState *Pipeline, uint32 NumBindings, const FRayTracingLocalShaderBindings *Bindings, bool bCopyDataToInlineStorage=true)
Definition RHICommandList.h:4457
void DrawIndexedPrimitive(FRHIBuffer *IndexBuffer, int32 BaseVertexIndex, uint32 FirstInstance, uint32 NumVertices, uint32 StartIndex, uint32 NumPrimitives, uint32 NumInstances)
Definition RHICommandList.h:3973
static FRHICommandList & Get(FRHICommandListBase &RHICmdList)
Definition RHICommandList.h:3833
void SetShaderUnbinds(FRHIGraphicsShader *InShader, TConstArrayView< FRHIShaderParameterUnbind > InUnbinds)
Definition RHICommandList.h:3923
void SetScissorRect(bool bEnable, uint32 MinX, uint32 MinY, uint32 MaxX, uint32 MaxY)
Definition RHICommandList.h:4037
void DrawIndexedPrimitiveIndirect(FRHIBuffer *IndexBuffer, FRHIBuffer *ArgumentsBuffer, uint32 ArgumentOffset)
Definition RHICommandList.h:4138
void BeginRenderQuery(FRHIRenderQuery *RenderQuery)
Definition RHICommandList.h:4237
Definition RHICommandList.h:5217
RHI_API ~FRHIComputeCommandList_RecursiveHazardous()
Definition RHICommandList.cpp:1725
Definition RHICommandList.h:2735
void BeginUAVOverlap(FRHIUnorderedAccessView *UAV)
Definition RHICommandList.h:3199
void RayTraceDispatchIndirect(FRayTracingPipelineState *Pipeline, FRHIRayTracingShader *RayGenShader, FRHIShaderBindingTable *SBT, const FRayTracingShaderBindings &GlobalResourceBindings, FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset)
Definition RHICommandList.h:3687
void DispatchGraphicsShaderBundle(TFunction< void(FRHICommandDispatchGraphicsShaderBundle &)> &&RecordCallback)
Definition RHICommandList.h:3159
void WriteGPUFence(FRHIGPUFence *Fence)
Definition RHICommandList.h:3390
void BeginTransitions(TArrayView< const FRHITransition * > Transitions)
Definition RHICommandList.h:2973
void SetUniformBufferDynamicOffset(FUniformBufferStaticSlot Slot, uint32 Offset)
Definition RHICommandList.h:2815
void EndUAVOverlap(TArrayView< FRHIUnorderedAccessView *const > UAVs)
Definition RHICommandList.h:3225
void EnqueueLambda_NoMarker(LAMBDA &&Lambda)
Definition RHICommandList.h:2775
void SetStaticUniformBuffers(const FUniformBufferStaticBindings &UniformBuffers)
Definition RHICommandList.h:2795
void BuildAccelerationStructure(const FRayTracingSceneBuildParams &SceneBuildParams)
Definition RHICommandList.h:3748
RHI_API void BuildAccelerationStructures(TConstArrayView< FRayTracingGeometryBuildParams > Params)
Definition RHICommandList.cpp:2006
void SetShaderUnbinds(FRHIComputeShader *InShader, TConstArrayView< FRHIShaderParameterUnbind > InUnbinds)
Definition RHICommandList.h:2871
void SubmitCommandsHint()
Definition RHICommandList.inl:63
void SetComputePipelineState(FComputePipelineState *ComputePipelineState, FRHIComputeShader *ComputeShader)
Definition RHICommandList.h:2897
void DispatchComputeShaderBundle(TFunction< void(FRHICommandDispatchComputeShaderBundle &)> &&RecordCallback)
Definition RHICommandList.h:3119
void ClearUAVUint(FRHIUnorderedAccessView *UnorderedAccessViewRHI, const FUintVector4 &Values)
Definition RHICommandList.h:2959
void BeginUAVOverlap()
Definition RHICommandList.h:3179
void DispatchComputeShaderBundle(FRHIShaderBundle *ShaderBundle, FRHIBuffer *RecordArgBuffer, TConstArrayView< FRHIShaderParameterResource > SharedBindlessParameters, TConstArrayView< FRHIShaderBundleComputeDispatch > Dispatches, bool bEmulated)
Definition RHICommandList.h:3100
void EnqueueLambda(const TCHAR *LambdaName, LAMBDA &&Lambda)
Definition RHICommandList.h:2761
FRHIComputeCommandList(FRHICommandListBase &&Other)
Definition RHICommandList.h:2756
static FRHIComputeCommandList & Get(FRHICommandListBase &RHICmdList)
Definition RHICommandList.h:2747
void TransferResources(TConstArrayView< FTransferResourceParams > Params)
Definition RHICommandList.h:3421
void SetTrackedAccess(TArrayView< const FRHITrackedAccessInfo > Infos)
Definition RHICommandList.h:3043
void RayTraceDispatch(FRayTracingPipelineState *Pipeline, FRHIRayTracingShader *RayGenShader, FRHIShaderBindingTable *SBT, const FRayTracingShaderBindings &GlobalResourceBindings, uint32 Width, uint32 Height)
Definition RHICommandList.h:3668
void CopyToStagingBuffer(FRHIBuffer *SourceBuffer, FRHIStagingBuffer *DestinationStagingBuffer, uint32 Offset, uint32 NumBytes)
Definition RHICommandList.h:3380
void SetAsyncComputeBudget(EAsyncComputeBudget Budget)
Definition RHICommandList.h:2909
void EndTransitions(TArrayView< const FRHITransition * > Transitions)
Definition RHICommandList.h:2996
void BindAccelerationStructureMemory(FRHIRayTracingScene *Scene, FRHIBuffer *Buffer, uint32 BufferOffset)
Definition RHICommandList.h:3788
void BeginUAVOverlap(TArrayView< FRHIUnorderedAccessView *const > UAVs)
Definition RHICommandList.h:3211
void OnBoundShaderChanged(FRHIComputeShader *InBoundComputeShaderRHI)
Definition RHICommandList.h:2737
void BeginTransition(const FRHITransition *Transition)
Definition RHICommandList.h:3022
void DispatchGraphicsShaderBundle(FRHIShaderBundle *ShaderBundle, FRHIBuffer *RecordArgBuffer, const FRHIShaderBundleGraphicsState &BundleState, TConstArrayView< FRHIShaderParameterResource > SharedBindlessParameters, TConstArrayView< FRHIShaderBundleGraphicsDispatch > Dispatches, bool bEmulated)
Definition RHICommandList.h:3140
void CrossGPUTransfer(TConstArrayView< FTransferResourceParams > Params, TConstArrayView< FCrossGPUTransferFence * > PreTransfer, TConstArrayView< FCrossGPUTransferFence * > PostTransfer)
Definition RHICommandList.h:3531
void TransferResourceWait(TConstArrayView< FTransferResourceFenceData * > FenceDatas)
Definition RHICommandList.h:3517
void SetComputeBudget(ESyncComputeBudget Budget)
Definition RHICommandList.h:2919
void ClearUAVFloat(FRHIUnorderedAccessView *UnorderedAccessViewRHI, const FVector4f &Values)
Definition RHICommandList.h:2949
void BuildAccelerationStructures(TConstArrayView< FRayTracingSceneBuildParams > Params)
Definition RHICommandList.h:3753
void SetBatchedShaderParameters(FRHIComputeShader *InShader, FRHIBatchedShaderParameters &InBatchedParameters)
Definition RHICommandList.h:2850
void DispatchComputeShader(uint32 ThreadGroupCountX, uint32 ThreadGroupCountY, uint32 ThreadGroupCountZ)
Definition RHICommandList.h:2929
void SetShaderParameters(FRHIComputeShader *InShader, TConstArrayView< uint8 > InParametersData, TConstArrayView< FRHIShaderParameter > InParameters, TConstArrayView< FRHIShaderParameterResource > InResourceParameters, TConstArrayView< FRHIShaderParameterResource > InBindlessParameters)
Definition RHICommandList.h:2825
FRHIComputeCommandList(FRHIGPUMask GPUMask=FRHIGPUMask::All())
Definition RHICommandList.h:2752
void EnqueueLambda(LAMBDA &&Lambda)
Definition RHICommandList.h:2788
void SetShaderRootConstants(const FUint32Vector4 &Constants)
Definition RHICommandList.h:3080
FRHIComputeShader * GetBoundComputeShader() const
Definition RHICommandList.h:2793
void SetStaticUniformBuffer(FUniformBufferStaticSlot Slot, FRHIUniformBuffer *Buffer)
Definition RHICommandList.h:2805
void DispatchIndirectComputeShader(FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset)
Definition RHICommandList.h:2939
void TransferResourceSignal(TConstArrayView< FTransferResourceFenceData * > FenceDatas, FRHIGPUMask SrcGPUMask)
Definition RHICommandList.h:3503
void Transition(const FRHITransitionInfo &Info, ERHITransitionCreateFlags CreateFlags=ERHITransitionCreateFlags::None)
Definition RHICommandList.h:3032
void CrossGPUTransferWait(TConstArrayView< FCrossGPUTransferFence * > SyncPoints)
Definition RHICommandList.h:3654
void CrossGPUTransferSignal(TConstArrayView< FTransferResourceParams > Params, TConstArrayView< FCrossGPUTransferFence * > PreTransfer)
Definition RHICommandList.h:3593
void SetGPUMask(FRHIGPUMask InGPUMask)
Definition RHICommandList.h:3395
void SetTrackedAccess(TArrayView< const FRHITransitionInfo > Infos, ERHIPipeline PipelinesAfter)
Definition RHICommandList.h:3059
RHI_API void BuildAccelerationStructure(FRHIRayTracingGeometry *Geometry)
Definition RHICommandList.cpp:1989
void SetComputeShaderRootConstants(const FUint32Vector4 &Constants)
Definition RHICommandList.h:3090
void SetBatchedShaderUnbinds(FRHIComputeShader *InShader, FRHIBatchedShaderUnbinds &InBatchedUnbinds)
Definition RHICommandList.h:2887
RHI_API void Transition(TArrayView< const FRHITransitionInfo > Infos, ERHITransitionCreateFlags CreateFlags=ERHITransitionCreateFlags::None)
Definition RHICommandList.cpp:1947
void EndUAVOverlap()
Definition RHICommandList.h:3189
void PostExternalCommandsReset()
Definition RHICommandList.h:3804
void EndTransition(const FRHITransition *Transition)
Definition RHICommandList.h:3027
void BuildAccelerationStructures(TConstArrayView< FRayTracingGeometryBuildParams > Params, const FRHIBufferRange &ScratchBufferRange)
Definition RHICommandList.h:3722
FRHIComputeCommandList(FRHIGPUMask GPUMask, bool bImmediate)
Definition RHICommandList.h:2742
void EndUAVOverlap(FRHIUnorderedAccessView *UAV)
Definition RHICommandList.h:3205
FORCEINLINE_DEBUGGABLE void ExecuteMultiIndirectClusterOperation(const FRayTracingClusterOperationParams &Params)
Definition RHICommandList.h:3706
Definition RHIResources.h:1078
Definition RHIResources.h:1018
Definition RHIResources.h:5541
Definition RHIResources.h:4073
ERenderTargetStoreAction DepthStoreAction
Definition RHIResources.h:4078
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
ERenderTargetStoreAction GetStencilStoreAction() const
Definition RHIResources.h:4087
Definition RHIResources.h:2387
FThreadSafeCounter NumPendingWriteCommands
Definition RHIResources.h:2437
Definition RHIResources.h:978
Definition RHIResources.h:1058
Definition RHIResources.h:947
Definition RHIResources.h:960
Definition RHIResources.h:972
Definition RHIResources.h:3729
Definition RHIResources.h:1115
Definition RHIResources.h:3755
Definition RHIResources.h:984
Definition RHIResources.h:2444
Definition RHIResourceCollection.h:46
Definition RHIResources.h:671
Definition RHIResources.h:4167
Definition RHIResources.h:3863
Definition RHIResources.h:3919
Definition RHIResources.h:3304
Definition RHIResources.h:3981
Definition RHIResources.h:1643
Definition RHICommandList.h:5272
FRHISubCommandList(FRHIGPUMask GPUMask, TSharedPtr< FRHIParallelRenderPassInfo > const &RenderPassInfo)
Definition RHICommandList.h:5274
Definition RHITextureReference.h:8
Definition RHIResources.h:2153
EPixelFormat GetFormat() const
Definition RHIResources.h:2341
FRHITexture * GetTexture2DArray()
Definition RHIResources.h:2319
ETextureCreateFlags GetFlags() const
Definition RHIResources.h:2344
uint32 GetNumSamples() const
Definition RHIResources.h:2347
Definition RHIResources.h:1232
Definition RHIResources.h:3294
Definition RHIResources.h:954
Definition RHIResources.h:1265
Definition RHIResources.h:2515
Definition RHIResources.h:1106
Definition RHIResources.h:1033
Definition PipelineStateCache.cpp:1285
Definition RHITypes.h:16
Definition RHICommandList.h:5514
static ENamedThreads::Type GetDesiredThread()
Definition RHICommandList.h:5516
Definition ScopeLock.h:141
Definition RHICommandList.h:4582
FScopedRHIThreadStaller()=delete
~FScopedRHIThreadStaller()
Definition RHICommandList.inl:49
Definition ThreadSafeCounter.h:14
int32 Increment()
Definition ThreadSafeCounter.h:52
Definition RHIContext.h:49
Definition PipelineStateCache.cpp:1174
Definition RHIContext.h:693
virtual void RHINextSubpass()
Definition RHIContext.h:858
virtual void RHISetStereoViewport(float LeftMinX, float RightMinX, float LeftMinY, float RightMinY, float MinZ, float LeftMaxX, float RightMaxX, float LeftMaxY, float RightMaxY, float MaxZ)
Definition RHIContext.h:744
virtual void RHISetStreamSource(uint32 StreamIndex, FRHIBuffer *VertexBuffer, uint32 Offset)=0
virtual void RHIDrawIndexedPrimitive(FRHIBuffer *IndexBuffer, int32 BaseVertexIndex, uint32 FirstInstance, uint32 NumVertices, uint32 StartIndex, uint32 NumPrimitives, uint32 NumInstances)=0
virtual void RHIDrawPrimitiveIndirect(FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset)=0
virtual void RHICommitShaderBindingTable(FRHIShaderBindingTable *SBT, FRHIBuffer *InlineBindingDataBuffer)
Definition RHIContext.h:876
virtual void RHICopyBufferRegion(FRHIBuffer *DestBuffer, uint64 DstOffset, FRHIBuffer *SourceBuffer, uint64 SrcOffset, uint64 NumBytes)=0
virtual void RHISetBlendFactor(const FLinearColor &BlendFactor)
Definition RHIContext.h:788
virtual void RHISetShaderUnbinds(FRHIGraphicsShader *Shader, TConstArrayView< FRHIShaderParameterUnbind > InUnbinds)
Definition RHIContext.h:781
virtual void RHIResummarizeHTile(FRHITexture *DepthTexture)
Definition RHIContext.h:717
virtual void RHIDispatchIndirectMeshShader(FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset)
Definition RHIContext.h:821
virtual void RHISetBindingsOnShaderBindingTable(FRHIShaderBindingTable *SBT, FRHIRayTracingPipelineState *Pipeline, uint32 NumBindings, const FRayTracingLocalShaderBindings *Bindings, ERayTracingBindingType BindingType)
Definition RHIContext.h:871
virtual void RHIDrawIndexedPrimitiveIndirect(FRHIBuffer *IndexBuffer, FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset)=0
virtual void RHISetDepthBounds(float MinDepth, float MaxDepth)=0
virtual void RHISetShadingRate(EVRSShadingRate ShadingRate, EVRSRateCombiner Combiner)
Definition RHIContext.h:839
virtual void RHIEndRenderPass()=0
virtual void RHIDispatchMeshShader(uint32 ThreadGroupCountX, uint32 ThreadGroupCountY, uint32 ThreadGroupCountZ)
Definition RHIContext.h:816
virtual void RHIClearShaderBindingTable(FRHIShaderBindingTable *SBT)
Definition RHIContext.h:866
virtual void RHIBeginRenderPass(const FRHIRenderPassInfo &InInfo, const TCHAR *InName)=0
virtual void RHISetGraphicsPipelineState(FRHIGraphicsPipelineState *GraphicsState, uint32 StencilRef, bool bApplyAdditionalState)=0
virtual void RHIDrawPrimitive(uint32 BaseVertexIndex, uint32 NumPrimitives, uint32 NumInstances)=0
virtual void RHISetViewport(float MinX, float MinY, float MinZ, float MaxX, float MaxY, float MaxZ)=0
virtual void RHIMultiDrawIndexedPrimitiveIndirect(FRHIBuffer *IndexBuffer, FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset, FRHIBuffer *CountBuffer, uint32 CountBuffeOffset, uint32 MaxDrawArguments)
Definition RHIContext.h:811
virtual void RHISetScissorRect(bool bEnable, uint32 MinX, uint32 MinY, uint32 MaxX, uint32 MaxY)=0
virtual void RHICopyTexture(FRHITexture *SourceTexture, FRHITexture *DestTexture, const FRHICopyTextureInfo &CopyInfo)=0
virtual void RHISetStencilRef(uint32 StencilRef)
Definition RHIContext.h:786
virtual void RHIGpuHangCommandListCorruption()
Definition RHIContext.h:834
virtual void RHISetShaderParameters(FRHIGraphicsShader *Shader, TConstArrayView< uint8 > InParametersData, TConstArrayView< FRHIShaderParameter > InParameters, TConstArrayView< FRHIShaderParameterResource > InResourceParameters, TConstArrayView< FRHIShaderParameterResource > InBindlessParameters)=0
Definition RHIContext.h:257
virtual void RHISetStaticUniformBuffer(FUniformBufferStaticSlot Slot, FRHIUniformBuffer *UniformBuffer)=0
virtual void RHIDispatchComputeShaderBundle(FRHIShaderBundle *ShaderBundle, FRHIBuffer *RecordArgBuffer, TConstArrayView< FRHIShaderParameterResource > SharedBindlessParameters, TConstArrayView< FRHIShaderBundleComputeDispatch > Dispatches, bool bEmulated)
Definition RHIContext.h:322
virtual void RHIBeginUAVOverlap()
Definition RHIContext.h:337
virtual void RHISetStaticUniformBuffers(const FUniformBufferStaticBindings &InUniformBuffers)=0
IRHIComputeContext & GetLowestLevelContext()
Definition RHIContext.h:506
virtual void RHISetShaderUnbinds(FRHIComputeShader *ComputeShader, TConstArrayView< FRHIShaderParameterUnbind > InUnbinds)
Definition RHIContext.h:357
virtual void RHIClearUAVFloat(FRHIUnorderedAccessView *UnorderedAccessViewRHI, const FVector4f &Values)=0
virtual void RHIEndUAVOverlap()
Definition RHIContext.h:338
virtual void RHIBuildAccelerationStructures(TConstArrayView< FRayTracingGeometryBuildParams > Params, const FRHIBufferRange &ScratchBufferRange)
Definition RHIContext.h:476
void SetTrackedAccess(const FRHITrackedAccessInfo &Info)
Definition RHIContext.h:516
virtual void RHIEndTransitions(TArrayView< const FRHITransition * > Transitions)=0
virtual void RHISetUniformBufferDynamicOffset(FUniformBufferStaticSlot Slot, uint32 Offset)
Definition RHIContext.h:366
virtual void RHIPostExternalCommandsReset()
Definition RHIContext.h:535
virtual void RHIBeginTransitions(TArrayView< const FRHITransition * > Transitions)=0
virtual void RHISetShaderParameters(FRHIComputeShader *ComputeShader, TConstArrayView< uint8 > InParametersData, TConstArrayView< FRHIShaderParameter > InParameters, TConstArrayView< FRHIShaderParameterResource > InResourceParameters, TConstArrayView< FRHIShaderParameterResource > InBindlessParameters)=0
virtual void RHISetComputeBudget(ESyncComputeBudget Budget)
Definition RHIContext.h:289
virtual void RHIBindAccelerationStructureMemory(FRHIRayTracingScene *Scene, FRHIBuffer *Buffer, uint32 BufferOffset)
Definition RHIContext.h:486
virtual void RHIDispatchGraphicsShaderBundle(FRHIShaderBundle *ShaderBundle, FRHIBuffer *RecordArgBuffer, const FRHIShaderBundleGraphicsState &BundleState, TConstArrayView< FRHIShaderParameterResource > SharedBindlessParameters, TConstArrayView< FRHIShaderBundleGraphicsDispatch > Dispatches, bool bEmulated)
Definition RHIContext.h:329
virtual void RHICopyToStagingBuffer(FRHIBuffer *SourceBufferRHI, FRHIStagingBuffer *DestinationStagingBufferRHI, uint32 InOffset, uint32 InNumBytes)
Definition RHIContext.h:383
virtual void RHIExecuteMultiIndirectClusterOperation(const FRayTracingClusterOperationParams &Params)
Definition RHIContext.h:471
virtual void RHIRayTraceDispatchIndirect(FRHIRayTracingPipelineState *RayTracingPipelineState, FRHIRayTracingShader *RayGenShader, FRHIShaderBindingTable *SBT, const FRayTracingShaderBindings &GlobalResourceBindings, FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset)
Definition RHIContext.h:279
virtual void RHISetAsyncComputeBudget(EAsyncComputeBudget Budget)
Definition RHIContext.h:288
virtual void RHISetComputePipelineState(FRHIComputePipelineState *ComputePipelineState)=0
FRHICommandListBase & GetExecutingCommandList() const
Definition RHIContext.h:543
virtual void RHIDispatchIndirectComputeShader(FRHIBuffer *ArgumentBuffer, uint32 ArgumentOffset)=0
virtual void RHIClearUAVUint(FRHIUnorderedAccessView *UnorderedAccessViewRHI, const FUintVector4 &Values)=0
virtual void RHIRayTraceDispatch(FRHIRayTracingPipelineState *RayTracingPipelineState, FRHIRayTracingShader *RayGenShader, FRHIShaderBindingTable *SBT, const FRayTracingShaderBindings &GlobalResourceBindings, uint32 Width, uint32 Height)
Definition RHIContext.h:272
virtual void RHISetShaderRootConstants(const FUint32Vector4 &Constants)
Definition RHIContext.h:317
virtual void RHIDispatchComputeShader(uint32 ThreadGroupCountX, uint32 ThreadGroupCountY, uint32 ThreadGroupCountZ)=0
Definition RHIContext.h:234
Definition RHIContext.h:573
Definition ArrayView.h:139
UE_FORCEINLINE_HINT constexpr ElementType * GetData() const
Definition ArrayView.h:295
UE_FORCEINLINE_HINT constexpr SizeType Num() const
Definition ArrayView.h:380
Definition Array.h:670
SizeType Remove(const ElementType &Item)
Definition Array.h:3091
bool Contains(const ComparisonType &Item) const
Definition Array.h:1518
UE_FORCEINLINE_HINT SizeType Emplace(ArgsType &&... Args)
Definition Array.h:2561
Definition IConsoleManager.h:1792
Definition AndroidPlatformMisc.h:14
Definition RHICommandList.h:5170
TRHICommandList_RecursiveHazardous(ContextType *Context)
Definition RHICommandList.h:5192
void RunOnContext(LAMBDA &&Lambda)
Definition RHICommandList.h:5197
Definition RHICommandList.h:5227
void RunOnContext(LAMBDA &&Lambda)
Definition RHICommandList.h:5254
TRHIComputeCommandList_RecursiveHazardous(ContextType *Context)
Definition RHICommandList.h:5249
Definition RHIPipeline.h:55
Definition SharedPointer.h:692
UE_FORCEINLINE_HINT const bool IsValid() const
Definition SharedPointer.h:1085
Definition StaticArray.h:26
@ Range
Definition EnvQueryTypes.h:81
Definition RHICommandList.h:4571
Type
Definition RHICommandList.h:4573
@ WaitForOutstandingTasksOnly
Definition RHICommandList.h:4574
@ DispatchToRHIThread
Definition RHICommandList.h:4575
@ FlushRHIThread
Definition RHICommandList.h:4576
@ FlushRHIThreadFlushResources
Definition RHICommandList.h:4577
Type
Definition TaskGraphInterfaces.h:57
Definition RHICommandList.h:110
Type
Definition RHICommandList.h:112
@ WaitingForGPUPresent
Definition RHICommandList.h:115
@ WaitingForAllOtherSleep
Definition RHICommandList.h:113
@ WaitingForGPUQuery
Definition RHICommandList.h:114
@ Num
Definition RHICommandList.h:116
void Dispatch(FRHIComputeCommandList &RHICmdList, const TShaderRef< TShaderClass > &ComputeShader, const FShaderParametersMetadata *ParametersMetadata, const typename TShaderClass::FParameters &Parameters, FIntVector GroupCount)
Definition RenderGraphUtils.h:491
FUniformParams Params
Definition MeshPaintVirtualTexture.cpp:162
State
Definition PacketHandler.h:88
Definition RHIUniformBufferUtilities.h:12
RHI_API FRayTracingShaderBindings ConvertRayTracingShaderBindings(const FRHIBatchedShaderParameters &BatchedParameters)
Definition RHICommandList.cpp:2375
RHI_API void CopySharedMips(FRHICommandList &RHICmdList, FRHITexture *SrcTexture, FRHITexture *DstTexture)
Definition RHI.cpp:2284
RHI_API void CopySharedMips_AssumeSRVMaskState(FRHICommandList &RHICmdList, FRHITexture *SrcTexture, FRHITexture *DstTexture)
Definition RHI.cpp:2302
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
static CORE_API uint32 CaptureStackBackTrace(uint64 *BackTrace, uint32 MaxDepth, void *Context=nullptr)
Definition AndroidPlatformStackWalk.cpp:215
Definition AndroidPlatformTime.h:18
static uint32 Cycles()
Definition AndroidPlatformTime.h:27
Definition RHIResources.h:4362
constexpr FRHIGeometryShader * GetGeometryShader() const
Definition RHIResources.h:4496
FRHIPixelShader * PixelShaderRHI
Definition RHIResources.h:4510
constexpr FRHIMeshShader * GetMeshShader() const
Definition RHIResources.h:4486
constexpr FRHIAmplificationShader * GetAmplificationShader() const
Definition RHIResources.h:4488
FRHIVertexShader * VertexShaderRHI
Definition RHIResources.h:4509
Definition Color.h:486
Definition Color.h:48
static CORE_API const FLinearColor White
Definition Color.h:456
Definition RHICommandList.h:290
EResourceLockMode LockMode
Definition RHICommandList.h:295
void * RHIBuffer
Definition RHICommandList.h:291
FLockParams(void *InRHIBuffer, void *InBuffer, uint32 InOffset, uint32 InBufferSize, EResourceLockMode InLockMode)
Definition RHICommandList.h:297
uint32 Offset
Definition RHICommandList.h:294
uint32 BufferSize
Definition RHICommandList.h:293
void * Buffer
Definition RHICommandList.h:292
Definition RHICommandList.h:288
FLockParams Unlock(void *RHIBuffer)
Definition RHICommandList.h:325
FCriticalSection CriticalSection
Definition RHICommandList.h:307
void Lock(void *RHIBuffer, void *Buffer, uint32 Offset, uint32 SizeRHI, EResourceLockMode LockMode)
Definition RHICommandList.h:314
TArray< FLockParams, TInlineAllocator< 16 > > OutstandingLocks
Definition RHICommandList.h:308
FLockTracker()
Definition RHICommandList.h:310
static UE_FORCEINLINE_HINT void * Memcpy(void *Dest, const void *Src, SIZE_T Count)
Definition UnrealMemory.h:160
Definition RHIShaderParameters.h:241
FRHIBatchedShaderParametersAllocator & Allocator
Definition RHIShaderParameters.h:242
bool HasParameters() const
Definition RHIShaderParameters.h:252
void Reset()
Definition RHIShaderParameters.h:264
Definition RHIShaderParameters.h:374
void Reset()
Definition RHIShaderParameters.h:382
bool HasParameters() const
Definition RHIShaderParameters.h:377
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 & SetInitActionResourceArray(FResourceArrayUploadInterface *InInitialData)
Definition RHIResources.h:1546
FRHIBufferCreateDesc & SetInitialState(ERHIAccess InInitialState)
Definition RHIResources.h:1528
static FRHIBufferCreateDesc CreateNull(const TCHAR *InDebugName)
Definition RHIResources.h:1433
FRHIBufferCreateDesc & SetOwnerName(FName InOwnerName)
Definition RHIResources.h:1532
ERHIBufferInitAction InitAction
Definition RHIResources.h:1568
FRHIBufferCreateDesc & SetClassName(FName InClassName)
Definition RHIResources.h:1531
uint32 Size
Definition RHIResources.h:1323
bool IsNull() const
Definition RHIResources.h:1354
Definition RHIBufferInitializer.h:12
RHI_API FBufferRHIRef Finalize()
Definition RHIBufferInitializer.cpp:17
Definition RHICommandList.h:212
uint64 Offset
Definition RHICommandList.h:214
class FRHIBuffer * Buffer
Definition RHICommandList.h:213
uint64 Size
Definition RHICommandList.h:215
Definition RHICommandList.h:349
virtual void ExecuteAndDestruct(FRHICommandListBase &CmdList)=0
FRHICommandBase * Next
Definition RHICommandList.h:350
Definition RHICommandList.h:1457
FBoundShaderStateInput BoundShaderInput
Definition RHICommandList.h:1478
uint8 bRecursive
Definition RHICommandList.h:1471
TStaticArray< void *, MAX_NUM_GPUS > QueryBatchData_Occlusion
Definition RHICommandList.h:1492
TStaticArray< void *, MAX_NUM_GPUS > QueryBatchData_Timestamp
Definition RHICommandList.h:1491
FRHIGPUMask CurrentGPUMask
Definition RHICommandList.h:1475
uint8 bInsideOcclusionQueryBatch
Definition RHICommandList.h:1470
uint8 bInsideRenderPass
Definition RHICommandList.h:1468
FRHICommandListScopedFence * CurrentFenceScope
Definition RHICommandList.h:1481
uint8 bImmediate
Definition RHICommandList.h:1472
uint8 MultiViewCount
Definition RHICommandList.h:1464
uint8 bHasFragmentDensityAttachment
Definition RHICommandList.h:1466
FRHIComputeShader * BoundComputeShaderRHI
Definition RHICommandList.h:1479
FRHIGPUMask InitialGPUMask
Definition RHICommandList.h:1476
TStaticArray< FRHIRenderTargetView, MaxSimultaneousRenderTargets > CachedRenderTargets
Definition RHICommandList.h:1459
FRHIDepthRenderTargetView CachedDepthStencilTarget
Definition RHICommandList.h:1460
uint8 SubpassIndex
Definition RHICommandList.h:1463
uint8 bInsideComputePass
Definition RHICommandList.h:1469
ESubpassHint SubpassHint
Definition RHICommandList.h:1462
FPersistentState(FRHIGPUMask InInitialGPUMask, bool bInImmediate=false, bool bTrackResources=true)
Definition RHICommandList.h:1494
uint32 CachedNumSimultanousRenderTargets
Definition RHICommandList.h:1458
uint8 bAllowResourceStateTracking
Definition RHICommandList.h:1473
FRHIWorkGraphShader * BoundWorkGraphShaderRHI
Definition RHICommandList.h:1480
Definition RHICommandList.h:1383
FRHIBatchedShaderParameters * ScratchShaderParameters
Definition RHICommandList.h:1384
FShaderParameterState(FShaderParameterState &&RHS)
Definition RHICommandList.h:1389
~FShaderParameterState()
Definition RHICommandList.h:1397
FRHIBatchedShaderParametersAllocator * AllocatorsRoot
Definition RHICommandList.h:1385
IRHIComputeContext * Context
Definition RHICommandList.h:5404
IRHIPlatformCommandList * FinalizedCmdList
Definition RHICommandList.h:5405
Definition RHICommandList.h:4665
FQueuedCommandList(FRHICommandListBase *InCmdList)
Definition RHICommandList.h:4670
FRHICommandListBase * CmdList
Definition RHICommandList.h:4667
Definition RHICommandList.h:1604
void ExecuteAndDestruct(FRHICommandListBase &CmdList) override final
Definition RHICommandList.h:1614
Definition RHICommandList.h:183
FIntVector DestPosition
Definition RHICommandList.h:199
FIntVector Size
Definition RHICommandList.h:195
uint32 NumMips
Definition RHICommandList.h:208
FIntRect GetSourceRect() const
Definition RHICommandList.h:184
uint32 SourceMipIndex
Definition RHICommandList.h:206
uint32 DestMipIndex
Definition RHICommandList.h:207
uint32 DestSliceIndex
Definition RHICommandList.h:202
FIntVector SourcePosition
Definition RHICommandList.h:198
FIntRect GetDestRect() const
Definition RHICommandList.h:189
uint32 SourceSliceIndex
Definition RHICommandList.h:201
uint32 NumSlices
Definition RHICommandList.h:203
Definition RHIStats.h:110
Definition RHIStats.h:137
void AddDraw(FRHIGPUMask GPUMask, FRHIDrawStatsCategory const *Category)
Definition RHIStats.h:199
void AddDrawAndPrimitives(FRHIGPUMask GPUMask, FRHIDrawStatsCategory const *Category, EPrimitiveType PrimitiveType, uint32 NumPrimitives)
Definition RHIStats.h:209
Definition MultiGPU.h:33
static GPUMASK_CONSTEXPR FRHIGPUMask FromIndex(uint32 GPUIndex)
Definition MultiGPU.h:181
static SGPU_CONSTEXPR FRHIGPUMask All()
Definition MultiGPU.h:191
bool NeedsExtraTransitions
Definition RHIGlobals.h:726
bool NeedsShaderUnbinds
Definition RHIGlobals.h:708
Definition DynamicRHI.h:149
static FRHILockTextureArgs Lock2DArray(FRHITexture *InTexture, uint32 InArrayIndex, uint32 InMipIndex, EResourceLockMode InLockMode, bool bInLockWithinMiptail)
Definition DynamicRHI.h:162
static FRHILockTextureArgs LockCubeFace(FRHITexture *InTexture, uint32 InFaceIndex, uint32 InArrayIndex, uint32 InMipIndex, EResourceLockMode InLockMode, bool bInLockWithinMiptail)
Definition DynamicRHI.h:174
static FRHILockTextureArgs Lock2D(FRHITexture *InTexture, uint32 InMipIndex, EResourceLockMode InLockMode, bool bInLockWithinMiptail, bool bFlushRHIThread=true)
Definition DynamicRHI.h:150
Definition DynamicRHI.h:198
Definition RHIResources.h:5248
Definition RHI.h:543
Definition RHICommandList.h:5094
FRHIScopedGPUMask(FRHIScopedGPUMask const &)=delete
~FRHIScopedGPUMask()
Definition RHICommandList.h:5105
FRHIScopedGPUMask(FRHIScopedGPUMask &&)=delete
FRHIGPUMask PrevGPUMask
Definition RHICommandList.h:5096
FRHIScopedGPUMask(FRHIComputeCommandList &InRHICmdList, FRHIGPUMask InGPUMask)
Definition RHICommandList.h:5098
FRHIComputeCommandList & RHICmdList
Definition RHICommandList.h:5095
Definition RHIShaderParameters.h:398
Definition RHIShaderParameters.h:428
Definition RHIShaderParameters.h:414
Definition RHIResources.h:1938
FResourceBulkDataInterface * BulkData
Definition RHIResources.h:2140
ERHIAccess InitialState
Definition RHIResources.h:2134
ETextureCreateFlags Flags
Definition RHIResources.h:1844
Definition RHITextureInitializer.h:50
Definition RHIResources.h:5570
Definition RHITransition.h:450
Definition RHITransition.h:119
Definition RHITransition.h:475
Definition RHIResources.h:1150
Definition RHIResources.h:2812
Definition RHIResources.h:2883
Definition RHIResources.h:2955
FInitializer & SetPlane(ERHITexturePlane InPlane)
Definition RHIResources.h:3004
FInitializer & SetMipRange(uint8 InFirstMip, uint8 InNumMips)
Definition RHIResources.h:3010
FInitializer & SetArrayRange(uint16 InFirstElement, uint16 InNumElements)
Definition RHIResources.h:3027
FInitializer & SetDisableSRGB(bool InDisableSRGB)
Definition RHIResources.h:3034
Definition RHIResources.h:3042
static FBufferUAV::FInitializer CreateBufferUAV()
Definition RHIResources.h:3129
static FTextureUAV::FInitializer CreateTextureUAV()
Definition RHIResources.h:3139
static FTextureSRV::FInitializer CreateTextureSRV()
Definition RHIResources.h:3134
static FBufferSRV::FInitializer CreateBufferSRV()
Definition RHIResources.h:3124
Definition RHI.h:278
Definition RHIResources.h:3693
Definition RHIResources.h:3842
Definition RHIContext.h:643
Definition RHIResources.h:3761
Definition RHIContext.h:590
Definition RHIResources.h:3496
Definition RHIResources.h:3398
Definition RHICommandList.h:267
uint8 * LooseParameterData
Definition RHICommandList.h:277
const FRHIRayTracingGeometry * Geometry
Definition RHICommandList.h:269
uint32 RecordIndex
Definition RHICommandList.h:271
uint16 NumUniformBuffers
Definition RHICommandList.h:274
FRHIUniformBuffer ** UniformBuffers
Definition RHICommandList.h:276
uint32 ShaderIndexInPipeline
Definition RHICommandList.h:272
ERayTracingLocalShaderBindingType BindingType
Definition RHICommandList.h:268
uint32 UserData
Definition RHICommandList.h:273
uint32 SegmentIndex
Definition RHICommandList.h:270
uint16 LooseParameterDataSize
Definition RHICommandList.h:275
Definition RHIContext.h:600
Definition RHIResources.h:3635
Definition RHICommandList.h:248
TArray< FRHIShaderParameterResource > BindlessParameters
Definition RHICommandList.h:255
FRHIUnorderedAccessView * UAVs[16]
Definition RHICommandList.h:253
FRHIUniformBuffer * UniformBuffers[16]
Definition RHICommandList.h:251
FRHIShaderResourceView * SRVs[64]
Definition RHICommandList.h:250
FRHITexture * Textures[64]
Definition RHICommandList.h:249
FRHISamplerState * Samplers[32]
Definition RHICommandList.h:252
Definition RHICommandList.h:125
const ERenderThreadIdleTypes::Type Type
Definition RHICommandList.h:128
~FRenderThreadIdleScope()
Definition RHICommandList.h:139
UE::Stats::FThreadIdleStats::FScopeIdle RHIThreadIdleScope
Definition RHICommandList.h:126
const bool bCondition
Definition RHICommandList.h:129
FRenderThreadIdleScope(ERenderThreadIdleTypes::Type Type, bool bInCondition=true)
Definition RHICommandList.h:132
const uint32 Start
Definition RHICommandList.h:130
Definition RHI.h:232
Definition RHICommandList.h:5121
FRHIComputeCommandList & RHICmdList
Definition RHICommandList.h:5146
~FScopedUniformBufferStaticBindings()
Definition RHICommandList.h:5137
FScopedUniformBufferStaticBindings(FRHIComputeCommandList &InRHICmdList, TArgs... Args)
Definition RHICommandList.h:5133
FScopedUniformBufferStaticBindings(FRHIComputeCommandList &InRHICmdList, FUniformBufferStaticBindings UniformBuffers)
Definition RHICommandList.h:5122
Definition DynamicRHI.h:72
Definition RHIStats.h:12
Definition RHIContext.h:152
Definition RHICommandList.h:1598
static const TCHAR * TStr()
Definition RHICommandList.h:1599
Definition RHICommandList.h:220
uint8 PlatformData[64]
Definition RHICommandList.h:241
uint32 FrameNumber
Definition RHICommandList.h:240
FUpdateTextureRegion3D UpdateRegion
Definition RHICommandList.h:235
uint32 MipIndex
Definition RHICommandList.h:234
FUpdateTexture3DData(FRHITexture *InTexture, uint32 InMipIndex, const struct FUpdateTextureRegion3D &InUpdateRegion, uint32 InSourceRowPitch, uint32 InSourceDepthPitch, uint8 *InSourceData, uint32 InDataSizeBytes, uint32 InFrameNumber)
Definition RHICommandList.h:221
FRHITexture * Texture
Definition RHICommandList.h:233
uint32 DepthPitch
Definition RHICommandList.h:237
uint32 DataSizeBytes
Definition RHICommandList.h:239
uint32 RowPitch
Definition RHICommandList.h:236
uint8 * Data
Definition RHICommandList.h:238
Definition RHITypes.h:127
uint32 DestY
Definition RHITypes.h:130
uint32 Height
Definition RHITypes.h:138
uint32 DestX
Definition RHITypes.h:129
uint32 Width
Definition RHITypes.h:137
Definition RHITypes.h:155
uint32 Width
Definition RHITypes.h:167
uint32 DestZ
Definition RHITypes.h:159
uint32 Depth
Definition RHITypes.h:169
uint32 DestX
Definition RHITypes.h:157
uint32 DestY
Definition RHITypes.h:158
uint32 Height
Definition RHITypes.h:168
Definition LinuxPlatformSplash.cpp:43
static int32 Strlen(const CharType *String)
Definition CString.h:1047
static CharType * Strncpy(CharType *Dest, const CharType *Src, SIZE_T MaxLen)
Definition CString.h:991
Definition Optional.h:131
Definition RHICommandList.h:395
TRHILambdaCommandMultiPipe(LAMBDA &&InLambda, const TCHAR *InName, ERHIPipeline InPipelines)
Definition RHICommandList.h:402
void ExecuteAndDestruct(FRHICommandListBase &CmdList) override final
Definition RHICommandList.inl:272
ERHIPipeline Pipelines
Definition RHICommandList.h:400
LAMBDA Lambda
Definition RHICommandList.h:396
Definition RHICommandList.h:379
void ExecuteAndDestruct(FRHICommandListBase &CmdList) override final
Definition RHICommandList.h:386
LAMBDA Lambda
Definition RHICommandList.h:380
TRHILambdaCommand_NoMarker(LAMBDA &&InLambda)
Definition RHICommandList.h:382
Definition RHICommandList.h:356
void ExecuteAndDestruct(FRHICommandListBase &CmdList) override final
Definition RHICommandList.h:369
TRHILambdaCommand(LAMBDA &&InLambda, const TCHAR *InName)
Definition RHICommandList.h:362
LAMBDA Lambda
Definition RHICommandList.h:357
Definition IntPoint.h:25
IntType Y
Definition IntVector.h:34
IntType X
Definition IntVector.h:31
static const TIntVector3 ZeroValue
Definition IntVector.h:45
Definition ThreadIdleStats.h:81