diff options
| author | Quentin LADEVIE <qladevie@wanadev.fr> | 2023-01-22 17:59:24 +0100 |
|---|---|---|
| committer | Quentin LADEVIE <qladevie@wanadev.fr> | 2023-01-22 17:59:24 +0100 |
| commit | 0a882c4b85423a170455f05a52d18f7fa7c9220b (patch) | |
| tree | 3bdc24d73ba7cc828fce2b93ce85f73831b12204 /include/api-test/vk-bindless.hpp | |
| parent | 5e3bb454d50091e581d5d1d03af34e38277694b3 (diff) | |
Api test bindless and command buffers
Diffstat (limited to 'include/api-test/vk-bindless.hpp')
| -rw-r--r-- | include/api-test/vk-bindless.hpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/api-test/vk-bindless.hpp b/include/api-test/vk-bindless.hpp new file mode 100644 index 0000000..d8fac3c --- /dev/null +++ b/include/api-test/vk-bindless.hpp @@ -0,0 +1,61 @@ +#pragma once + +#include <cstdint> + +#include <vulkan/vulkan_core.h> + +enum BindlessSetType : uint32_t { + GLOBAL, + MAX, +}; + +enum SamplerType : uint32_t { + NEAREST, + LINEAR, + MAX_SAMPLER, +}; + +struct bindless_model { +#ifndef USE_VK_DESCRIPTOR_BUFFERS + VkPipelineLayout layout; + VkDescriptorSetLayout sets_layout[BindlessSetType::MAX]; + VkDescriptorSet sets[BindlessSetType::MAX]; + VkDescriptorPool descriptor_pool; + + static constexpr size_t descriptor_pool_allocable_sets_count = 64U; + static constexpr uint32_t set_descriptors_count[BindlessSetType::MAX]{ 1024U }; + + static bindless_model create_bindless_model(VkDevice device); + + static void destroy_bindless_model(VkDevice device, bindless_model& bindless); + + private: + void create_layout(VkDevice device); + void create_descriptor_pool(VkDevice device); + void allocate_sets(VkDevice device); + + void destroy_descriptor_pool(VkDevice device); + + void create_immutable_samplers(VkDevice device); + + void destroy_immutable_samplers(VkDevice device); + + VkSampler samplers[SamplerType::MAX_SAMPLER]; +#else + VkPipelineLayout layout; + VkDescriptorSetLayout sets_layout[BindlessSetType::MAX]; + + static constexpr size_t descriptor_pool_allocable_sets_count = 64U; + static constexpr uint32_t set_descriptors_count[BindlessSetType::MAX]{ 1024U }; + + static bindless_model create_bindless_model(VkDevice device); + + static void destroy_bindless_model(VkDevice device, bindless_model& bindless); + + private: + void create_layout(VkDevice device); + + handle<device_buffer> storage_image_descriptors; + handle<device_buffer> sampled_image_descriptors; +#endif +}; |
