35 lines
780 B
C++
35 lines
780 B
C++
#pragma once
|
|
|
|
#include "vk_types.h"
|
|
#include <vector>
|
|
|
|
struct DescriptorLayoutBuilder {
|
|
std::vector<VkDescriptorSetLayoutBinding> bindings;
|
|
|
|
void add_binding(uint32_t binding, VkDescriptorType type);
|
|
void clear();
|
|
|
|
VkDescriptorSetLayout build(VkDevice device,
|
|
VkShaderStageFlags shaderStages,
|
|
void* pNext = nullptr,
|
|
VkDescriptorSetLayoutCreateFlags flags = 0);
|
|
};
|
|
|
|
struct DescriptorAllocator {
|
|
|
|
struct PoolSizeRatio {
|
|
VkDescriptorType type;
|
|
float ratio;
|
|
};
|
|
|
|
VkDescriptorPool pool;
|
|
|
|
void init_pool(VkDevice device, uint32_t maxSets,
|
|
std::span<PoolSizeRatio> poolRatios);
|
|
|
|
void clear_descriptors(VkDevice device);
|
|
void destroy_pool(VkDevice device);
|
|
|
|
VkDescriptorSet allocate(VkDevice device, VkDescriptorSetLayout layout);
|
|
|
|
};
|