diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index c21c30a4ce..348cf3fa18 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -1058,6 +1058,7 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk, VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateFramebuffer); VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreatePipelineLayout); VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreatePipelineCache); + VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateCommandPool); if (vk->context.fp.vkEnumeratePhysicalDevices(vk->context.instance, &gpu_count, NULL) != VK_SUCCESS) diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index b4b6bb0ae5..7b59b3da38 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -138,6 +138,7 @@ typedef struct vulkan_context PFN_vkDestroySemaphore vkDestroySemaphore; PFN_vkCreateSemaphore vkCreateSemaphore; PFN_vkCreateFramebuffer vkCreateFramebuffer; + PFN_vkCreateCommandPool vkCreateCommandPool; PFN_vkGetDeviceQueue vkGetDeviceQueue; PFN_vkCreateInstance vkCreateInstance; PFN_vkCreateRenderPass vkCreateRenderPass; diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 58654ed8cd..33387b1405 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -370,12 +370,14 @@ static void vulkan_init_command_buffers(vk_t *vk) pool_info.queueFamilyIndex = vk->context->graphics_queue_index; pool_info.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; - vkCreateCommandPool(vk->context->device, + + vk->context->fp.vkCreateCommandPool(vk->context->device, &pool_info, NULL, &vk->swapchain[i].cmd_pool); - info.commandPool = vk->swapchain[i].cmd_pool; - info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; - info.commandBufferCount = 1; + info.commandPool = vk->swapchain[i].cmd_pool; + info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + info.commandBufferCount = 1; + vkAllocateCommandBuffers(vk->context->device, &info, &vk->swapchain[i].cmd); } @@ -654,7 +656,7 @@ static void vulkan_init_static_resources(vk_t *vk) &cache, NULL, &vk->pipelines.cache); pool_info.queueFamilyIndex = vk->context->graphics_queue_index; - vkCreateCommandPool(vk->context->device, + vk->context->fp.vkCreateCommandPool(vk->context->device, &pool_info, NULL, &vk->staging_pool); for (i = 0; i < 4 * 4; i++) diff --git a/gfx/drivers_font/vulkan_raster_font.c b/gfx/drivers_font/vulkan_raster_font.c index 465c94e8d6..e4688261bc 100644 --- a/gfx/drivers_font/vulkan_raster_font.c +++ b/gfx/drivers_font/vulkan_raster_font.c @@ -75,13 +75,14 @@ static void vulkan_raster_font_free_font(void *data) if (font->font_driver && font->font_data) font->font_driver->free(font->font_data); - vkQueueWaitIdle(font->vk->context->queue); + font->vk->context->fp.vkQueueWaitIdle(font->vk->context->queue); vulkan_destroy_texture(font->vk->context->device, &font->texture); free(font); } -static int vulkan_get_message_width(void *data, const char *msg, unsigned msg_len, float scale) +static int vulkan_get_message_width(void *data, const char *msg, + unsigned msg_len, float scale) { vulkan_raster_t *font = (vulkan_raster_t*)data; @@ -164,10 +165,14 @@ static void vulkan_raster_font_render_line( height = glyph->height; vulkan_write_quad_vbo(font->pv + font->vertices, - (x + off_x + delta_x * scale) * inv_win_width, (y + off_y + delta_y * scale) * inv_win_height, - width * scale * inv_win_width, height * scale * inv_win_height, - tex_x * inv_tex_size_x, tex_y * inv_tex_size_y, - width * inv_tex_size_x, height * inv_tex_size_y, + (x + off_x + delta_x * scale) * inv_win_width, + (y + off_y + delta_y * scale) * inv_win_height, + width * scale * inv_win_width, + height * scale * inv_win_height, + tex_x * inv_tex_size_x, + tex_y * inv_tex_size_y, + width * inv_tex_size_x, + height * inv_tex_size_y, &vk_color); font->vertices += 6; @@ -190,7 +195,8 @@ static void vulkan_raster_font_render_message( /* If the font height is not supported just draw as usual */ if (!font->font_driver->get_line_height) { - vulkan_raster_font_render_line(font, msg, strlen(msg), scale, color, pos_x, pos_y, text_align); + vulkan_raster_font_render_line(font, msg, strlen(msg), + scale, color, pos_x, pos_y, text_align); return; } @@ -204,20 +210,25 @@ static void vulkan_raster_font_render_message( if (delim) { unsigned msg_len = delim - msg; - vulkan_raster_font_render_line(font, msg, msg_len, scale, color, pos_x, pos_y - (float)lines * line_height, text_align); + vulkan_raster_font_render_line(font, msg, msg_len, + scale, color, pos_x, pos_y - (float)lines * line_height, + text_align); msg += msg_len + 1; lines++; } else { unsigned msg_len = strlen(msg); - vulkan_raster_font_render_line(font, msg, msg_len, scale, color, pos_x, pos_y - (float)lines * line_height, text_align); + vulkan_raster_font_render_line(font, msg, msg_len, + scale, color, pos_x, pos_y - (float)lines * line_height, + text_align); break; } } } -static void vulkan_raster_font_setup_viewport(vulkan_raster_t *font, bool full_screen) +static void vulkan_raster_font_setup_viewport( + vulkan_raster_t *font, bool full_screen) { unsigned width, height; video_driver_get_size(&width, &height); @@ -320,7 +331,8 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg, scale * drop_y / vk->vp.height, text_align); } - vulkan_raster_font_render_message(font, msg, scale, color, x, y, text_align); + vulkan_raster_font_render_message(font, msg, scale, + color, x, y, text_align); vulkan_raster_font_flush(font); }