[WIP] Add descriptors and pipeline builder
This commit is contained in:
1 parent
173a82b9d1
commit
f8eb98ddf4
36 files changed
+613
-458
No files matched your search
@@ -13,6 +13,7 @@
|
||||
#define PIPELINE_BUILDER_H
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include "graphics_context.h"
|
||||
#include "utilities/commons.h"
|
||||
#include "utilities/linked_list.h"
|
||||
@@ -20,45 +21,8 @@
|
||||
|
||||
#define MAX_SHADER_STAGES 12U
|
||||
|
||||
RSE_LINKED_LIST_DEFINE(vertex_bindinlist_t, VkVertexInputBindingDescription);
|
||||
RSE_LINKED_LIST_DEFINE(shader_attribute_list_t,
|
||||
VkVertexInputAttributeDescription);
|
||||
RSE_LINKED_LIST_DEFINE(dynamic_state_list_t, VkDynamicState);
|
||||
RSE_LINKED_LIST_DEFINE(pipeline_infos_list_t, VkGraphicsPipelineCreateInfo);
|
||||
|
||||
RSE_STACK_DEFINE(required_dynamic_states_t, VkDynamicState, 16U);
|
||||
|
||||
|
||||
struct binding_info_t {
|
||||
uint32_t binding;
|
||||
VkDescriptorType descriptor_type;
|
||||
VkShaderStageFlags stage_flags;
|
||||
};
|
||||
|
||||
struct pipeline_t {
|
||||
VkPipeline pipeline;
|
||||
uint8_t id;
|
||||
/* Shader stages */
|
||||
size_t shader_stages_count;
|
||||
VkPipelineShaderStageCreateInfo shader_stages[MAX_SHADER_STAGES];
|
||||
/* Input assembly */
|
||||
VkPipelineInputAssemblyStateCreateInfo input_assembly;
|
||||
/* Viewport state */
|
||||
VkPipelineViewportStateCreateInfo viewport_state;
|
||||
/* Rasterizer */
|
||||
VkPipelineRasterizationStateCreateInfo rasterizer;
|
||||
/* Multisampling */
|
||||
VkPipelineMultisampleStateCreateInfo multisampling;
|
||||
/* Color blending */
|
||||
VkPipelineColorBlendAttachmentState color_blend_attachment;
|
||||
VkPipelineColorBlendStateCreateInfo color_blending;
|
||||
/* Depth stencil */
|
||||
VkPipelineDepthStencilStateCreateInfo depth_stencil;
|
||||
struct vertex_bindinlist_t* vertex_bindings;
|
||||
struct shader_attribute_list_t* shader_attributes;
|
||||
struct dynamic_state_list_t* dynamic_states;
|
||||
struct required_dynamic_states_t required_dynamic_states;
|
||||
};
|
||||
struct pipeline_t;
|
||||
struct pipeline_infos_list_t;
|
||||
|
||||
/**
|
||||
* @brief Initialize pipeline builder
|
||||
@@ -66,7 +30,7 @@ struct pipeline_t {
|
||||
* @param[out] pipeline Pipeline to initialize. Must be NULL
|
||||
* @return RSE_SUCCESS on success, error code otherwise
|
||||
*/
|
||||
rse_err_t pipeline_builder_init(struct pipeline_t* pipeline);
|
||||
rse_err_t pipeline_builder_init(struct pipeline_t** pipeline);
|
||||
|
||||
/**
|
||||
* @brief Add shader stages to pipeline
|
||||
@@ -115,6 +79,18 @@ rse_err_t pipeline_add_vertex_input_attribute(struct pipeline_t* pipeline, const
|
||||
*/
|
||||
rse_err_t pipeline_add_dynamic_state(struct pipeline_t* pipeline, const VkDynamicState dynamic_state);
|
||||
|
||||
/**
|
||||
* @brief Add descriptor pool
|
||||
*
|
||||
* @param[in] context Graphics context handle
|
||||
* @param[in] pipeline Pipeline to add descriptor pool to
|
||||
* @param[in] descriptor_type Type of descriptors to be stored in this pool.
|
||||
* @return RSE_SUCCESS on success, error code otherwise
|
||||
*/
|
||||
rse_err_t pipeline_add_descriptor_pool(struct graphics_context_t* context,
|
||||
struct pipeline_t* pipeline,
|
||||
enum VkDescriptorType descriptor_type);
|
||||
|
||||
/**
|
||||
* @brief Add required dynamic state to pipeline
|
||||
*
|
||||
@@ -136,7 +112,7 @@ rse_err_t pipeline_add_descriptor_layout(struct graphics_context_t* context,
|
||||
* @param[in] pipeline Pipelines list to build
|
||||
* @return RSE_SUCCESS on success, error code otherwise
|
||||
*/
|
||||
rse_err_t build_pipelines(struct graphics_context_t* context,
|
||||
rse_err_t pipelines_build(struct graphics_context_t* context,
|
||||
struct pipeline_infos_list_t* pipelines);
|
||||
|
||||
/**
|
||||
@@ -144,10 +120,10 @@ rse_err_t build_pipelines(struct graphics_context_t* context,
|
||||
*
|
||||
* @param[in] context Graphics context handle
|
||||
* @param[in] pipeline Pipeline to add
|
||||
* @param[out] pipelines List of pipelines
|
||||
* @param[out] pipeline_info List of pipelines infos, where new info should be added
|
||||
* @return RSE_SUCCESS on success, error code otherwise
|
||||
*/
|
||||
rse_err_t add_pipeline(const struct graphics_context_t* context, struct pipeline_t* pipeline, struct pipeline_infos_list_t* pipelines);
|
||||
rse_err_t add_pipeline(const struct graphics_context_t* context, struct pipeline_t* pipeline, struct pipeline_infos_list_t** pipelines);
|
||||
|
||||
/**
|
||||
* @brief Destroy all pipelines
|
||||
|
||||
Reference in new issue
Block a user