@ -944,26 +944,11 @@ VkResult init_vulkan(GLFWwindow* window, RenderContext* context) {
return result ;
}
result = create_ui_descriptor_set ( context - > device , context - > allocator , context - > swapchain_extent , & context - > ui_descriptor_layout , & context - > ui_descriptor_pool , & context - > ui_descriptor_set , & context - > ui_descriptor_memory , & context - > ui_descriptor_buffer ) ;
if ( result ! = VK_SUCCESS ) {
return result ;
}
result = create_ui_colored_rect_pipeline ( context - > device , context - > world_render_pass , context - > ui_descriptor_layout , & context - > ui_pipeline_rect ) ;
if ( result ! = VK_SUCCESS ) {
return result ;
}
result = create_ui_rect_buffer ( context - > device , context - > transfer_queue , context - > transfer_pool , context - > allocator , & context - > ui_rect ) ;
if ( result ! = VK_SUCCESS ) {
return result ;
}
context - > current_frame = 0 ;
return VK_SUCCESS ;
}
VkResult draw_frame ( RenderContext * context , UI Layer* ui_layers , uint32_t ui_layer_count ) {
VkResult draw_frame ( RenderContext * context , UIContext * ui_context , UILayer * ui_layers , uint32_t ui_layer_count ) {
VkResult result ;
result = vkWaitForFences ( context - > device , 1 , & context - > in_flight_fences [ context - > current_frame ] , VK_TRUE , UINT64_MAX ) ;
@ -1025,10 +1010,10 @@ VkResult draw_frame(RenderContext* context, UILayer* ui_layers, uint32_t ui_laye
vkCmdBeginRenderPass ( context - > swapchain_command_buffers [ context - > current_frame ] , & ui_render_pass_begin , VK_SUBPASS_CONTENTS_INLINE ) ;
// Draw UI colored rects ////////////////////////////////
vkCmdBindPipeline ( context - > swapchain_command_buffers [ context - > current_frame ] , VK_PIPELINE_BIND_POINT_GRAPHICS , context- > ui_pipeline_rect . pipeline ) ;
vkCmdBindDescriptorSets ( context - > swapchain_command_buffers [ context - > current_frame ] , VK_PIPELINE_BIND_POINT_GRAPHICS , context- > ui_pipeline_rect . layout , 0 , 1 , & context- > ui_descriptor_set , 0 , NULL ) ;
vkCmdBindVertexBuffers ( context - > swapchain_command_buffers [ context - > current_frame ] , 0 , 1 , & context- > ui_rect . vertex , & offset ) ;
vkCmdBindIndexBuffer ( context - > swapchain_command_buffers [ context - > current_frame ] , context- > ui_rect . index , 0 , VK_INDEX_TYPE_UINT32 ) ;
vkCmdBindPipeline ( context - > swapchain_command_buffers [ context - > current_frame ] , VK_PIPELINE_BIND_POINT_GRAPHICS , ui_ context- > ui_pipeline_rect . pipeline ) ;
vkCmdBindDescriptorSets ( context - > swapchain_command_buffers [ context - > current_frame ] , VK_PIPELINE_BIND_POINT_GRAPHICS , ui_ context- > ui_pipeline_rect . layout , 0 , 1 , & ui_ context- > ui_descriptor_set , 0 , NULL ) ;
vkCmdBindVertexBuffers ( context - > swapchain_command_buffers [ context - > current_frame ] , 0 , 1 , & ui_ context- > ui_rect . vertex , & offset ) ;
vkCmdBindIndexBuffer ( context - > swapchain_command_buffers [ context - > current_frame ] , ui_ context- > ui_rect . index , 0 , VK_INDEX_TYPE_UINT32 ) ;
for ( uint32_t i = 0 ; i < ui_layer_count ; i + + ) {
vkCmdBindVertexBuffers ( context - > swapchain_command_buffers [ context - > current_frame ] , 1 , 1 , & ui_layers [ i ] . colored_rects , & offset ) ;