UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VulkanBindlessDescriptorManager.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "RHIDefinitions.h"
7#include "VulkanCommon.h"
8#include "VulkanMemory.h"
9#include "VulkanThirdParty.h"
11
12class FVulkanDevice;
13class FVulkanBuffer;
14
15// Manager for resource descriptors used in bindless rendering.
17{
18public:
21
23
24 void Init();
25 void Deinit();
26
28 {
29 return bIsSupported;
30 }
31
33 {
34 return BindlessPipelineLayout;
35 }
36
37 void BindDescriptorBuffers(VkCommandBuffer CommandBuffer, VkPipelineStageFlags SupportedStages);
38
43
45
47
49 void UpdateImage(const FVulkanContextArray& Contexts, FRHIDescriptorHandle DescriptorHandle, VkDescriptorType DescriptorType, VkImageView VulkanImage, bool bIsDepthStencil, bool bImmediateUpdate = true);
50
51 void UpdateBuffer(const FVulkanContextArray& Contexts, FRHIDescriptorHandle DescriptorHandle, VkDescriptorType DescriptorType, VkBuffer VulkanBuffer, VkDeviceSize BufferOffset, VkDeviceSize BufferSize, bool bImmediateUpdate = true);
52 void UpdateBuffer(const FVulkanContextArray& Contexts, FRHIDescriptorHandle DescriptorHandle, VkDescriptorType DescriptorType, VkDeviceAddress BufferAddress, VkDeviceSize BufferSize, bool bImmediateUpdate = true);
53
54 void UpdateTexelBuffer(const FVulkanContextArray& Contexts, FRHIDescriptorHandle DescriptorHandle, VkDescriptorType DescriptorType, const VkBufferViewCreateInfo& ViewInfo, bool bImmediateUpdate = true);
56
58
59 void UpdateUBAllocator();
60
61private:
62 FVulkanDevice& Device;
63 const bool bIsSupported;
64
65 VkDescriptorSetLayout EmptyDescriptorSetLayout = VK_NULL_HANDLE;
66
67 struct BindlessSetState
68 {
69 ~BindlessSetState()
70 {
71 if (CPUDescriptorMemory)
72 {
73 FMemory::Free(CPUDescriptorMemory);
74 }
75 }
76
79
80 VkDescriptorSetLayout DescriptorSetLayout = VK_NULL_HANDLE;
81
82 uint32 DescriptorCapacity = 0;
83 uint32 DescriptorSize = 0;
84
85 VkBuffer BufferHandle = VK_NULL_HANDLE;
86 VkDeviceMemory MemoryHandle = VK_NULL_HANDLE;
87 uint8* MappedPointer = nullptr;
88
89 uint8* CPUDescriptorMemory = nullptr;
90 };
91 BindlessSetState BindlessSetStates[VulkanBindless::NumBindlessSets];
92
93 VkDescriptorSetLayout SingleUseUBDescriptorSetLayout = VK_NULL_HANDLE;
94 VulkanRHI::FTempBlockAllocator* SingleUseUBAllocator = nullptr;
95
98
99 VkPipelineLayout BindlessPipelineLayout = VK_NULL_HANDLE;
100
101 BindlessSetState& GetBindlessState(ERHIDescriptorType DescriptorType);
102 BindlessSetState& GetBindlessState(VkDescriptorType DescriptorType);
103
104 void UpdateDescriptor(const FVulkanContextArray& Contexts, FRHIDescriptorHandle DescriptorHandle, VkDescriptorType DescriptorType, VkDescriptorDataEXT DescriptorData, bool bImmediateUpdate);
105 static bool VerifySupport(FVulkanDevice& InDevice);
106};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ERHIDescriptorType
Definition RHIDefinitions.h:1348
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition RHIDescriptorAllocator.h:87
Definition VulkanBindlessDescriptorManager.h:17
TStaticArray< TArray< VkDescriptorAddressInfoEXT >, ShaderStage::MaxNumStages > FUniformBufferDescriptorArrays
Definition VulkanBindlessDescriptorManager.h:22
void Deinit()
Definition VulkanBindlessDescriptorManager.cpp:328
void BindDescriptorBuffers(VkCommandBuffer CommandBuffer, VkPipelineStageFlags SupportedStages)
Definition VulkanBindlessDescriptorManager.cpp:657
bool IsSupported()
Definition VulkanBindlessDescriptorManager.h:27
void UpdateUBAllocator()
Definition VulkanBindlessDescriptorManager.cpp:963
FRHIDescriptorHandle AllocateDescriptor(VkDescriptorType DescriptorType)
Definition VulkanBindlessDescriptorManager.cpp:737
void Init()
Definition VulkanBindlessDescriptorManager.cpp:370
void UpdateTexelBuffer(const FVulkanContextArray &Contexts, FRHIDescriptorHandle DescriptorHandle, VkDescriptorType DescriptorType, const VkBufferViewCreateInfo &ViewInfo, bool bImmediateUpdate=true)
Definition VulkanBindlessDescriptorManager.cpp:923
void RegisterUniformBuffers(FVulkanCommandListContext &Context, VkPipelineBindPoint BindPoint, const FUniformBufferDescriptorArrays &StageUBs)
Definition VulkanBindlessDescriptorManager.cpp:679
void UpdateBuffer(const FVulkanContextArray &Contexts, FRHIDescriptorHandle DescriptorHandle, VkDescriptorType DescriptorType, VkBuffer VulkanBuffer, VkDeviceSize BufferOffset, VkDeviceSize BufferSize, bool bImmediateUpdate=true)
Definition VulkanBindlessDescriptorManager.cpp:891
void UpdateImage(const FVulkanContextArray &Contexts, FRHIDescriptorHandle DescriptorHandle, VkDescriptorType DescriptorType, VkImageView VulkanImage, bool bIsDepthStencil, bool bImmediateUpdate=true)
Definition VulkanBindlessDescriptorManager.cpp:873
void UpdateAccelerationStructure(const FVulkanContextArray &Contexts, FRHIDescriptorHandle DescriptorHandle, VkAccelerationStructureKHR AccelerationStructure, bool bImmediateUpdate=true)
Definition VulkanBindlessDescriptorManager.cpp:947
FRHIDescriptorHandle AllocateDescriptor(VkDescriptorType DescriptorType, VkImageView VulkanImage, bool bIsDepthStencil)
void UpdateSampler(const FVulkanContextArray &Contexts, FRHIDescriptorHandle DescriptorHandle, VkSampler VulkanSampler)
Definition VulkanBindlessDescriptorManager.cpp:863
void FreeDescriptor(FRHIDescriptorHandle DescriptorHandle)
Definition VulkanBindlessDescriptorManager.cpp:784
VkPipelineLayout GetPipelineLayout() const
Definition VulkanBindlessDescriptorManager.h:32
~FVulkanBindlessDescriptorManager()
Definition VulkanBindlessDescriptorManager.cpp:323
Definition VulkanResources.h:837
Definition VulkanContext.h:241
Definition VulkanDevice.h:279
Definition Array.h:670
Definition StaticArray.h:26
Definition VulkanMemory.h:955
@ MaxNumStages
Definition VulkanCommon.h:55
@ NumBindlessSets
Definition VulkanCommon.h:133
@ MaxNumSets
Definition VulkanCommon.h:139
static FORCENOINLINE CORE_API void Free(void *Original)
Definition UnrealMemory.cpp:685
Definition RHIDefinitions.h:1401
Definition VulkanContext.h:517