summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward O'Callaghan <funfunctor@folklore1984.net>2017-02-08 00:14:50 +1100
committerEdward O'Callaghan <funfunctor@folklore1984.net>2017-02-08 00:14:50 +1100
commiteda3e214131903e03a9ebf69e9746c2d2d609be0 (patch)
tree788c398f30745a4980ddfaba63b16dd1536349d0
parentedab36b749a218e53552a0e90c48aa7b3650ae7d (diff)
src/main.cpp: Hookup the GraphicsPipeline now
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
-rw-r--r--src/main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f8cff8f..001b4e5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,6 +30,7 @@ private:
VDeleter<VkInstance> instance {vkDestroyInstance};
VDeleter<VkSurfaceKHR> surface{instance, vkDestroySurfaceKHR};
VDeleter<VkPipelineLayout> pipelineLayout{device, vkDestroyPipelineLayout};
+ VDeleter<VkPipeline> graphicsPipeline{device, vkDestroyPipeline};
VDeleter<VkRenderPass> renderPass{device, vkDestroyRenderPass};
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
@@ -219,6 +220,24 @@ private:
if (vkCreatePipelineLayout(device, &pipelineLayoutInfo, nullptr, pipelineLayout.replace()) != VK_SUCCESS)
throw std::runtime_error("failed to create pipeline layout!");
+
+ VkGraphicsPipelineCreateInfo pipelineInfo = {};
+ pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
+ pipelineInfo.stageCount = 2;
+ pipelineInfo.pStages = shaderStages;
+ pipelineInfo.pVertexInputState = &vertexInputInfo;
+ pipelineInfo.pInputAssemblyState = &inputAssembly;
+ pipelineInfo.pViewportState = &viewportState;
+ pipelineInfo.pRasterizationState = &rasterizer;
+ pipelineInfo.pMultisampleState = &multisampling;
+ pipelineInfo.pColorBlendState = &colorBlending;
+ pipelineInfo.layout = pipelineLayout;
+ pipelineInfo.renderPass = renderPass;
+ pipelineInfo.subpass = 0;
+ pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
+
+ if (vkCreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, graphicsPipeline.replace()) != VK_SUCCESS)
+ throw std::runtime_error("failed to create graphics pipeline!");
}
void createShaderModule(const std::vector<char>& code, VDeleter<VkShaderModule>& shaderModule) {