working on vulkan's descriptor sets

This commit is contained in:
2024-12-06 03:29:53 +01:00
parent 6868047c76
commit f020d8bf2c
2 changed files with 62 additions and 5 deletions

View File

@@ -10,11 +10,60 @@
#include <vulkan/vulkan_core.h> #include <vulkan/vulkan_core.h>
#include <Pulse.h> #include <Pulse.h>
#include "../../PulseInternal.h"
typedef struct VulkanDescriptor #include "VulkanEnums.h"
#define VULKAN_POOL_SIZE 128
typedef struct VulkanDescriptorSetLayout
{ {
} VulkanDescriptor; VkDescriptorSetLayout layout;
VulkanDescriptorSetType type;
union
{
struct
{
uint32_t storage_buffer_count;
uint32_t storage_texture_count;
} ReadOnly;
struct
{
uint32_t storage_buffer_count;
uint32_t storage_texture_count;
} ReadWrite;
struct
{
uint32_t buffer_count;
} Uniform;
};
} VulkanDescriptorSetLayout;
typedef struct VulkanDescriptorSet
{
VulkanDescriptorSetLayout* layout;
struct VulkanDescriptorSetPool* pool;
VkDescriptorSet set;
} VulkanDescriptorSet;
typedef struct VulkanDescriptorSetPool
{
VulkanDescriptorSet* used_sets[VULKAN_POOL_SIZE];
VulkanDescriptorSet* free_sets[VULKAN_POOL_SIZE];
VkDescriptorPool pool;
uint32_t sets_count;
} VulkanDescriptorSetPool;
typedef struct VulkanDescriptorSetPoolManager
{
VulkanDescriptorSetPool* pools;
uint32_t pools_capacity;
uint32_t pools_size;
} VulkanDescriptorSetPoolManager;
void VulkanInitDescriptorSetPoolManager(VulkanDescriptorSetPoolManager* manager);
VulkanDescriptorSetPool* VulkanGetAvailableDescriptorSetPool(VulkanDescriptorSetPoolManager* manager);
void VulkanDestroyDescriptorSetPoolManager(VulkanDescriptorSetPoolManager* manager);
#endif // PULSE_VULKAN_DESCRIPTOR_H_ #endif // PULSE_VULKAN_DESCRIPTOR_H_

View File

@@ -1,5 +1,4 @@
// Copyright (C) 2024 kanel // Copyright (C) 2024 kanel
//
// This file is part of "Pulse" // This file is part of "Pulse"
// For conditions of distribution and use, see copyright notice in LICENSE // For conditions of distribution and use, see copyright notice in LICENSE
@@ -11,11 +10,20 @@
typedef enum VulkanQueueType typedef enum VulkanQueueType
{ {
VULKAN_QUEUE_COMPUTE = 0, VULKAN_QUEUE_COMPUTE = 0,
VULKAN_QUEUE_TRANSFER = 1, VULKAN_QUEUE_TRANSFER,
VULKAN_QUEUE_END_ENUM // For internal use only VULKAN_QUEUE_END_ENUM // For internal use only
} VulkanQueueType; } VulkanQueueType;
typedef enum VulkanDescriptorSetType
{
VULKAN_DESCRIPTOR_SET_READ_ONLY = 0,
VULKAN_DESCRIPTOR_SET_READ_WRITE,
VULKAN_DESCRIPTOR_SET_UNIFORM,
VULKAN_DESCRIPTOR_SET_END_ENUM // For internal use only
} VulkanDescriptorSetType;
#endif // PULSE_VULKAN_ENUMS_H_ #endif // PULSE_VULKAN_ENUMS_H_
#endif // PULSE_ENABLE_VULKAN_BACKEND #endif // PULSE_ENABLE_VULKAN_BACKEND