Nebula
Loading...
Searching...
No Matches
vkresourcetable.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
9//------------------------------------------------------------------------------
10#include "ids/idallocator.h"
12#include "threading/spinlock.h"
13#include <array>
14namespace Vulkan
15{
16
17//------------------------------------------------------------------------------
21//------------------------------------------------------------------------------
22enum class WriteType
23{
24 Image,
25 Buffer,
27 Tlas
28};
29
31{
32 union
33 {
34 VkDescriptorImageInfo img;
35 VkDescriptorBufferInfo buf;
36 VkBufferView tex;
37 VkAccelerationStructureKHR tlas;
38 };
39
40 VkWriteDescriptorSet write;
41 VkWriteDescriptorSetAccelerationStructureKHR tlasWrite;
43};
44
45enum
46{
54};
55
56typedef Ids::IdAllocator<
57 VkDevice,
58 VkDescriptorSet,
59 IndexT,
66
73
74//------------------------------------------------------------------------------
78//------------------------------------------------------------------------------
79enum
80{
88};
89typedef Ids::IdAllocator<
90 VkDevice,
91 VkDescriptorSetLayout,
99extern VkDescriptorSetLayout EmptySetLayout;
100
103
105const VkDescriptorSetLayout& ResourceTableLayoutGetVk(const CoreGraphics::ResourceTableLayoutId& id);
107void ResourceTableLayoutAllocTable(const CoreGraphics::ResourceTableLayoutId& id, const VkDevice dev, uint overallocationSize, IndexT& outIndex, VkDescriptorSet& outSet);
109void ResourceTableLayoutDeallocTable(const CoreGraphics::ResourceTableLayoutId& id, const VkDevice dev, const VkDescriptorSet& set, const IndexT index);
111const VkDescriptorPool& ResourceTableLayoutGetVkDescriptorPool(const CoreGraphics::ResourceTableLayoutId& id, const IndexT index);
114
115//------------------------------------------------------------------------------
119//------------------------------------------------------------------------------
120typedef Ids::IdAllocator<
121 VkDevice,
122 VkPipelineLayout
125
127const VkPipelineLayout& ResourcePipelineGetVk(const CoreGraphics::ResourcePipelineId& id);
128
129} // namespace Vulkan
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
Definition spinlock.h:21
Nebula's dynamic array class.
Definition array.h:60
Organizes key/value pairs by a hash code.
Definition hashtable.h:42
Vulkan implementation of GPU acceleration structure.
Definition vkaccelerationstructure.cc:15
VkResourceTableAllocator resourceTableAllocator
Definition vkresourcetable.cc:19
const VkDescriptorSetLayout & ResourceTableLayoutGetVk(const CoreGraphics::ResourceTableLayoutId &id)
get table layout
Definition vkresourcetable.cc:87
WriteType
Resource table.
Definition vkresourcetable.h:23
void ResourceTableLayoutAllocTable(const CoreGraphics::ResourceTableLayoutId &id, const VkDevice dev, uint overallocationSize, IndexT &outIndex, VkDescriptorSet &outSet)
allocate new descriptor set from pool
Definition vkresourcetable.cc:96
VkResourcePipelineAllocator resourcePipelineAllocator
Definition vkresourcetable.cc:21
const VkDescriptorPool & ResourceTableLayoutGetVkDescriptorPool(const CoreGraphics::ResourceTableLayoutId &id, const IndexT index)
Get descriptor pool.
Definition vkresourcetable.cc:172
VkDescriptorSetLayout EmptySetLayout
Definition vkresourcetable.cc:22
Ids::IdAllocator< VkDevice, VkDescriptorSet, IndexT, Threading::Spinlock, CoreGraphics::ResourceTableLayoutId, Util::Array< WriteInfo, 16 >, Util::Array< VkCopyDescriptorSet, 4 > > VkResourceTableAllocator
Definition vkresourcetable.h:64
VkResourceTableLayoutAllocator resourceTableLayoutAllocator
Definition vkresourcetable.cc:20
Ids::IdAllocator< VkDevice, VkPipelineLayout > VkResourcePipelineAllocator
Resource pipeline.
Definition vkresourcetable.h:123
const IndexT ResourceTableGetVkPoolIndex(CoreGraphics::ResourceTableId id)
Get descriptor pool index.
Definition vkresourcetable.cc:37
uint * ResourceTableLayoutGetFreeItemsCounter(const CoreGraphics::ResourceTableLayoutId &id, const IndexT index)
Get descriptor pool free items counter.
Definition vkresourcetable.cc:181
Ids::IdAllocator< VkDevice, VkDescriptorSetLayout, Util::Array< VkDescriptorPoolSize >, Util::Array< Util::Pair< CoreGraphics::SamplerId, uint32_t > >, Util::HashTable< uint32_t, bool >, Util::Array< VkDescriptorPool >, Util::Array< uint > > VkResourceTableLayoutAllocator
Definition vkresourcetable.h:97
@ ResourceTable_DescriptorPoolIndex
Definition vkresourcetable.h:49
@ ResourceTable_WriteInfos
Definition vkresourcetable.h:52
@ ResourceTable_Copies
Definition vkresourcetable.h:53
@ ResourceTable_Layout
Definition vkresourcetable.h:51
@ ResourceTable_Device
Definition vkresourcetable.h:47
@ ResourceTable_DescriptorSet
Definition vkresourcetable.h:48
@ ResourceTable_Lock
Definition vkresourcetable.h:50
const VkDescriptorSet & ResourceTableGetVkDescriptorSet(CoreGraphics::ResourceTableId id)
Get descriptor set.
Definition vkresourcetable.cc:28
const VkDevice & ResourceTableGetVkDevice(CoreGraphics::ResourceTableId id)
Get device used to create resource table.
Definition vkresourcetable.cc:46
void SetupEmptyDescriptorSetLayout()
run this before using any resource tables
Definition vkresourcetable.cc:55
@ ResourceTableLayout_Samplers
Definition vkresourcetable.h:84
@ ResourceTableLayout_Device
Definition vkresourcetable.h:81
@ ResourceTableLayout_DescriptorPools
Definition vkresourcetable.h:86
@ ResourceTableLayout_SetLayout
Definition vkresourcetable.h:82
@ ResourceTableLayout_DescriptorPoolFreeItems
Definition vkresourcetable.h:87
@ ResourceTableLayout_PoolSizes
Definition vkresourcetable.h:83
@ ResourceTableLayout_ImmutableSamplerFlags
Definition vkresourcetable.h:85
const VkPipelineLayout & ResourcePipelineGetVk(const CoreGraphics::ResourcePipelineId &id)
get pipeline layout
Definition vkresourcetable.cc:191
void ResourceTableLayoutDeallocTable(const CoreGraphics::ResourceTableLayoutId &id, const VkDevice dev, const VkDescriptorSet &set, const IndexT index)
deallocate descriptor set from pool
Definition vkresourcetable.cc:160
A resource table declares a list of resources (ResourceTable in DX12, DescriptorSet in Vulkan)
Definition resourcetable.h:402
Definition resourcetable.h:95
Definition resourcetable.h:25
Definition vkresourcetable.h:31
VkDescriptorBufferInfo buf
Definition vkresourcetable.h:35
VkAccelerationStructureKHR tlas
Definition vkresourcetable.h:37
VkDescriptorImageInfo img
Definition vkresourcetable.h:34
WriteType type
Definition vkresourcetable.h:42
VkWriteDescriptorSetAccelerationStructureKHR tlasWrite
Definition vkresourcetable.h:41
VkBufferView tex
Definition vkresourcetable.h:36
VkWriteDescriptorSet write
Definition vkresourcetable.h:40
unsigned int uint
Definition types.h:31
int IndexT
Definition types.h:48