VkCommandPool vk_pool;
VkSurfaceKHR vk_surface;
VkSwapchainKHR vk_swapchain;
+VkRenderPass vk_renderpass;
VkDescriptorPool vk_dpool;
/* static functions */
vkFreeDescriptorSets(vk_device, vk_dpool, num, sets);
}
+bool vku_update_descriptor_sets(VkDescriptorSet *sets, int num_sets)
+{
+// std::vector
+ return true;
+}
+VkPipelineCache vku_create_pipeline_cache()
+{
+ VkPipelineCacheCreateInfo cinf;
+ memset(&cinf, 0, sizeof cinf);
+ cinf.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
+
+ VkPipelineCache cache;
+ if(vkCreatePipelineCache(vk_device, &cinf, 0, &cache) != VK_SUCCESS) {
+ fprintf(stderr, "Failed to create pipeline cache.\n");
+ return 0;
+ }
+ return cache;
+}
+
+void vku_destroy_pipeline_cache(VkPipelineCache cache)
+{
+ vkDestroyPipelineCache(vk_device, cache, 0);
+}
+
+void vku_pl_init_shader_stage_state_info(VkPipelineShaderStageCreateInfo *ssinf,
+ VkShaderStageFlagBits stage, VkShaderModule sm)
+{
+ memset(ssinf, 0, sizeof *ssinf);
+ ssinf->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
+ ssinf->stage = stage;
+ ssinf->module = sm;
+ ssinf->pName = "main";
+}
+
+void vku_pl_init_input_asm_state_info(VkPipelineInputAssemblyStateCreateInfo *iasinf)
+{
+ memset(iasinf, 0, sizeof *iasinf);
+ iasinf->sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
+ iasinf->topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+}
+
+void vku_pl_init_viewport_state_info(VkPipelineViewportStateCreateInfo *vsinf,
+ VkViewport *viewports, int num_viewports, VkRect2D *scissors,
+ int num_scissors)
+{
+ memset(vsinf, 0, sizeof *vsinf);
+ vsinf->sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
+ vsinf->viewportCount = num_viewports;
+ vsinf->scissorCount = num_scissors;
+ vsinf->pViewports = viewports;
+ vsinf->pScissors = scissors;
+}
+
+void vku_pl_init_rasterization_state_info(VkPipelineRasterizationStateCreateInfo *rsinf)
+{
+ memset(rsinf, 0, sizeof *rsinf);
+ rsinf->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
+ rsinf->polygonMode = VK_POLYGON_MODE_FILL;
+ rsinf->cullMode = VK_CULL_MODE_FRONT_BIT;
+ rsinf->frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
+}
+
+void vku_pl_init_multisample_state_info(VkPipelineMultisampleStateCreateInfo *msinf)
+{
+ memset(msinf, 0, sizeof *msinf);
+ msinf->sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
+ msinf->rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
+}
+
+void vku_pl_init_depth_stencil_state_info(VkPipelineDepthStencilStateCreateInfo *dsinf,
+ bool enable)
+{
+ memset(dsinf, 0, sizeof *dsinf);
+ dsinf->sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
+ dsinf->depthTestEnable = enable ? VK_TRUE : VK_FALSE;
+}
+
+void vku_pl_init_color_blend_state_info(VkPipelineColorBlendStateCreateInfo *cbsinf,
+ bool enable)
+{
+ memset(cbsinf, 0, sizeof *cbsinf);
+ cbsinf->sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
+ //TODO
+}