Go through function pointer for vkCmdClearAttachments

This commit is contained in:
twinaphex 2016-02-29 19:34:40 +01:00
parent b09a19d9a0
commit 670eede306
4 changed files with 19 additions and 1 deletions

View File

@ -1244,7 +1244,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateSampler);
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, DestroySampler);
/* Clear commands */
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CmdClearAttachments);
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CmdDraw);
VK_GET_INSTANCE_PROC_ADDR(vk,
vk->context.instance, GetPhysicalDeviceSurfaceSupportKHR);
VK_GET_INSTANCE_PROC_ADDR(vk,

View File

@ -179,6 +179,9 @@ typedef struct vulkan_context
PFN_vkCreateSampler vkCreateSampler;
PFN_vkDestroySampler vkDestroySampler;
/* Clear commands */
PFN_vkCmdClearAttachments vkCmdClearAttachments;
PFN_vkCreateInstance vkCreateInstance;
PFN_vkCreateRenderPass vkCreateRenderPass;
PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties;

View File

@ -1810,6 +1810,7 @@ static void vulkan_set_texture_frame(void *data,
uint8_t *ptr = NULL;
uint8_t *dst = NULL;
const uint8_t *src = NULL;
struct vulkan_context_fp *vkcfp = NULL;
vk_t *vk = (vk_t*)data;
unsigned index = vk->context->current_swapchain_index;
struct vk_texture *texture = &vk->menu.textures[index];
@ -1824,6 +1825,11 @@ static void vulkan_set_texture_frame(void *data,
if (!vk)
return;
vkcfp = &vk->context->fp;
if (!vkcfp)
return;
/* B4G4R4A4 must be supported, but R4G4B4A4 is optional,
* just apply the swizzle in the image view instead. */
*texture = vulkan_create_texture(vk,

View File

@ -191,10 +191,16 @@ static void menu_display_vk_clear_color(void *data)
VkClearAttachment attachment = { VK_IMAGE_ASPECT_COLOR_BIT };
menu_display_ctx_clearcolor_t *clearcolor =
(menu_display_ctx_clearcolor_t*)data;
struct vulkan_context_fp *vkcfp = NULL;
vk_t *vk = vk_get_ptr();
if (!vk || !clearcolor)
return;
vkcfp = &vk->context->fp;
if (!vkcfp)
return;
attachment.clearValue.color.float32[0] = clearcolor->r;
attachment.clearValue.color.float32[1] = clearcolor->g;
attachment.clearValue.color.float32[2] = clearcolor->b;
@ -205,7 +211,7 @@ static void menu_display_vk_clear_color(void *data)
rect.rect.extent.height = vk->context->swapchain_height;
rect.layerCount = 1;
vkCmdClearAttachments(vk->cmd, 1, &attachment, 1, &rect);
VKFUNC(vkCmdClearAttachments)(vk->cmd, 1, &attachment, 1, &rect);
}
static const float *menu_display_vk_get_tex_coords(void)