// Copyright Epic Games, Inc. All Rights Reserved. /*============================================================================= VulkanContext.h: Class to generate Vulkan command buffers from RHI CommandLists =============================================================================*/ #pragma once #include "VulkanRHIPrivate.h" #include "VulkanQuery.h" class FVulkanDevice; class FVulkanDynamicRHI; class FVulkanPendingGfxState; class FVulkanPendingComputeState; class FVulkanQueue; class FVulkanSwapChain; class FVulkanTiming; class FVulkanDescriptorPoolSetContainer; // NOTE: typedef to FGraphEvent for now, but eventually move all syncs inside a FVulkanSyncPoint class using FVulkanSyncPoint = FGraphEvent; using FVulkanSyncPointRef = TRefCountPtr; static FVulkanSyncPointRef CreateVulkanSyncPoint() { return FGraphEvent::CreateGraphEvent(); } class FVulkanPayload { friend class FVulkanCommandListContext; friend class FVulkanContextCommon; friend class FVulkanDynamicRHI; friend class FVulkanQueue; public: FVulkanPayload(FVulkanQueue& InQueue) : Queue(InQueue) #if RHI_NEW_GPU_PROFILER , EventStream(InQueue.GetProfilerQueue()) #endif {} ~FVulkanPayload(); protected: void PreExecute(); FVulkanQueue& Queue; TArray WaitFlags; // flags that match 1:1 with WaitSemaphores TArray WaitSemaphores; // wait before command buffers TArray CommandBuffers; TArray SignalSemaphores; // signaled after command buffers // Signaled when the payload has been submitted to the GPU queue TArray SubmissionEvents; // For internal completion tracking of the payload uint64 TimelineSemaphoreValue = 0; VulkanRHI::FFence* Fence = nullptr; // Used to sync other CPU work to payload completion TArray SyncPoints; // Queries used in the command lists of this payload TStaticArray, (int32)EVulkanQueryPoolType::Count> QueryPools; // Used DescriptorPoolSetContainers that can be cleaned up on completion TArray DescriptorPoolSetContainers; // Used by RHIRunOnQueue TFunction PreExecuteCallback; #if WITH_RHI_BREADCRUMBS FRHIBreadcrumbRange BreadcrumbRange{}; TSharedPtr BreadcrumbAllocators{}; #endif #if RHI_NEW_GPU_PROFILER TOptional Timing; TOptional EndFrameEvent; UE::RHI::GPUProfiler::FEventStream EventStream; #else bool bEndFrame = false; #endif }; struct FVulkanPlatformCommandList : public IRHIPlatformCommandList, public TArray { }; template<> struct TVulkanResourceTraits { typedef FVulkanPlatformCommandList TConcreteType; };