wtf is a descriptorl chatgpt pls
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#include "descriptor.hpp"
|
||||
|
||||
#include "device.hpp"
|
||||
#include "graphics.hpp"
|
||||
|
||||
#include "yolo/yolo.hpp"
|
||||
|
||||
namespace inferno::graphics {
|
||||
|
||||
DescriptorPool* descriptor_pool_create(GraphicsDevice* device, uint32_t max_sets)
|
||||
{
|
||||
DescriptorPool* pool = new DescriptorPool();
|
||||
pool->Device = device;
|
||||
pool->Sets.resize(max_sets);
|
||||
|
||||
VkDescriptorPoolSize poolSize {};
|
||||
poolSize.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||
poolSize.descriptorCount = max_sets;
|
||||
|
||||
VkDescriptorPoolCreateInfo poolInfo {};
|
||||
poolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||
poolInfo.poolSizeCount = 1;
|
||||
poolInfo.pPoolSizes = &poolSize;
|
||||
poolInfo.maxSets = max_sets;
|
||||
|
||||
if (vkCreateDescriptorPool(device->VulkanDevice, &poolInfo, nullptr, &pool->Handle)
|
||||
!= VK_SUCCESS) {
|
||||
yolo::error("failed to create descriptor pool!");
|
||||
}
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
void descriptor_pool_cleanup(DescriptorPool* pool)
|
||||
{
|
||||
vkDestroyDescriptorPool(pool->Device->VulkanDevice, pool->Handle, nullptr);
|
||||
delete pool;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,30 +6,24 @@ namespace inferno::graphics {
|
||||
|
||||
struct GraphicsDevice;
|
||||
|
||||
// NOTE: THIS IS NOT THE RIGHT WAY TO DO THIS
|
||||
|
||||
typedef struct DescriptorSet {
|
||||
VkDescriptorSet Set;
|
||||
GraphicsDevice* Device;
|
||||
VkDescriptorSet Handle;
|
||||
VkDescriptorSetLayout Layout;
|
||||
} DescriptorSet;
|
||||
|
||||
typedef struct DescriptorPool {
|
||||
VkDescriptorPool Pool;
|
||||
std::vector<VkDescriptorSet> Sets;
|
||||
GraphicsDevice* Device;
|
||||
VkDescriptorPool Handle;
|
||||
std::vector<DescriptorSet> Sets;
|
||||
} DescriptorPool;
|
||||
|
||||
typedef struct Descriptor {
|
||||
VkDescriptorType Type;
|
||||
VkShaderStageFlags StageFlags;
|
||||
uint32_t Binding;
|
||||
uint32_t Count;
|
||||
} Descriptor;
|
||||
|
||||
// reading docs ...
|
||||
|
||||
DescriptorPool* descriptor_pool_create(GraphicsDevice* device, uint32_t max_sets, std::vector<Descriptor> descriptors);
|
||||
DescriptorPool* descriptor_pool_create(GraphicsDevice* device, uint32_t max_sets);
|
||||
void descriptor_pool_cleanup(DescriptorPool* pool);
|
||||
|
||||
DescriptorSet* descriptor_set_create(GraphicsDevice* device, DescriptorPool* pool, std::vector<Descriptor> descriptors);
|
||||
DescriptorSet* descriptor_set_create(GraphicsDevice* device, DescriptorPool* pool);
|
||||
void descriptor_set_cleanup(DescriptorSet* set);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user