39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#ifndef BINDLESSSETMANAGER_H
|
|
#define BINDLESSSETMANAGER_H
|
|
|
|
#include <cstdint>
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
struct GPUImage;
|
|
|
|
class BindlessSetManager {
|
|
public:
|
|
void init(VkDevice device, VkPhysicalDevice physicalDevice, float maxAnisotropy);
|
|
void cleanup(VkDevice device);
|
|
|
|
VkDescriptorSetLayout getDescSetLayout() const { return descSetLayout; }
|
|
const VkDescriptorSet& getDescSet() const { return descSet; }
|
|
|
|
void addImage(VkDevice device, std::uint32_t id, const VkImageView imageView);
|
|
void addSampler(VkDevice device, std::uint32_t id, VkSampler sampler);
|
|
|
|
[[nodiscard]] std::uint32_t getMaxImageCount() const { return maxBindlessResources; }
|
|
|
|
private:
|
|
void initDefaultSamplers(VkDevice device, float maxAnisotropy);
|
|
|
|
VkDescriptorPool descPool{VK_NULL_HANDLE};
|
|
VkDescriptorSetLayout descSetLayout{VK_NULL_HANDLE};
|
|
VkDescriptorSet descSet{VK_NULL_HANDLE};
|
|
|
|
std::uint32_t maxBindlessResources{0};
|
|
|
|
VkSampler nearestSampler{VK_NULL_HANDLE};
|
|
VkSampler linearSampler{VK_NULL_HANDLE};
|
|
VkSampler anisotropicSampler{VK_NULL_HANDLE};
|
|
VkSampler shadowMapSampler{VK_NULL_HANDLE};
|
|
};
|
|
|
|
#endif //BINDLESSSETMANAGER_H
|