@@ -54,14 +54,15 @@ namespace ZEngine::Rendering::Renderers::Pipelines
5454 * Vertex Input
5555 */
5656 Array<VkVertexInputBindingDescription> vertex_input_bindings = {};
57- vertex_input_bindings.init (scratch.Arena , 5 , Specification. VertexInputBindingSpecifications . size () );
57+ vertex_input_bindings.init (scratch.Arena , 5 );
5858 for (unsigned i = 0 ; i < Specification.VertexInputBindingSpecifications .size (); ++i)
5959 {
6060 auto & input = Specification.VertexInputBindingSpecifications [i];
6161 vertex_input_bindings.push (VkVertexInputBindingDescription{.binding = input.Binding , .stride = input.Stride , .inputRate = (VkVertexInputRate) input.Rate });
6262 }
6363
6464 Array<VkVertexInputAttributeDescription> vertex_input_attributes = {};
65+ vertex_input_attributes.init (scratch.Arena , 5 );
6566 for (unsigned i = 0 ; i < Specification.VertexInputAttributeSpecifications .size (); ++i)
6667 {
6768 auto & input = Specification.VertexInputAttributeSpecifications [i];
@@ -147,40 +148,37 @@ namespace ZEngine::Rendering::Renderers::Pipelines
147148 /*
148149 * Pipeline layout
149150 */
150- auto & descriptor_set_layout_collection = Shader->SetLayouts ;
151- const auto & push_constant_collection = Shader->PushConstants ;
152151 VkPipelineLayoutCreateInfo pipeline_layout_create_info = {};
153152 pipeline_layout_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
154- pipeline_layout_create_info.setLayoutCount = descriptor_set_layout_collection .size (); // Optional
155- pipeline_layout_create_info.pSetLayouts = descriptor_set_layout_collection .data (); // Optional
156- pipeline_layout_create_info.pushConstantRangeCount = push_constant_collection .size ();
157- pipeline_layout_create_info.pPushConstantRanges = push_constant_collection .data ();
153+ pipeline_layout_create_info.setLayoutCount = Shader-> SetLayouts .size (); // Optional
154+ pipeline_layout_create_info.pSetLayouts = Shader-> SetLayouts .data (); // Optional
155+ pipeline_layout_create_info.pushConstantRangeCount = Shader-> PushConstants .size ();
156+ pipeline_layout_create_info.pPushConstantRanges = Shader-> PushConstants .data ();
158157 pipeline_layout_create_info.flags = 0 ;
159158 pipeline_layout_create_info.pNext = nullptr ;
160159 ZENGINE_VALIDATE_ASSERT (vkCreatePipelineLayout (Device->LogicalDevice , &(pipeline_layout_create_info), nullptr , &Layout) == VK_SUCCESS, " Failed to create pipeline layout" )
161160 /*
162161 * Graphic Pipeline Creation
163162 */
164- const auto & shader_create_info_collection = Shader->ShaderCreateInfos ;
165- VkGraphicsPipelineCreateInfo graphic_pipeline_create_info = {};
166- graphic_pipeline_create_info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
167- graphic_pipeline_create_info.stageCount = shader_create_info_collection.size ();
168- graphic_pipeline_create_info.pStages = shader_create_info_collection.data ();
169- graphic_pipeline_create_info.pVertexInputState = &(vertex_input_state_create_info);
170- graphic_pipeline_create_info.pInputAssemblyState = &(input_assembly_state_create_info);
171- graphic_pipeline_create_info.pViewportState = &(viewport_state_create_info);
172- graphic_pipeline_create_info.pRasterizationState = &(rasterization_create_info);
173- graphic_pipeline_create_info.pMultisampleState = &(multisample_state_create_info);
174- graphic_pipeline_create_info.pDepthStencilState = Specification.EnableDepthTest ? &(depth_stencil_state_create_info) : nullptr ;
175- graphic_pipeline_create_info.pColorBlendState = &(color_blend_state_create_info);
176- graphic_pipeline_create_info.pDynamicState = &(dynamic_state_create_info);
177- graphic_pipeline_create_info.layout = Layout;
178- graphic_pipeline_create_info.renderPass = Specification.Attachment ->GetHandle ();
179- graphic_pipeline_create_info.subpass = 0 ;
180- graphic_pipeline_create_info.basePipelineHandle = VK_NULL_HANDLE; // Optional
181- graphic_pipeline_create_info.basePipelineIndex = -1 ; // Optional
182- graphic_pipeline_create_info.flags = 0 ; // Optional
183- graphic_pipeline_create_info.pNext = nullptr ; // Optional
163+ VkGraphicsPipelineCreateInfo graphic_pipeline_create_info = {};
164+ graphic_pipeline_create_info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
165+ graphic_pipeline_create_info.stageCount = Shader->ShaderCreateInfos .size ();
166+ graphic_pipeline_create_info.pStages = Shader->ShaderCreateInfos .data ();
167+ graphic_pipeline_create_info.pVertexInputState = &(vertex_input_state_create_info);
168+ graphic_pipeline_create_info.pInputAssemblyState = &(input_assembly_state_create_info);
169+ graphic_pipeline_create_info.pViewportState = &(viewport_state_create_info);
170+ graphic_pipeline_create_info.pRasterizationState = &(rasterization_create_info);
171+ graphic_pipeline_create_info.pMultisampleState = &(multisample_state_create_info);
172+ graphic_pipeline_create_info.pDepthStencilState = Specification.EnableDepthTest ? &(depth_stencil_state_create_info) : nullptr ;
173+ graphic_pipeline_create_info.pColorBlendState = &(color_blend_state_create_info);
174+ graphic_pipeline_create_info.pDynamicState = &(dynamic_state_create_info);
175+ graphic_pipeline_create_info.layout = Layout;
176+ graphic_pipeline_create_info.renderPass = Specification.Attachment ->GetHandle ();
177+ graphic_pipeline_create_info.subpass = 0 ;
178+ graphic_pipeline_create_info.basePipelineHandle = VK_NULL_HANDLE; // Optional
179+ graphic_pipeline_create_info.basePipelineIndex = -1 ; // Optional
180+ graphic_pipeline_create_info.flags = 0 ; // Optional
181+ graphic_pipeline_create_info.pNext = nullptr ; // Optional
184182 ZENGINE_VALIDATE_ASSERT (vkCreateGraphicsPipelines (Device->LogicalDevice , VK_NULL_HANDLE, 1 , &graphic_pipeline_create_info, nullptr , &Handle) == VK_SUCCESS, " Failed to create Graphics Pipeline" )
185183
186184 ZReleaseScratch (scratch);
0 commit comments