85 lines
3.0 KiB
C
85 lines
3.0 KiB
C
/**
|
|
* @file descriptor_builder.h
|
|
* @author Piotr Krygier (everyonecancode@gmail.com)
|
|
* @brief
|
|
* @version 0.1
|
|
* @date 2024-03-01
|
|
*
|
|
* @copyright Copyright (c) 2024
|
|
*
|
|
*/
|
|
|
|
#ifndef DESCRIPTOR_BUILDER_H
|
|
#define DESCRIPTOR_BUILDER_H
|
|
|
|
#include <stdint.h>
|
|
#include <vulkan/vulkan_core.h>
|
|
|
|
#include "graphics_context.h"
|
|
|
|
struct descriptor_set_handle_t;
|
|
struct descriptor_set_list_t;
|
|
|
|
/**
|
|
* @brief Initialize new descriptor set handle
|
|
*
|
|
* @param descriptor_set_handle Handle to initialize
|
|
* #return RSE_ERROR_NO_ERROR on success
|
|
*/
|
|
rse_err_t descriptor_initialize_handle(struct descriptor_set_handle_t **descriptor_set_handle);
|
|
|
|
/**
|
|
* @brief Destroy descritptor set handle
|
|
*
|
|
* @param descriptor_set_handle Handle to destroy
|
|
* @return RSE_ERROR_NO_ERROR on succes
|
|
*/
|
|
rse_err_t descriptor_free_handle(struct descriptor_set_handle_t **descriptor_set_handle);
|
|
|
|
/**
|
|
* @brief Add descriptor set to provided list
|
|
*
|
|
* @param descriptor_set_handle Handle for given descriptor set
|
|
* @param binding Descriptors binding
|
|
* @param type Type of descriptors
|
|
* @param descriptor_count Number of descriptors in this set
|
|
* @param shader_stages In what stages this descriptors will be used
|
|
* @param sampler If descriptor set is a sampler, provide it here
|
|
* @return rse_err_t RSE_ERROR_NO_ERROR on success, error code on failure
|
|
*/
|
|
rse_err_t descriptor_add_set(struct descriptor_set_handle_t* descriptor_set_handle, uint32_t binding, VkDescriptorType type,
|
|
uint32_t descriptor_count, VkShaderStageFlags shader_stages, VkSampler* sampler);
|
|
|
|
/**
|
|
* @brief Allocate descriptor sets from provided list. The data will be stored in opaque descriptor handle
|
|
*
|
|
* @param context Graphics context
|
|
* @param descriptor_set_handle Opaque descriptor handle object.
|
|
* @return rse_err_t RSE_ERROR_NO_ERROR on success, error code on failure
|
|
*/
|
|
rse_err_t descriptors_build(struct graphics_context_t* context, struct descriptor_set_handle_t* descriptor_set_handle);
|
|
|
|
/**
|
|
* @brief Return descriptor set layouts from descritptor handle
|
|
*
|
|
* @param descriptor_set_handle Handle for descriptor set
|
|
* @return rse_err_t RSE_ERROR_NO_ERROR on success
|
|
*/
|
|
rse_err_t descriptor_get_layout(struct descriptor_set_handle_t* descriptor_set_handle,
|
|
VkDescriptorSetLayout* descritptor_sets_layout);
|
|
|
|
/**
|
|
* @brief Get VkDescriptorSet from descriptor handle
|
|
*
|
|
* @param descriptor_set_handle_t Handle to get VkDescriptorSet from
|
|
* @return rse_err_t RSE_ERROR_NO_ERROR on success
|
|
*/
|
|
rse_err_t descriptor_get_vkhandle(struct descriptor_set_handle_t* descriptor_set_handle, VkDescriptorSet* descriptor_set);
|
|
|
|
rse_err_t descriptor_attach_buffer(struct graphics_context_t* context, struct descriptor_set_handle_t* descriptor_set_handle, struct vulkan_buffer_t* buffer, uint32_t binding, VkDescriptorType type);
|
|
|
|
rse_err_t descriptor_attach_image(struct graphics_context_t* context, struct descriptor_set_handle_t* descriptor_set_handle, uint16_t texture_id, VkSampler sampler, uint32_t binding);
|
|
|
|
void destroy_descriptors(struct graphics_context_t* context);
|
|
#endif // !DESCRIPTOR_BUILDER_H
|