NAP
descriptorsetallocator.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // External Includes
8 #include <unordered_map>
9 #include <utility/dllexport.h>
10 #include <vulkan/vulkan_core.h>
11 #include <vector>
12 
13 namespace nap
14 {
26  class NAPAPI DescriptorSetAllocator final
27  {
28  public:
32  DescriptorSetAllocator(VkDevice device);
33 
34  // Destructor
36 
44  VkDescriptorSet allocate(VkDescriptorSetLayout layout, int numUBODescriptors, int numSSBODescriptors, int numSamplerDescriptors);
45 
46  private:
50  struct DescriptorPool
51  {
52  using DescriptorSetList = std::vector<VkDescriptorSet>;
53  VkDescriptorPool mPool = VK_NULL_HANDLE;
54  DescriptorSetList mAllocatedDescriptorSets;
55  int mMaxNumSets = 0;
56  };
57 
58  using DescriptorPoolMap = std::unordered_map<uint64_t, std::vector<DescriptorPool>>;
59  VkDevice mDevice;
60  DescriptorPoolMap mDescriptorPools;
61  };
62 } // nap
63 
64 
65 
nap::DescriptorSetAllocator
Definition: descriptorsetallocator.h:26
nap
Definition: templateapp.h:17