Skip to content
Snippets Groups Projects
Commit bd79dfe9 authored by Mark Oliver Mints's avatar Mark Oliver Mints
Browse files

[#71] Refactor: implement a create function for Pipeline Vertex Input State Create Info Struct

parent 6e84ab3a
No related branches found
No related tags found
1 merge request!83Resolve "Refactor Pipeline Config and Manager"
Pipeline #26686 passed
...@@ -246,13 +246,9 @@ namespace vkcv ...@@ -246,13 +246,9 @@ namespace vkcv
fillVertexInputDescription(vertexAttributeDescriptions, vertexBindingDescriptions, existsVertexShader, config); fillVertexInputDescription(vertexAttributeDescriptions, vertexBindingDescriptions, existsVertexShader, config);
// Handover Containers to PipelineVertexInputStateCreateIngo Struct // Handover Containers to PipelineVertexInputStateCreateIngo Struct
vk::PipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo( vk::PipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo =
{}, createPipelineVertexInputStateCreateInfo(vertexAttributeDescriptions,
vertexBindingDescriptions.size(), vertexBindingDescriptions);
vertexBindingDescriptions.data(),
vertexAttributeDescriptions.size(),
vertexAttributeDescriptions.data()
);
// input assembly state // input assembly state
vk::PipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo( vk::PipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo(
...@@ -543,6 +539,13 @@ namespace vkcv ...@@ -543,6 +539,13 @@ namespace vkcv
return m_Device.createShaderModule(&moduleInfo, nullptr, &module); return m_Device.createShaderModule(&moduleInfo, nullptr, &module);
} }
/**
* Fills Vertex Attribute and Binding Description with the corresponding objects form the Vertex Layout.
* @param vertexAttributeDescriptions
* @param vertexBindingDescriptions
* @param existsVertexShader
* @param config
*/
void PipelineManager::fillVertexInputDescription( void PipelineManager::fillVertexInputDescription(
std::vector<vk::VertexInputAttributeDescription> &vertexAttributeDescriptions, std::vector<vk::VertexInputAttributeDescription> &vertexAttributeDescriptions,
std::vector<vk::VertexInputBindingDescription> &vertexBindingDescriptions, std::vector<vk::VertexInputBindingDescription> &vertexBindingDescriptions,
...@@ -570,4 +573,24 @@ namespace vkcv ...@@ -570,4 +573,24 @@ namespace vkcv
} }
} }
} }
/**
* Create a Pipeline Vertex Input State Create Info Struct and fills it with Attribute and Binding data.
* @param vertexAttributeDescriptions
* @param vertexBindingDescriptions
* @return Pipeline Vertex Input State Create Info Struct
*/
vk::PipelineVertexInputStateCreateInfo PipelineManager::createPipelineVertexInputStateCreateInfo(
std::vector<vk::VertexInputAttributeDescription> &vertexAttributeDescriptions,
std::vector<vk::VertexInputBindingDescription> &vertexBindingDescriptions) {
vk::PipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo(
{},
vertexBindingDescriptions.size(),
vertexBindingDescriptions.data(),
vertexAttributeDescriptions.size(),
vertexAttributeDescriptions.data()
);
return pipelineVertexInputStateCreateInfo;
}
} }
...@@ -23,12 +23,18 @@ namespace vkcv ...@@ -23,12 +23,18 @@ namespace vkcv
void destroyPipelineById(uint64_t id); void destroyPipelineById(uint64_t id);
vk::Result createShaderModule(vk::ShaderModule &module, const ShaderProgram &shaderProgram, ShaderStage stage); vk::Result createShaderModule(vk::ShaderModule &module, const ShaderProgram &shaderProgram, ShaderStage stage);
void fillVertexInputDescription( void fillVertexInputDescription(
std::vector<vk::VertexInputAttributeDescription> &vertexAttributeDescriptions, std::vector<vk::VertexInputAttributeDescription> &vertexAttributeDescriptions,
std::vector<vk::VertexInputBindingDescription> &vertexBindingDescriptions, std::vector<vk::VertexInputBindingDescription> &vertexBindingDescriptions,
const bool existsVertexShader, const bool existsVertexShader,
const PipelineConfig &config); const PipelineConfig &config);
vk::PipelineVertexInputStateCreateInfo createPipelineVertexInputStateCreateInfo(
std::vector<vk::VertexInputAttributeDescription> &vertexAttributeDescriptions,
std::vector<vk::VertexInputBindingDescription> &vertexBindingDescriptions
);
public: public:
PipelineManager() = delete; // no default ctor PipelineManager() = delete; // no default ctor
explicit PipelineManager(vk::Device device) noexcept; // ctor explicit PipelineManager(vk::Device device) noexcept; // ctor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment