Add function pointer for vkCreateCommandPool

This commit is contained in:
twinaphex 2016-02-29 16:41:49 +01:00
parent 6dce80ea07
commit 6c9e8041c6
4 changed files with 32 additions and 16 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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++)

View File

@ -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);
}