Updated PipelineBuilder to now allow adding vertex bindings
This commit is contained in:
@@ -34,11 +34,10 @@ namespace basalt
|
|||||||
PipelineBuilder& add_dynamic_states(const basalt::darray<VkDynamicState>& states);
|
PipelineBuilder& add_dynamic_states(const basalt::darray<VkDynamicState>& states);
|
||||||
PipelineBuilder& set_render_pass(VkRenderPass render_pass);
|
PipelineBuilder& set_render_pass(VkRenderPass render_pass);
|
||||||
PipelineBuilder& add_colour_attachment(VkPipelineColorBlendAttachmentState attachment);
|
PipelineBuilder& add_colour_attachment(VkPipelineColorBlendAttachmentState attachment);
|
||||||
|
PipelineBuilder& add_vertex_binding(VkVertexInputBindingDescription binding, VkVertexInputAttributeDescription* attributes, u32 num_bindings);
|
||||||
|
|
||||||
Pipeline build();
|
Pipeline build();
|
||||||
|
|
||||||
basalt::darray<VkShaderModule> shader_modules;
|
|
||||||
basalt::darray<VkPipelineShaderStageCreateInfo> shader_stages;
|
|
||||||
|
|
||||||
VkPipelineRasterizationStateCreateInfo raster_ci;
|
VkPipelineRasterizationStateCreateInfo raster_ci;
|
||||||
VkPipelineColorBlendStateCreateInfo colour_blend_ci;
|
VkPipelineColorBlendStateCreateInfo colour_blend_ci;
|
||||||
@@ -48,6 +47,10 @@ namespace basalt
|
|||||||
VkPipelineViewportStateCreateInfo viewport_ci;
|
VkPipelineViewportStateCreateInfo viewport_ci;
|
||||||
VkPipelineInputAssemblyStateCreateInfo assembly_ci;
|
VkPipelineInputAssemblyStateCreateInfo assembly_ci;
|
||||||
VkPipelineDynamicStateCreateInfo dynamic_state_ci;
|
VkPipelineDynamicStateCreateInfo dynamic_state_ci;
|
||||||
|
basalt::darray<VkVertexInputAttributeDescription> vertex_input_attributes;
|
||||||
|
basalt::darray<VkVertexInputBindingDescription> vertex_binding_description;
|
||||||
|
basalt::darray<VkShaderModule> shader_modules;
|
||||||
|
basalt::darray<VkPipelineShaderStageCreateInfo> shader_stages;
|
||||||
basalt::darray<VkPipelineColorBlendAttachmentState> colour_attachments;
|
basalt::darray<VkPipelineColorBlendAttachmentState> colour_attachments;
|
||||||
basalt::darray<VkDynamicState> dynamic_states;
|
basalt::darray<VkDynamicState> dynamic_states;
|
||||||
VkViewport viewport;
|
VkViewport viewport;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ basalt::PipelineBuilder::PipelineBuilder(basalt::Device& device, VkExtent2D exte
|
|||||||
shader_modules(MEMORY_TAG_CLASS_DYNARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY),
|
shader_modules(MEMORY_TAG_CLASS_DYNARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY),
|
||||||
colour_attachments(MEMORY_TAG_CLASS_DYNARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY),
|
colour_attachments(MEMORY_TAG_CLASS_DYNARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY),
|
||||||
dynamic_states(MEMORY_TAG_CLASS_DYNARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY),
|
dynamic_states(MEMORY_TAG_CLASS_DYNARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY),
|
||||||
|
vertex_input_attributes(MEMORY_TAG_CLASS_DYNARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY),
|
||||||
|
vertex_binding_description(MEMORY_TAG_CLASS_DYNARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY),
|
||||||
device(device), previous_pipeline(previous_pipeline)
|
device(device), previous_pipeline(previous_pipeline)
|
||||||
{
|
{
|
||||||
dynamic_state_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
dynamic_state_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
||||||
@@ -171,6 +173,11 @@ basalt::Pipeline basalt::PipelineBuilder::build()
|
|||||||
colour_blend_ci.attachmentCount = this->colour_attachments.m_nelements;
|
colour_blend_ci.attachmentCount = this->colour_attachments.m_nelements;
|
||||||
colour_blend_ci.pAttachments = this->colour_attachments.m_pdata;
|
colour_blend_ci.pAttachments = this->colour_attachments.m_pdata;
|
||||||
|
|
||||||
|
vertex_ci.pVertexBindingDescriptions = this->vertex_binding_description.m_pdata;
|
||||||
|
vertex_ci.vertexBindingDescriptionCount = this->vertex_binding_description.m_nelements;
|
||||||
|
vertex_ci.pVertexAttributeDescriptions = this->vertex_input_attributes.m_pdata;
|
||||||
|
vertex_ci.vertexAttributeDescriptionCount = this->vertex_input_attributes.m_nelements;
|
||||||
|
|
||||||
VkGraphicsPipelineCreateInfo ci = { VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO };
|
VkGraphicsPipelineCreateInfo ci = { VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO };
|
||||||
ci.flags = VK_PIPELINE_CREATE_DERIVATIVE_BIT * (this->previous_pipeline != VK_NULL_HANDLE);
|
ci.flags = VK_PIPELINE_CREATE_DERIVATIVE_BIT * (this->previous_pipeline != VK_NULL_HANDLE);
|
||||||
ci.basePipelineHandle = this->previous_pipeline;
|
ci.basePipelineHandle = this->previous_pipeline;
|
||||||
@@ -224,3 +231,10 @@ basalt::PipelineBuilder& basalt::PipelineBuilder::add_colour_attachment(VkPipeli
|
|||||||
this->colour_attachments.push_back(attachment);
|
this->colour_attachments.push_back(attachment);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
basalt::PipelineBuilder& basalt::PipelineBuilder::add_vertex_binding(VkVertexInputBindingDescription binding, VkVertexInputAttributeDescription* attributes, u32 num_bindings)
|
||||||
|
{
|
||||||
|
this->vertex_input_attributes.push_back(attributes, num_bindings);
|
||||||
|
this->vertex_binding_description.push_back(binding);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user