UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RHIValidation.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 RHIValidation.h: Public Valdation RHI definitions.
5=============================================================================*/
6
7#pragma once
8
9#include "RHI.h"
10#include "RHIValidationCommon.h"
11#include "RHIValidationUtils.h"
13
14#if ENABLE_RHI_VALIDATION
15
16// Controls whether BUF_SourceCopy should be validate or not.
18
19
20// This is a macro because we only want to evaluate the message expression if the checked expression is false.
21#define RHI_VALIDATION_CHECK(InExpression, InMessage) \
22 do \
23 { \
24 if(UNLIKELY(!(InExpression))) \
25 { \
26 FValidationRHI::ReportValidationFailure(InMessage); \
27 } \
28 }while(0)
29
30class FValidationRHI : public FDynamicRHI
31{
32public:
34 RHI_API virtual ~FValidationRHI();
35
36 static inline void ValidateThreadGroupCount(uint32 ThreadGroupCountX, uint32 ThreadGroupCountY, uint32 ThreadGroupCountZ)
37 {
38 RHI_VALIDATION_CHECK((ThreadGroupCountX <= (uint32)GRHIMaxDispatchThreadGroupsPerDimension.X), *FString::Printf(TEXT("ThreadGroupCountX is invalid: %u. Must be greater than 0 and less than %d"), ThreadGroupCountX, GRHIMaxDispatchThreadGroupsPerDimension.X));
39 RHI_VALIDATION_CHECK((ThreadGroupCountY <= (uint32)GRHIMaxDispatchThreadGroupsPerDimension.Y), *FString::Printf(TEXT("ThreadGroupCountY is invalid: %u. Must be greater than 0 and less than %d"), ThreadGroupCountY, GRHIMaxDispatchThreadGroupsPerDimension.Y));
40 RHI_VALIDATION_CHECK((ThreadGroupCountZ <= (uint32)GRHIMaxDispatchThreadGroupsPerDimension.Z), *FString::Printf(TEXT("ThreadGroupCountZ is invalid: %u. Must be greater than 0 and less than %d"), ThreadGroupCountZ, GRHIMaxDispatchThreadGroupsPerDimension.Z));
41 }
42
43 static inline void ValidateIndirectArgsBuffer(FRHIBuffer* ArgumentBuffer, uint32 ArgumentOffset, uint32 ArgumentSize, uint32 ArgumentsBoundarySize)
44 {
45 auto GetBufferDesc = [&]() -> FString { return FString::Printf(TEXT("Buffer: %s, Size: %u, Stride: %u, Offset: %u, ArgSize: %u"), ArgumentBuffer->GetDebugName(), ArgumentBuffer->GetSize(), ArgumentBuffer->GetStride(), ArgumentOffset, ArgumentSize); };
46 RHI_VALIDATION_CHECK(EnumHasAnyFlags(ArgumentBuffer->GetUsage(), EBufferUsageFlags::VertexBuffer | EBufferUsageFlags::ByteAddressBuffer), *FString::Printf(TEXT("Indirect argument buffer must be a vertex or byte address buffer to be used as an indirect dispatch parameter. %s"), *GetBufferDesc()));
47 RHI_VALIDATION_CHECK(EnumHasAnyFlags(ArgumentBuffer->GetUsage(), EBufferUsageFlags::DrawIndirect), *FString::Printf(TEXT("Indirect dispatch parameter buffer was not flagged with BUF_DrawIndirect. %s"), *GetBufferDesc()));
48 RHI_VALIDATION_CHECK((ArgumentOffset % 4) == 0, *FString::Printf(TEXT("Indirect argument offset must be a multiple of 4. %s"), *GetBufferDesc()));
49 RHI_VALIDATION_CHECK((ArgumentOffset + ArgumentSize) <= ArgumentBuffer->GetSize(), *FString::Printf(TEXT("Indirect argument doesn't fit in the buffer. %s"), *GetBufferDesc()));
51 {
53 *FString::Printf(TEXT("Indirect arguments cannot cross %d byte boundary. %s"), ArgumentsBoundarySize, *GetBufferDesc()));
54 }
55 }
56
57 static inline void ValidateDispatchIndirectArgsBuffer(FRHIBuffer* ArgumentBuffer, uint32 ArgumentOffset)
58 {
60 }
61
62 virtual void Init() override final
63 {
64 RHI->Init();
65 RHIName = RHI->GetName();
66 RHIName += TEXT("_Validation");
69 }
70
72 virtual void PostInit() override final
73 {
74 // Need to copy this as each DynamicRHI has an instance
75 check(RHI->PixelFormatBlockBytes.Num() <= PixelFormatBlockBytes.Num());
76 RHI->PixelFormatBlockBytes = PixelFormatBlockBytes;
77 RHI->PostInit();
78 }
79
81 virtual void Shutdown() override final
82 {
83 RHI->Shutdown();
84 }
85
86 virtual const TCHAR* GetName() override final
87 {
88 return *RHIName;
89 }
90
91 virtual ERHIInterfaceType GetInterfaceType() const override final
92 {
93 return RHI->GetInterfaceType();
94 }
95
97 {
98 return RHI;
99 }
100
102
103 virtual void RHIEndFrame_RenderThread(FRHICommandListImmediate& RHICmdList) override final;
104 virtual void RHIEndFrame(const FRHIEndFrameArgs& Args) override final;
105
106 // FlushType: Thread safe
108 {
109 return RHI->RHICreateSamplerState(Initializer);
110 }
111
112 // FlushType: Thread safe
114 {
115 return RHI->RHICreateRasterizerState(Initializer);
116 }
117
118 // FlushType: Thread safe
120 {
121 FDepthStencilStateRHIRef State = RHI->RHICreateDepthStencilState(Initializer);
122
123 // @todo: remove this and use the PSO's dsmode instead?
124 // Determine the actual depth stencil mode that applies for this state
126 if (Initializer.DepthTest != CF_Always || Initializer.bEnableDepthWrite)
127 {
128 DepthStencilMode = Initializer.bEnableDepthWrite
131 }
132
133 // set up stencil testing if it's enabled
134 if (Initializer.bEnableFrontFaceStencil || Initializer.bEnableBackFaceStencil)
135 {
136 bool bBackFaceStencilWriteEnabled = false;
137
138 // bEnableBackFaceStencil means to use separate settings for the Back, not if it's enabled at all
139 if (Initializer.bEnableBackFaceStencil)
140 {
142 (Initializer.BackFaceStencilFailStencilOp != SO_Keep ||
143 Initializer.BackFacePassStencilOp != SO_Keep ||
144 Initializer.BackFaceDepthFailStencilOp != SO_Keep);
145 }
146
147 if (Initializer.StencilReadMask != 0)
148 {
150 }
151 if (Initializer.StencilWriteMask != 0)
152 {
154 Initializer.FrontFaceStencilFailStencilOp != SO_Keep ||
155 Initializer.FrontFacePassStencilOp != SO_Keep ||
156 Initializer.FrontFaceDepthFailStencilOp != SO_Keep;
157
159 {
161 }
162 }
163 }
164 State->ActualDSMode = DepthStencilMode;
165 // @todo: remove this and use the PSO's dsmode instead?
166
167 DepthStencilStates.FindOrAdd(State.GetReference()) = Initializer;
168 return State;
169 }
170
171 // FlushType: Thread safe
173 {
174 return RHI->RHICreateBlendState(Initializer);
175 }
176
177 // FlushType: Wait RHI Thread
179 {
180 return RHI->RHICreateVertexDeclaration(Elements);
181 }
182
183 // FlushType: Wait RHI Thread
185 {
186 return RHI->RHICreatePixelShader(Code, Hash);
187 }
188
189 // FlushType: Wait RHI Thread
191 {
192 return RHI->RHICreateVertexShader(Code, Hash);
193 }
194
195 // FlushType: Wait RHI Thread
197 {
199 return RHI->RHICreateGeometryShader(Code, Hash);
200 }
201
202 // FlushType: Wait RHI Thread
204 {
206 return RHI->RHICreateMeshShader(Code, Hash);
207 }
208
209 // FlushType: Wait RHI Thread
211 {
213 return RHI->RHICreateAmplificationShader(Code, Hash);
214 }
215
216 // Some RHIs can have pending messages/logs for error tracking, or debug modes
217 virtual void FlushPendingLogs() override final
218 {
219 RHI->FlushPendingLogs();
220 }
221
222 // FlushType: Wait RHI Thread
224 {
225 return RHI->RHICreateComputeShader(Code, Hash);
226 }
227
235 // FlushType: Must be Thread-Safe.
236 virtual FRHIShaderLibraryRef RHICreateShaderLibrary(EShaderPlatform Platform, FString const& FilePath, FString const& Name) override final
237 {
238 return RHI->RHICreateShaderLibrary(Platform, FilePath, Name);
239 }
240
241 virtual FGPUFenceRHIRef RHICreateGPUFence(const FName &Name) override final
242 {
243 return RHI->RHICreateGPUFence(Name);
244 }
245
246 virtual void RHIWriteGPUFence_TopOfPipe(FRHICommandListBase& RHICmdList, FRHIGPUFence* FenceRHI) override final
247 {
248 RHI->RHIWriteGPUFence_TopOfPipe(RHICmdList, FenceRHI);
249 }
250
251 virtual void RHICreateTransition(FRHITransition* Transition, const FRHITransitionCreateInfo& CreateInfo);
252
253 virtual void RHIReleaseTransition(FRHITransition* Transition)
254 {
255 RHI->RHIReleaseTransition(Transition);
256 }
257
259
264 // FlushType: Thread safe.
266 {
267 return RHI->RHICreateStagingBuffer();
268 }
269
279 virtual void* RHILockStagingBuffer(FRHIStagingBuffer* StagingBuffer, FRHIGPUFence* Fence, uint32 Offset, uint32 SizeRHI) override final
280 {
281 return RHI->RHILockStagingBuffer(StagingBuffer, Fence, Offset, SizeRHI);
282 }
283
288 virtual void RHIUnlockStagingBuffer(FRHIStagingBuffer* StagingBuffer) override final
289 {
290 RHI->RHIUnlockStagingBuffer(StagingBuffer);
291 }
292
303 virtual void* LockStagingBuffer_RenderThread(class FRHICommandListImmediate& RHICmdList, FRHIStagingBuffer* StagingBuffer, FRHIGPUFence* Fence, uint32 Offset, uint32 SizeRHI) override final
304 {
305 return RHI->LockStagingBuffer_RenderThread(RHICmdList, StagingBuffer, Fence, Offset, SizeRHI);
306 }
307
313 virtual void UnlockStagingBuffer_RenderThread(class FRHICommandListImmediate& RHICmdList, FRHIStagingBuffer* StagingBuffer) override final
314 {
315 RHI->UnlockStagingBuffer_RenderThread(RHICmdList, StagingBuffer);
316 }
317
318 virtual void RHIMapStagingSurface_RenderThread(class FRHICommandListImmediate& RHICmdList, FRHITexture* Texture, uint32 GPUIndex, FRHIGPUFence* Fence, void*& OutData, int32& OutWidth, int32& OutHeight)
319 {
320 RHI->RHIMapStagingSurface_RenderThread(RHICmdList, Texture, GPUIndex, Fence, OutData, OutWidth, OutHeight);
321 }
322
324 {
325 RHI->RHIUnmapStagingSurface_RenderThread(RHICmdList, Texture, GPUIndex);
326 }
327
337 // FlushType: Thread safe, but varies depending on the RHI
339 {
340 return RHI->RHICreateBoundShaderState(VertexDeclaration, VertexShader, PixelShader, GeometryShader);
341 }
342
343#if PLATFORM_SUPPORTS_MESH_SHADERS && PLATFORM_USE_FALLBACK_PSO
352 // FlushType: Thread safe, but varies depending on the RHI
354 {
355 return RHI->RHICreateBoundShaderState(AmplificationShader, MeshShader, PixelShader);
356 }
357#endif
358
368 // FlushType: Thread safe
369 // TODO: [PSO API] Make pure virtual
371 {
373 FGraphicsPipelineStateRHIRef PSO = RHI->RHICreateGraphicsPipelineState(Initializer);
374 if (PSO.IsValid())
375 {
376 PSO->DSMode = Initializer.DepthStencilState->ActualDSMode;
377 }
378 return PSO;
379 }
380
382 {
383 return RHI->RHICreateComputePipelineState(Initializer);
384 }
385
393 // FlushType: Thread safe, but varies depending on the RHI override final
395 {
396 check(Layout);
397 check(Layout->Resources.Num() > 0 || Layout->ConstantBufferSize > 0);
398 FUniformBufferRHIRef UniformBuffer = RHI->RHICreateUniformBuffer(Contents, Layout, Usage, Validation);
399
400 // Use the render thread frame ID for any non RHI thread allocations. TODO: This is actually incorrect as command list recording on the render thread timeline
401 // can straddle EndFrame boundaries, causing a uniform buffer allocated in frame N to be recorded as being allocated in frame N+1. The solution here is to introduce
402 // a command list to RHICreateUniformBuffer so that the correct render thread frame can be propagated. Unfortunately, in the meantime, this means that the lifetime
403 // tracker can miss legitimate cases. For example, if a (single frame) uniform buffer is allocated in frame N (but straddles to frame N+1), and then is incorrectly
404 // used in frame N+1, that test will pass because they are equal. However, since the issue is timing dependent, it's still likely to catch legitimate allocation misuses.
405 UniformBuffer->InitLifetimeTracking(IsInRHIThread() ? RHIThreadFrameID : RenderThreadFrameID.load(std::memory_order_relaxed), Contents, Usage);
406 return UniformBuffer;
407 }
408
409 virtual void RHIUpdateUniformBuffer(FRHICommandListBase& RHICmdList, FRHIUniformBuffer* UniformBufferRHI, const void* Contents) override final
410 {
411 check(UniformBufferRHI);
412 check(Contents);
413 RHI->RHIUpdateUniformBuffer(RHICmdList, UniformBufferRHI, Contents);
414
415 RHICmdList.EnqueueLambda([this, UniformBufferRHI] (FRHICommandListBase& RHICmdList)
416 {
417 UniformBufferRHI->UpdateAllocation(RHIThreadFrameID);
418 });
419 }
420
421 [[nodiscard]] virtual FRHIBufferInitializer RHICreateBufferInitializer(FRHICommandListBase& RHICmdList, const FRHIBufferCreateDesc& CreateDesc) final override
422 {
423 return RHI->RHICreateBufferInitializer(RHICmdList, CreateDesc);
424 }
425
426 // FlushType: Flush RHI Thread
427 virtual void* RHILockBuffer(class FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer, uint32 Offset, uint32 SizeRHI, EResourceLockMode LockMode) override final;
428 virtual void* RHILockBufferMGPU(class FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer, uint32 GPUIndex, uint32 Offset, uint32 SizeRHI, EResourceLockMode LockMode) override final;
429
430 // FlushType: Flush RHI Thread
431 virtual void RHIUnlockBuffer(class FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer) override final
432 {
433 RHI->RHIUnlockBuffer(RHICmdList, Buffer);
434 }
435 virtual void RHIUnlockBufferMGPU(class FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer, uint32 GPUIndex) override final
436 {
437 RHI->RHIUnlockBufferMGPU(RHICmdList, Buffer, GPUIndex);
438 }
439
440#if ENABLE_LOW_LEVEL_MEM_TRACKER || UE_MEMORY_TRACE_ENABLED
441 virtual void RHIUpdateAllocationTags(class FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer) override final
442 {
443 RHI->RHIUpdateAllocationTags(RHICmdList, Buffer);
444 }
445#endif
446
448 {
449 return RHI->RHICreateTextureReference(RHICmdList, InReferencedTexture);
450 }
452 {
453 RHI->RHIUpdateTextureReference(RHICmdList, TextureRef, NewTexture);
454 }
455
456 virtual FShaderResourceViewRHIRef RHICreateShaderResourceView(class FRHICommandListBase& RHICmdList, FRHIViewableResource* Resource, FRHIViewDesc const& ViewDesc) override final;
457 virtual FUnorderedAccessViewRHIRef RHICreateUnorderedAccessView(class FRHICommandListBase& RHICmdList, FRHIViewableResource* Resource, FRHIViewDesc const& ViewDesc) override final;
458
460 {
461 return RHI->RHICreateResourceCollection(RHICmdList, InMembers);
462 }
463
465 {
466 RHI_VALIDATION_CHECK(InStartIndex < static_cast<uint32>(InResourceCollection->GetMembers().Num()) && InStartIndex + InMemberUpdates.Num() <= static_cast<uint32>(InResourceCollection->GetMembers().Num()),
467 *FString::Printf(TEXT("ResourceCollection update range of [%d, %d) is invalid for a ResourceCollection of size '%d'"), InStartIndex, InStartIndex + InMemberUpdates.Num(), InResourceCollection->GetMembers().Num()));
468
469 RHI->RHIUpdateResourceCollection(RHICmdList, InResourceCollection, InStartIndex, InMemberUpdates);
470 }
471
472 virtual FRHICalcTextureSizeResult RHICalcTexturePlatformSize(FRHITextureDesc const& Desc, uint32 FirstMipIndex) override final
473 {
474 ensure(Desc.IsValid());
475 ensure(FirstMipIndex < Desc.NumMips);
476
477 return RHI->RHICalcTexturePlatformSize(Desc, FirstMipIndex);
478 }
479
484 // FlushType: Thread safe
485 virtual void RHIGetTextureMemoryStats(FTextureMemoryStats& OutStats) override final
486 {
487 RHI->RHIGetTextureMemoryStats(OutStats);
488 }
489
501 // FlushType: Flush Immediate
502 virtual bool RHIGetTextureMemoryVisualizeData(FColor* TextureData, int32 SizeX, int32 SizeY, int32 Pitch, int32 PixelSize) override final
503 {
504 return RHI->RHIGetTextureMemoryVisualizeData(TextureData, SizeX, SizeY, Pitch, PixelSize);
505 }
506
508 {
511 {
512 FFinalizeCallback OriginalFinalizeCallback = MoveTemp(FinalizeCallback);
514 {
516 ensure(Texture->IsBarrierTrackingInitialized());
517 return Texture;
518 };
519
520 // ue-todo: custom GetSubresourceCallback?
521 }
522 };
523
524 [[nodiscard]]
525 virtual FRHITextureInitializer RHICreateTextureInitializer(FRHICommandListBase& RHICmdList, const FRHITextureCreateDesc& CreateDesc) override final
526 {
527 CreateDesc.CheckValidity();
528 return FRHIValidationTextureInitializer(CreateDesc, RHI->RHICreateTextureInitializer(RHICmdList, CreateDesc));
529 }
530
531
546 // FlushType: Thread safe
548 {
550 ensure(FMath::Max(SizeX, SizeY) >= (1u << (FMath::Max(1u, NumMips) - 1)));
551 FTextureRHIRef Texture = RHI->RHIAsyncCreateTexture2D(SizeX, SizeY, Format, NumMips, Flags, InResourceState, InitialMipData, NumInitialMips, DebugName, OutCompletionEvent);
552 ensure(Texture->IsBarrierTrackingInitialized());
553 return Texture;
554 }
555
557 {
558 RHI->RHIReplaceResources(RHICmdList, MoveTemp(ReplaceInfos));
559 }
560
567 // FlushType: Thread safe
568 virtual uint32 RHIComputeMemorySize(FRHITexture* TextureRHI) override final
569 {
570 return RHI->RHIComputeMemorySize(TextureRHI);
571 }
572
588 // FlushType: Flush RHI Thread
589 // NP: Note that no RHI currently implements this as an async call, we should simplify the API.
591 {
592 // TODO: find proper state for new texture
593 ERHIAccess ResourceState = ERHIAccess::SRVMask;
594
595 FTextureRHIRef NewTexture2D = RHI->RHIAsyncReallocateTexture2D(Texture2D, NewMipCount, NewSizeX, NewSizeY, RequestStatus);
596 NewTexture2D->InitBarrierTracking(NewMipCount, 1, NewTexture2D->GetFormat(), NewTexture2D->GetFlags(), ResourceState, NewTexture2D->GetTrackerResource()->GetDebugName()); // @todo the threading of GetDebugName() is wrong.
597 return NewTexture2D;
598 }
599
600 virtual FRHILockTextureResult RHILockTexture(FRHICommandListImmediate& RHICmdList, const FRHILockTextureArgs& Arguments) final override;
601 virtual void RHIUnlockTexture(FRHICommandListImmediate& RHICmdList, const FRHILockTextureArgs& Arguments) final override;
602
611 // FlushType: Flush RHI Thread
612 virtual void RHIUpdateTexture2D(FRHICommandListBase& RHICmdList, FRHITexture* Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D& UpdateRegion, uint32 SourcePitch, const uint8* SourceData) override final
613 {
614 RHI->RHIUpdateTexture2D(RHICmdList, Texture, MipIndex, UpdateRegion, SourcePitch, SourceData);
615 }
616
617 virtual void RHIUpdateFromBufferTexture2D(FRHICommandListBase& RHICmdList, FRHITexture* Texture, uint32 MipIndex, const struct FUpdateTextureRegion2D& UpdateRegion, uint32 SourcePitch, FRHIBuffer* Buffer, uint32 BufferOffset) override final
618 {
619 RHI->RHIUpdateFromBufferTexture2D(RHICmdList, Texture, MipIndex, UpdateRegion, SourcePitch, Buffer, BufferOffset);
620 }
621
631 // FlushType: Flush RHI Thread
632 virtual void RHIUpdateTexture3D(FRHICommandListBase& RHICmdList, FRHITexture* Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D& UpdateRegion, uint32 SourceRowPitch, uint32 SourceDepthPitch, const uint8* SourceData) override final
633 {
634 RHI->RHIUpdateTexture3D(RHICmdList, Texture, MipIndex, UpdateRegion, SourceRowPitch, SourceDepthPitch, SourceData);
635 }
636
637 // FlushType: Thread safe
638 virtual void RHIBindDebugLabelName(FRHICommandListBase& RHICmdList, FRHITexture* Texture, const TCHAR* Name) override final;
639
640 virtual void RHIBindDebugLabelName(FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer, const TCHAR* Name) override final;
641
642 virtual void RHIBindDebugLabelName(FRHICommandListBase& RHICmdList, FRHIUnorderedAccessView* UnorderedAccessViewRHI, const TCHAR* Name) override final;
643
648 // FlushType: Flush Immediate (seems wrong)
650 {
651 RHI->RHIReadSurfaceData(Texture, Rect, OutData, InFlags);
652 }
653
654 // Default fallback; will not work for non-8-bit surfaces and it's extremely slow.
656 {
657 RHI->RHIReadSurfaceData(Texture, Rect, OutData, InFlags);
658 }
659
661 // FlushType: Flush Immediate (seems wrong)
662 virtual void RHIMapStagingSurface(FRHITexture* Texture, FRHIGPUFence* Fence, void*& OutData, int32& OutWidth, int32& OutHeight, uint32 GPUIndex = 0) final override
663 {
664 RHI->RHIMapStagingSurface(Texture, Fence, OutData, OutWidth, OutHeight, GPUIndex);
665 }
666
668 // FlushType: Flush Immediate (seems wrong)
669 virtual void RHIUnmapStagingSurface(FRHITexture* Texture, uint32 GPUIndex = 0) override final
670 {
671 RHI->RHIUnmapStagingSurface(Texture, GPUIndex);
672 }
673
674 // FlushType: Flush Immediate (seems wrong)
675 virtual void RHIReadSurfaceFloatData(FRHITexture* Texture, FIntRect Rect, TArray<FFloat16Color>& OutData, ECubeFace CubeFace, int32 ArrayIndex, int32 MipIndex) override final
676 {
677 RHI->RHIReadSurfaceFloatData(Texture, Rect, OutData, CubeFace, ArrayIndex, MipIndex);
678 }
679
680 // FlushType: Flush Immediate (seems wrong)
682 {
683 RHI->RHIRead3DSurfaceFloatData(Texture, Rect, ZMinMax, OutData);
684 }
685
687 {
688 RHI->RHIRead3DSurfaceFloatData(Texture, Rect, ZMinMax, OutData, InFlags);
689 }
690
691 // FlushType: Wait RHI Thread
692 virtual FRenderQueryRHIRef RHICreateRenderQuery(ERenderQueryType QueryType) override final
693 {
694 return RHI->RHICreateRenderQuery(QueryType);
695 }
696 // CAUTION: Even though this is marked as threadsafe, it is only valid to call from the render thread. It is need not be threadsafe on platforms that do not support or aren't using an RHIThread
697 // FlushType: Thread safe, but varies by RHI
698 virtual bool RHIGetRenderQueryResult(FRHIRenderQuery* RenderQuery, uint64& OutResult, bool bWait, uint32 GPUIndex = INDEX_NONE) override final
699 {
700 return RHI->RHIGetRenderQueryResult(RenderQuery, OutResult, bWait, GPUIndex);
701 }
702
703 virtual void RHIBeginRenderQueryBatch_TopOfPipe(FRHICommandListBase& RHICmdList, ERenderQueryType QueryType) override final
704 {
705 RHI->RHIBeginRenderQueryBatch_TopOfPipe(RHICmdList, QueryType);
706 }
707
708 virtual void RHIEndRenderQueryBatch_TopOfPipe(FRHICommandListBase& RHICmdList, ERenderQueryType QueryType) override final
709 {
710 RHI->RHIEndRenderQueryBatch_TopOfPipe(RHICmdList, QueryType);
711 }
712
713 virtual void RHIBeginRenderQuery_TopOfPipe(FRHICommandListBase& RHICmdList, FRHIRenderQuery* RenderQuery) override final
714 {
715 RHI->RHIBeginRenderQuery_TopOfPipe(RHICmdList, RenderQuery);
716 }
717
718 virtual void RHIEndRenderQuery_TopOfPipe(FRHICommandListBase& RHICmdList, FRHIRenderQuery* RenderQuery) override final
719 {
720 RHI->RHIEndRenderQuery_TopOfPipe(RHICmdList, RenderQuery);
721 }
722
723 // FlushType: Thread safe
724 virtual uint32 RHIGetViewportNextPresentGPUIndex(FRHIViewport* Viewport) override final
725 {
726 return RHI->RHIGetViewportNextPresentGPUIndex(Viewport);
727 }
728
729 // With RHI thread, this is the current backbuffer from the perspective of the render thread.
730 // FlushType: Thread safe
731 virtual FTextureRHIRef RHIGetViewportBackBuffer(FRHIViewport* Viewport) override final
732 {
733 FTextureRHIRef Texture = RHI->RHIGetViewportBackBuffer(Viewport);
734 if (!Texture->GetTrackerResource()->IsBarrierTrackingInitialized())
735 {
736 // Assume present and renderer needs to perform transition to RTV if needed
737 ERHIAccess ResourceState = ERHIAccess::Present;
738 Texture->InitBarrierTracking(Texture->GetNumMips(), Texture->GetSizeXYZ().Z, Texture->GetFormat(), Texture->GetFlags(), ResourceState, TEXT("ViewportTexture"));
739 }
740 return Texture;
741 }
742
743 virtual FUnorderedAccessViewRHIRef RHIGetViewportBackBufferUAV(FRHIViewport* ViewportRHI) override final
744 {
745 return RHI->RHIGetViewportBackBufferUAV(ViewportRHI);
746 }
747
749 {
750 return RHI->RHIGetHTilePlatformConfig(DepthWidth, DepthHeight);
751 }
752
753 virtual uint32 RHIGetHTilePlatformConfig(const FRHITextureDesc& DepthDesc) const override final
754 {
755 return RHI->RHIGetHTilePlatformConfig(DepthDesc);
756 }
757
758 virtual void RHIAliasTextureResources(FTextureRHIRef& DestTexture, FTextureRHIRef& SourceTexture) override final
759 {
760 // Source and target need to be valid objects.
761 check(DestTexture && SourceTexture);
762 // Source texture must have been created (i.e. have a native resource backing).
763 check(SourceTexture->GetNativeResource() != nullptr);
764 RHI->RHIAliasTextureResources(DestTexture, SourceTexture);
765 }
766
767 virtual FTextureRHIRef RHICreateAliasedTexture(FTextureRHIRef& SourceTexture) override final
768 {
769 check(SourceTexture);
770 return RHI->RHICreateAliasedTexture(SourceTexture);
771 }
772
774 {
775 RHI->RHIGetDisplaysInformation(OutDisplayInformation);
776 }
777
778 // Only relevant with an RHI thread, this advances the backbuffer for the purpose of GetViewportBackBuffer
779 // FlushType: Thread safe
780 virtual void RHIAdvanceFrameForGetViewportBackBuffer(FRHIViewport* Viewport, bool bPresent) override final
781 {
782 RHI->RHIAdvanceFrameForGetViewportBackBuffer(Viewport, bPresent);
783 }
784
785 virtual void RHIAcquireThreadOwnership() override final
786 {
787 RHI->RHIAcquireThreadOwnership();
788 }
789
790 virtual void RHIReleaseThreadOwnership() override final
791 {
792 RHI->RHIReleaseThreadOwnership();
793 }
794
795 // Flush driver resources. Typically called when switching contexts/threads
796 // FlushType: Flush RHI Thread
797 virtual void RHIFlushResources() override final
798 {
799 RHI->RHIFlushResources();
800 }
801
802 // must be called from the main thread.
803 // FlushType: Thread safe
804 virtual FViewportRHIRef RHICreateViewport(void* WindowHandle, uint32 SizeX, uint32 SizeY, bool bIsFullscreen, EPixelFormat PreferredPixelFormat) override final
805 {
806 return RHI->RHICreateViewport(WindowHandle, SizeX, SizeY, bIsFullscreen, PreferredPixelFormat);
807 }
808
809 // must be called from the main thread.
810 // FlushType: Thread safe
811 virtual void RHIResizeViewport(FRHIViewport* Viewport, uint32 SizeX, uint32 SizeY, bool bIsFullscreen) override final
812 {
813 RHI->RHIResizeViewport(Viewport, SizeX, SizeY, bIsFullscreen);
814 }
815
816 virtual void RHIResizeViewport(FRHIViewport* Viewport, uint32 SizeX, uint32 SizeY, bool bIsFullscreen, EPixelFormat PreferredPixelFormat) override final
817 {
818 // Default implementation for RHIs that cannot change formats on the fly
819 RHI->RHIResizeViewport(Viewport, SizeX, SizeY, bIsFullscreen, PreferredPixelFormat);
820 }
821
823 {
824 return RHI->RHIPreferredPixelFormatHint(PreferredPixelFormat);
825 }
826
827 virtual void RHICheckViewportHDRStatus(FRHIViewport* Viewport) override final
828 {
829 RHI->RHICheckViewportHDRStatus(Viewport);
830 }
831
832 virtual void RHIHandleDisplayChange() override final
833 {
834 RHI->RHIHandleDisplayChange();
835 }
836
837 // must be called from the main thread.
838 // FlushType: Thread safe
839 virtual void RHITick(float DeltaTime) override final
840 {
841 RHI->RHITick(DeltaTime);
842 }
843
844 // Blocks the CPU until the GPU catches up and goes idle.
845 // FlushType: Flush Immediate (seems wrong)
846 virtual void RHIBlockUntilGPUIdle() override final
847 {
848 RHI->RHIBlockUntilGPUIdle();
849 }
850
851 // Tells the RHI we're about to suspend it
852 virtual void RHIBeginSuspendRendering() override final
853 {
854 RHI->RHIBeginSuspendRendering();
855 }
856
857 // Operations to suspend title rendering and yield control to the system
858 // FlushType: Thread safe
859 virtual void RHISuspendRendering() override final
860 {
861 RHI->RHISuspendRendering();
862 }
863
864 // FlushType: Thread safe
865 virtual void RHIResumeRendering() override final
866 {
867 RHI->RHIResumeRendering();
868 }
869
870 // FlushType: Flush Immediate
871 virtual bool RHIIsRenderingSuspended() override final
872 {
873 return RHI->RHIIsRenderingSuspended();
874 }
875
884 // FlushType: Thread safe
886 {
887 return RHI->RHIGetAvailableResolutions(Resolutions, bIgnoreRefreshRate);
888 }
889
895 // FlushType: Thread safe
896 virtual void RHIGetSupportedResolution(uint32& Width, uint32& Height) override final
897 {
898 RHI->RHIGetSupportedResolution(Width, Height);
899 }
900
907 // FlushType: Wait RHI Thread
908 virtual void RHIVirtualTextureSetFirstMipInMemory(FRHICommandListImmediate& RHICmdList, FRHITexture* Texture, uint32 FirstMip) override final
909 {
910 RHI->RHIVirtualTextureSetFirstMipInMemory(RHICmdList, Texture, FirstMip);
911 }
912
918 // FlushType: Wait RHI Thread
919 virtual void RHIVirtualTextureSetFirstMipVisible(FRHICommandListImmediate& RHICmdList, FRHITexture* Texture, uint32 FirstMip) override final
920 {
921 RHI->RHIVirtualTextureSetFirstMipVisible(RHICmdList, Texture, FirstMip);
922 }
923
927 // FlushType: Flush RHI Thread
928 virtual void* RHIGetNativeDevice() override final
929 {
930 return RHI->RHIGetNativeDevice();
931 }
932
936 // FlushType: Flush RHI Thread
937 virtual void* RHIGetNativePhysicalDevice() override final
938 {
939 return RHI->RHIGetNativePhysicalDevice();
940 }
941
945 // FlushType: Flush RHI Thread
946 virtual void* RHIGetNativeGraphicsQueue() override final
947 {
948 return RHI->RHIGetNativeGraphicsQueue();
949 }
950
954 // FlushType: Flush RHI Thread
955 virtual void* RHIGetNativeComputeQueue() override final
956 {
957 return RHI->RHIGetNativeComputeQueue();
958 }
959
963 // FlushType: Flush RHI Thread
964 virtual void* RHIGetNativeInstance() override final
965 {
966 return RHI->RHIGetNativeInstance();
967 }
968
972 // FlushType: Not Thread Safe!!
973 virtual void* RHIGetNativeCommandBuffer() override final
974 {
975 return RHI->RHIGetNativeCommandBuffer();
976 }
977
979 virtual IRHIComputeContext* RHIGetCommandContext(ERHIPipeline Pipeline, FRHIGPUMask GPUMask) override final;
980 virtual IRHIUploadContext* RHIGetUploadContext() final override
981 {
982 return RHI->RHIGetUploadContext();
983 }
984
985 virtual void RHICloseTranslateChain(FRHIFinalizeContextArgs&& Args, TRHIPipelineArray<IRHIPlatformCommandList*>& Output, bool bShouldFinalize) override final;
986
987 virtual void RHIFinalizeContext(FRHIFinalizeContextArgs&& Args, TRHIPipelineArray<IRHIPlatformCommandList*>& Output) override final;
988 virtual void RHISubmitCommandLists(FRHISubmitCommandListsArgs&& Args) override final;
989
992
993 virtual void RHIProcessDeleteQueue() override final
994 {
995 RHI->RHIProcessDeleteQueue();
996 }
997
999 {
1000 return RHI->RHIGetMinimumAlignmentForBufferBackedSRV(Format);
1001 }
1002
1004 {
1005 // TODO: find proper state for new texture
1006 ERHIAccess ResourceState = ERHIAccess::SRVMask;
1007
1008 FTextureRHIRef NewTexture2D = RHI->AsyncReallocateTexture2D_RenderThread(RHICmdList, Texture2D, NewMipCount, NewSizeX, NewSizeY, RequestStatus);
1009 NewTexture2D->InitBarrierTracking(NewMipCount, 1, NewTexture2D->GetFormat(), NewTexture2D->GetFlags(), ResourceState, NewTexture2D->GetTrackerResource()->GetDebugName()); // @todo the threading of GetDebugName() is wrong.
1010 return NewTexture2D;
1011 }
1012
1013 virtual void* LockBuffer_BottomOfPipe(class FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer, uint32 Offset, uint32 SizeRHI, EResourceLockMode LockMode) override final
1014 {
1015 RHI_VALIDATION_CHECK(LockMode != RLM_WriteOnly_NoOverwrite || GRHISupportsMapWriteNoOverwrite, TEXT("Using RLM_WriteOnly_NoOverwrite when the RHI doesn't support it."));
1016 return RHI->LockBuffer_BottomOfPipe(RHICmdList, Buffer, Offset, SizeRHI, LockMode);
1017 }
1018
1019 virtual void UnlockBuffer_BottomOfPipe(class FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer) override final
1020 {
1021 RHI->UnlockBuffer_BottomOfPipe(RHICmdList, Buffer);
1022 }
1023
1024 virtual FUpdateTexture3DData RHIBeginUpdateTexture3D(FRHICommandListBase& RHICmdList, FRHITexture* Texture, uint32 MipIndex, const struct FUpdateTextureRegion3D& UpdateRegion) override final
1025 {
1026 return RHI->RHIBeginUpdateTexture3D(RHICmdList, Texture, MipIndex, UpdateRegion);
1027 }
1028
1029 virtual void RHIEndUpdateTexture3D(FRHICommandListBase& RHICmdList, FUpdateTexture3DData& UpdateData) override final
1030 {
1031 RHI->RHIEndUpdateTexture3D(RHICmdList, UpdateData);
1032 }
1033
1035 {
1036 RHI->RHIEndMultiUpdateTexture3D(RHICmdList, UpdateDataArray);
1037 }
1038
1039 virtual FRHIShaderLibraryRef RHICreateShaderLibrary_RenderThread(class FRHICommandListImmediate& RHICmdList, EShaderPlatform Platform, FString FilePath, FString Name) override final
1040 {
1041 return RHI->RHICreateShaderLibrary_RenderThread(RHICmdList, Platform, FilePath, Name);
1042 }
1043
1044 virtual void RHIReadSurfaceFloatData_RenderThread(class FRHICommandListImmediate& RHICmdList, FRHITexture* Texture, FIntRect Rect, TArray<FFloat16Color>& OutData, ECubeFace CubeFace, int32 ArrayIndex, int32 MipIndex) override final
1045 {
1046 RHI->RHIReadSurfaceFloatData_RenderThread(RHICmdList, Texture, Rect, OutData, CubeFace, ArrayIndex, MipIndex);
1047 }
1048
1049 virtual FRHIFlipDetails RHIWaitForFlip(double TimeoutInSeconds) override final
1050 {
1051 return RHI->RHIWaitForFlip(TimeoutInSeconds);
1052 }
1053
1054 virtual void RHISignalFlipEvent() override final
1055 {
1056 RHI->RHISignalFlipEvent();
1057 }
1058
1060 {
1061 return RHI->RHIGetPlatformTextureMaxSampleCount();
1062 };
1063
1064
1065#if RHI_RAYTRACING
1067 {
1068 FRayTracingGeometryRHIRef Result = RHI->RHICreateRayTracingGeometry(RHICmdList, Initializer);
1069 Result->InitBarrierTracking(ERHIAccess::BVHWrite, *Initializer.DebugName.ToString()); // BVHs are always created in BVHWrite state
1070 return Result;
1071 }
1072
1074 {
1075 FRayTracingSceneRHIRef Result = RHI->RHICreateRayTracingScene(MoveTemp(Initializer));
1076 Result->InitBarrierTracking(ERHIAccess::BVHWrite, *Initializer.DebugName.ToString()); // BVHs are always created in BVHWrite state
1077 return Result;
1078 }
1079
1081 {
1082 return RHI->RHICreateRayTracingShader(Code, Hash, ShaderFrequency);
1083 }
1084
1086 {
1087 return RHI->RHICreateRayTracingPipelineState(Initializer);
1088 }
1089
1091 {
1092 return RHI->RHICalcRayTracingSceneSize(Initializer);
1093 }
1094
1096 {
1097 return RHI->RHICalcRayTracingGeometrySize(Initializer);
1098 }
1099
1101 {
1102 return RHI->RHICalcRayTracingClusterOperationSize(Initializer);
1103 }
1104
1106 {
1107 return RHI->RHIGetRayTracingGeometryOfflineMetadata(OfflineDataHeader);
1108 }
1109
1111 {
1112 return RHI->RHICreateShaderBindingTable(RHICmdList, Initializer);
1113 }
1114
1115#if !UE_BUILD_SHIPPING
1117 {
1118 return RHI->RHISerializeAccelerationStructure(RHICmdList, Scene, Path);
1119 }
1120#endif
1121#endif // RHI_RAYTRACING
1122
1123 virtual FShaderBundleRHIRef RHICreateShaderBundle(const FShaderBundleCreateInfo& CreateInfo) override final
1124 {
1125 return RHI->RHICreateShaderBundle(CreateInfo);
1126 }
1127
1128//protected:
1129 static void ReportValidationFailure(const TCHAR* InMessage);
1130
1133
1134 std::atomic_uint64_t RenderThreadFrameID;
1136
1137private:
1138 FString RHIName;
1141
1143
1144 // Shared validation logic, called from RHILockBuffer / RHILockBufferMGPU
1145 void LockBufferValidate(class FRHICommandListBase& RHICmdList, FRHIBuffer* Buffer, EResourceLockMode LockMode);
1146};
1147
1148#endif // ENABLE_RHI_VALIDATION
#define check(expr)
Definition AssertionMacros.h:314
#define ensure( InExpression)
Definition AssertionMacros.h:464
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
bool RHISupportsGeometryShaders(const FStaticShaderPlatform Platform)
Definition DataDrivenShaderPlatformInfo.h:1058
bool RHISupportsMeshShadersTier0(const FStaticShaderPlatform Platform)
Definition DataDrivenShaderPlatformInfo.h:1211
uint32 DepthHeight
Definition DynamicRHI.h:1286
FStagingBufferRHIRef RHICreateStagingBuffer()
Definition DynamicRHI.h:1140
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:35
EPixelFormat
Definition PixelFormat.h:16
ERHIAccess
Definition RHIAccess.h:11
EShaderFrequency
Definition RHIDefinitions.h:202
EUniformBufferUsage
Definition RHIDefinitions.h:536
@ SO_Keep
Definition RHIDefinitions.h:444
ECubeFace
Definition RHIDefinitions.h:525
EResourceLockMode
Definition RHIDefinitions.h:785
@ RLM_WriteOnly_NoOverwrite
Definition RHIDefinitions.h:788
@ CF_Always
Definition RHIDefinitions.h:414
EUniformBufferValidation
Definition RHIDefinitions.h:546
ERHIInterfaceType
Definition RHIDefinitions.h:157
ETextureCreateFlags
Definition RHIDefinitions.h:1091
ERenderQueryType
Definition RHIDefinitions.h:258
#define PLATFORM_DISPATCH_INDIRECT_ARGUMENT_BOUNDARY_SIZE
Definition RHIDefinitions.h:40
#define GRHIMaxDispatchThreadGroupsPerDimension
Definition RHIGlobals.h:881
#define GRHISupportsAsyncTextureCreation
Definition RHIGlobals.h:787
#define GRHISupportsMapWriteNoOverwrite
Definition RHIGlobals.h:911
ERHIPipeline
Definition RHIPipeline.h:13
EShaderPlatform
Definition RHIShaderPlatform.h:11
EShaderPlatform GMaxRHIShaderPlatform
Definition RHI.cpp:1335
CORE_API bool IsInRHIThread()
Definition ThreadingBase.cpp:339
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint32 Offset
Definition VulkanMemory.cpp:4033
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 RHI.h:403
Definition RHIResources.h:4820
Definition DynamicRHI.h:206
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 FRayTracingShaderRHIRef RHICreateRayTracingShader(TArrayView< const uint8 > Code, const FSHAHash &Hash, EShaderFrequency ShaderFrequency)
Definition DynamicRHI.h:1022
virtual FGeometryShaderRHIRef RHICreateGeometryShader(TArrayView< const uint8 > Code, const FSHAHash &Hash)=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 void Shutdown()=0
virtual RHI_API void RHIBindDebugLabelName(FRHICommandListBase &RHICmdList, FRHITexture *Texture, const TCHAR *Name)
Definition DynamicRHI.cpp:900
virtual void RHIHandleDisplayChange()
Definition DynamicRHI.h:746
friend class FValidationRHI
Definition DynamicRHI.h:1055
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 IRHITransientResourceAllocator * RHICreateTransientResourceAllocator()
Definition DynamicRHI.h:332
virtual FGraphicsPipelineStateRHIRef RHICreateGraphicsPipelineState(const FGraphicsPipelineStateInitializer &Initializer)=0
virtual void RHISuspendRendering()
Definition DynamicRHI.h:761
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
void RHICloseTranslateChain(FRHIFinalizeContextArgs &&Args, TRHIPipelineArray< IRHIPlatformCommandList * > &Output, bool bShouldFinalize)
Definition DynamicRHI.h:907
virtual FGPUFenceRHIRef RHICreateGPUFence(const FName &Name)=0
virtual void RHIBeginSuspendRendering()
Definition DynamicRHI.h:757
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 void RHIGetTextureMemoryStats(FTextureMemoryStats &OutStats)=0
virtual void UnlockBuffer_BottomOfPipe(class FRHICommandListBase &RHICmdList, FRHIBuffer *Buffer)
Definition DynamicRHI.h:971
virtual FVertexShaderRHIRef RHICreateVertexShader(TArrayView< const uint8 > Code, const FSHAHash &Hash)=0
virtual RHI_API void RHIEndUpdateTexture3D(FRHICommandListBase &RHICmdList, FUpdateTexture3DData &UpdateData)
Definition RHICommandList.cpp:2242
virtual FRHIBufferInitializer RHICreateBufferInitializer(FRHICommandListBase &RHICmdList, const FRHIBufferCreateDesc &CreateDesc)=0
virtual FUnorderedAccessViewRHIRef RHIGetViewportBackBufferUAV(FRHIViewport *ViewportRHI)
Definition DynamicRHI.h:669
virtual RHI_API void RHIVirtualTextureSetFirstMipVisible(class FRHICommandListImmediate &RHICmdList, FRHITexture *Texture, uint32 FirstMip)
Definition DynamicRHI.cpp:574
virtual void * RHIGetNativeCommandBuffer()
Definition DynamicRHI.h:849
virtual void RHITick(float DeltaTime)=0
virtual bool RHIIsRenderingSuspended()
Definition DynamicRHI.h:767
virtual void RHIReplaceResources(FRHICommandListBase &RHICmdList, TArray< FRHIResourceReplaceInfo > &&ReplaceInfos)=0
virtual FRayTracingSceneRHIRef RHICreateRayTracingScene(FRayTracingSceneInitializer Initializer)
Definition DynamicRHI.h:1016
virtual void RHIAcquireThreadOwnership()
Definition DynamicRHI.h:716
virtual FRayTracingClusterOperationSize RHICalcRayTracingClusterOperationSize(const FRayTracingClusterOperationInitializer &Initializer)
Definition DynamicRHI.h:998
virtual FVertexDeclarationRHIRef RHICreateVertexDeclaration(const FVertexDeclarationElementList &Elements)=0
virtual void RHIReadSurfaceFloatData(FRHITexture *Texture, FIntRect Rect, TArray< FFloat16Color > &OutData, ECubeFace CubeFace, int32 ArrayIndex, int32 MipIndex)=0
virtual FAmplificationShaderRHIRef RHICreateAmplificationShader(TArrayView< const uint8 > Code, const FSHAHash &Hash)
Definition DynamicRHI.h:282
virtual FRHIResourceCollectionRef RHICreateResourceCollection(FRHICommandListBase &RHICmdList, TConstArrayView< FRHIResourceCollectionMember > InMembers)
Definition DynamicRHI.h:529
virtual ERHIInterfaceType GetInterfaceType() const
Definition DynamicRHI.h:224
virtual FTextureRHIRef RHIAsyncReallocateTexture2D(FRHITexture *Texture2D, int32 NewMipCount, int32 NewSizeX, int32 NewSizeY, FThreadSafeCounter *RequestStatus)=0
virtual FPixelShaderRHIRef RHICreatePixelShader(TArrayView< const uint8 > Code, const FSHAHash &Hash)=0
virtual RHI_API void RHIEndFrame_RenderThread(FRHICommandListImmediate &RHICmdList)
Definition DynamicRHI.cpp:463
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 FComputeShaderRHIRef RHICreateComputeShader(TArrayView< const uint8 > Code, const FSHAHash &Hash)=0
virtual void RHISubmitCommandLists(FRHISubmitCommandListsArgs &&Args)=0
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 void Init()=0
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 FlushPendingLogs()
Definition DynamicRHI.h:288
virtual FTextureRHIRef RHICreateAliasedTexture(FTextureRHIRef &SourceTexture)
Definition DynamicRHI.h:689
virtual void RHIBlockUntilGPUIdle()=0
virtual FRHIFlipDetails RHIWaitForFlip(double TimeoutInSeconds)
Definition DynamicRHI.h:980
virtual FRayTracingAccelerationStructureSize RHICalcRayTracingGeometrySize(const FRayTracingGeometryInitializer &Initializer)
Definition DynamicRHI.h:992
virtual FBoundShaderStateRHIRef RHICreateBoundShaderState(FRHIVertexDeclaration *VertexDeclaration, FRHIVertexShader *VertexShader, FRHIPixelShader *PixelShader, FRHIGeometryShader *GeometryShader)=0
virtual FRHITextureInitializer RHICreateTextureInitializer(FRHICommandListBase &RHICmdList, const FRHITextureCreateDesc &CreateDesc)=0
virtual FRayTracingAccelerationStructureSize RHICalcRayTracingSceneSize(const FRayTracingSceneInitializer &Initializer)
Definition DynamicRHI.h:986
virtual RHI_API void * RHILockStagingBuffer(FRHIStagingBuffer *StagingBuffer, FRHIGPUFence *Fence, uint32 Offset, uint32 SizeRHI)
Definition RHICommandList.cpp:2171
virtual bool RHIGetTextureMemoryVisualizeData(FColor *TextureData, int32 SizeX, int32 SizeY, int32 Pitch, int32 PixelSize)=0
virtual FRasterizerStateRHIRef RHICreateRasterizerState(const FRasterizerStateInitializerRHI &Initializer)=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 void RHIMapStagingSurface(FRHITexture *Texture, FRHIGPUFence *Fence, void *&OutData, int32 &OutWidth, int32 &OutHeight, uint32 GPUIndex=0)=0
virtual void RHIEndFrame(const FRHIEndFrameArgs &Args)=0
virtual IRHIComputeContext * RHIGetParallelCommandContext(FRHIParallelRenderPassInfo const &ParallelRenderPass, FRHIGPUMask GPUMask)
Definition DynamicRHI.h:874
virtual void RHIUnmapStagingSurface(FRHITexture *Texture, uint32 GPUIndex=0)=0
virtual EPixelFormat RHIPreferredPixelFormatHint(EPixelFormat PreferredPixelFormat)
Definition DynamicRHI.h:738
virtual void RHICreateTransition(FRHITransition *Transition, const FRHITransitionCreateInfo &CreateInfo)
Definition DynamicRHI.h:321
virtual FDepthStencilStateRHIRef RHICreateDepthStencilState(const FDepthStencilStateInitializerRHI &Initializer)=0
virtual RHI_API void RHICheckViewportHDRStatus(FRHIViewport *Viewport)
Definition DynamicRHI.cpp:819
virtual bool RHIGetRenderQueryResult(FRHIRenderQuery *RenderQuery, uint64 &OutResult, bool bWait, uint32 GPUIndex=INDEX_NONE)=0
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 void RHIResumeRendering()
Definition DynamicRHI.h:764
virtual FRHIShaderLibraryRef RHICreateShaderLibrary(EShaderPlatform Platform, FString const &FilePath, FString const &Name)
Definition DynamicRHI.h:307
virtual FBlendStateRHIRef RHICreateBlendState(const FBlendStateInitializerRHI &Initializer)=0
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 RHIReleaseTransition(FRHITransition *Transition)
Definition DynamicRHI.h:325
virtual void RHIGetDisplaysInformation(FDisplayInformationArray &OutDisplayInformation)
Definition DynamicRHI.h:695
virtual void RHIReleaseThreadOwnership()
Definition DynamicRHI.h:717
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 void RHIAliasTextureResources(FTextureRHIRef &DestTexture, FTextureRHIRef &SrcTexture)
Definition DynamicRHI.h:684
virtual FSamplerStateRHIRef RHICreateSamplerState(const FSamplerStateInitializerRHI &Initializer)=0
virtual FRenderQueryRHIRef RHICreateRenderQuery(ERenderQueryType QueryType)=0
virtual void RHISignalFlipEvent()
Definition DynamicRHI.h:981
virtual uint32 RHIGetViewportNextPresentGPUIndex(FRHIViewport *Viewport)
Definition DynamicRHI.h:660
virtual void RHIAdvanceFrameForGetViewportBackBuffer(FRHIViewport *Viewport, bool bPresent)=0
virtual void PostInit()
Definition DynamicRHI.h:217
virtual const TCHAR * GetName()=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 FRHICalcTextureSizeResult RHICalcTexturePlatformSize(FRHITextureDesc const &Desc, uint32 FirstMipIndex)=0
virtual FRHILockTextureResult RHILockTexture(FRHICommandListImmediate &RHICmdList, const FRHILockTextureArgs &Arguments)=0
virtual FRayTracingAccelerationStructureOfflineMetadata RHIGetRayTracingGeometryOfflineMetadata(const FRayTracingGeometryOfflineDataHeader &OfflineDataHeader)
Definition DynamicRHI.h:1004
virtual void * LockBuffer_BottomOfPipe(class FRHICommandListBase &RHICmdList, FRHIBuffer *Buffer, uint32 Offset, uint32 SizeRHI, EResourceLockMode LockMode)
Definition DynamicRHI.h:964
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 RHI_API FRHIShaderLibraryRef RHICreateShaderLibrary_RenderThread(class FRHICommandListImmediate &RHICmdList, EShaderPlatform Platform, FString FilePath, FString Name)
Definition RHICommandList.cpp:2259
virtual FMeshShaderRHIRef RHICreateMeshShader(TArrayView< const uint8 > Code, const FSHAHash &Hash)
Definition DynamicRHI.h:276
virtual void RHIUpdateUniformBuffer(FRHICommandListBase &RHICmdList, FRHIUniformBuffer *UniformBufferRHI, const void *Contents)=0
virtual RHI_API uint64 RHIGetMinimumAlignmentForBufferBackedSRV(EPixelFormat Format)
Definition DynamicRHI.cpp:579
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 uint32 RHIGetHTilePlatformConfig(uint32 DepthWidth, uint32 DepthHeight) const
Definition DynamicRHI.h:674
virtual void RHIFlushResources()=0
virtual FDynamicRHI * GetNonValidationRHI()
Definition DynamicRHI.h:225
virtual void RHIGetSupportedResolution(uint32 &Width, uint32 &Height)=0
virtual void RHIFinalizeContext(FRHIFinalizeContextArgs &&Args, TRHIPipelineArray< IRHIPlatformCommandList * > &Output)=0
virtual uint16 RHIGetPlatformTextureMaxSampleCount()
Definition DynamicRHI.h:984
virtual IRHIPlatformCommandList * RHIFinalizeParallelContext(IRHIComputeContext *Context)
Definition DynamicRHI.h:917
virtual uint32 RHIComputeMemorySize(FRHITexture *TextureRHI)=0
virtual FUniformBufferRHIRef RHICreateUniformBuffer(const void *Contents, const FRHIUniformBufferLayout *Layout, EUniformBufferUsage Usage, EUniformBufferValidation Validation)=0
virtual FShaderBundleRHIRef RHICreateShaderBundle(const FShaderBundleCreateInfo &CreateInfo)
Definition DynamicRHI.h:1047
virtual void RHIProcessDeleteQueue()
Definition DynamicRHI.h:947
virtual void * RHIGetNativeGraphicsQueue()
Definition DynamicRHI.h:825
virtual void RHIUnlockTexture(FRHICommandListImmediate &RHICmdList, const FRHILockTextureArgs &Arguments)=0
virtual FTextureRHIRef RHIGetViewportBackBuffer(FRHIViewport *Viewport)=0
virtual void RHIResizeViewport(FRHIViewport *Viewport, uint32 SizeX, uint32 SizeY, bool bIsFullscreen)=0
virtual RHI_API void RHIUnlockStagingBuffer(FRHIStagingBuffer *StagingBuffer)
Definition RHICommandList.cpp:2177
virtual void * RHIGetNativeComputeQueue()
Definition DynamicRHI.h:834
virtual IRHICommandContext * RHIGetDefaultContext()=0
virtual RHI_API void RHIUpdateTextureReference(FRHICommandListBase &RHICmdList, FRHITextureReference *TextureRef, FRHITexture *NewTexture)
Definition DynamicRHI.cpp:553
virtual FComputePipelineStateRHIRef RHICreateComputePipelineState(const FComputePipelineStateInitializer &Initializer)=0
virtual FRayTracingPipelineStateRHIRef RHICreateRayTracingPipelineState(const FRayTracingPipelineStateInitializer &Initializer)
Definition DynamicRHI.h:1028
virtual bool RHIGetAvailableResolutions(FScreenResolutionArray &Resolutions, bool bIgnoreRefreshRate)=0
virtual RHI_API void RHIUnlockBufferMGPU(FRHICommandListBase &RHICmdList, FRHIBuffer *Buffer, uint32 GPUIndex)
Definition DynamicRHI.cpp:830
TArray< uint32 > PixelFormatBlockBytes
Definition DynamicRHI.h:1054
virtual void * RHIGetNativePhysicalDevice()
Definition DynamicRHI.h:815
virtual FViewportRHIRef RHICreateViewport(void *WindowHandle, uint32 SizeX, uint32 SizeY, bool bIsFullscreen, EPixelFormat PreferredPixelFormat)=0
Type
Definition RHIResources.h:412
@ DepthWrite
Definition RHIResources.h:417
@ StencilWrite
Definition RHIResources.h:421
@ StencilRead
Definition RHIResources.h:420
@ DepthNop_StencilNop
Definition RHIResources.h:425
@ DepthRead
Definition RHIResources.h:416
Definition RHIResources.h:4572
Definition NameTypes.h:617
Definition RHIResources.h:966
Definition RHIResources.h:1581
EBufferUsageFlags GetUsage() const
Definition RHIResources.h:1607
uint32 GetStride() const
Definition RHIResources.h:1601
uint32 GetSize() const
Definition RHIResources.h:1595
Definition RHICommandList.h:455
Definition RHICommandList.h:4626
void EnqueueLambda(const TCHAR *LambdaName, LAMBDA &&Lambda)
Definition RHICommandList.h:4709
Definition RHIResources.h:2387
Definition RHIResources.h:978
Definition RHIResources.h:960
Definition RHIResources.h:972
Definition RHIResources.h:3755
Definition RHIResources.h:2444
Definition RHIResourceCollection.h:46
Definition RHIResources.h:3981
Definition RHITextureReference.h:8
Definition RHIResources.h:2153
Definition RHIResources.h:1232
Definition RHIResources.h:3294
Definition RHIResources.h:725
Definition RHIResources.h:954
Definition RHIResources.h:1265
Definition RHIResources.h:2515
Definition RHIResources.h:5023
Definition RHITypes.h:16
Definition SecureHash.h:226
Definition ThreadSafeCounter.h:14
Definition RHIContext.h:693
Definition RHIContext.h:257
Definition RHIContext.h:234
Definition RHITransientResourceAllocator.h:536
Definition RHIContext.h:573
Definition RHI.Build.cs:8
Definition ArrayView.h:139
Definition UnrealString.h.inl:34
Definition RHIPipeline.h:55
void ValidateIndirectArgsBuffer(uint32 IndirectArgsBufferSize, uint32 IndirectArgOffset)
Definition RenderGraphUtils.h:438
State
Definition PacketHandler.h:88
UE_STRING_CLASS Result(Forward< LhsType >(Lhs), RhsLen)
Definition String.cpp.inl:732
Definition Color.h:486
Definition RHIResources.h:1417
Definition RHIBufferInitializer.h:12
Definition DynamicRHI.h:120
Definition DynamicRHI.h:49
Definition MultiGPU.h:33
Definition DynamicRHI.h:149
Definition DynamicRHI.h:198
Definition RHIResources.h:5548
Definition RHIResources.h:1938
Definition RHIResources.h:1689
Definition RHITextureInitializer.h:50
Definition RHITransition.h:382
Definition RHITransition.h:475
Definition RHIResources.h:1150
Definition RHIResources.h:2648
Definition RHI.h:278
Definition RHIResources.h:3693
Definition RHIResources.h:3842
Definition RHIResources.h:3761
Definition RHIResources.h:3496
Definition RHIResources.h:3398
Definition RHIResources.h:3669
Definition RHIResources.h:3635
Definition RHI.h:232
Definition RHIResources.h:3910
Definition RHIStats.h:12
Definition RHICommandList.h:220
Definition RHITypes.h:127
Definition RHITypes.h:155
Definition LinuxPlatformSplash.cpp:43
Definition IntPoint.h:25