Add function pointers for image view functions

This commit is contained in:
twinaphex 2016-02-29 21:55:54 +01:00
parent a6eb40b3d2
commit 1e407079e4
3 changed files with 17 additions and 7 deletions

View File

@ -337,7 +337,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
/* We're not reusing the objects themselves. */
if (old && old->view != VK_NULL_HANDLE)
vkDestroyImageView(vk->context->device, old->view, NULL);
VKFUNC(vkDestroyImageView)(vk->context->device, old->view, NULL);
if (old && old->image != VK_NULL_HANDLE)
{
VKFUNC(vkDestroyImage)(vk->context->device, old->image, NULL);
@ -392,7 +392,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
view.subresourceRange.levelCount = 1;
view.subresourceRange.layerCount = 1;
vkCreateImageView(device, &view, NULL, &tex.view);
VKFUNC(vkCreateImageView)(device, &view, NULL, &tex.view);
vkGetImageSubresourceLayout(device, tex.image, &subresource, &layout);
tex.stride = layout.rowPitch;
@ -503,8 +503,8 @@ void vulkan_destroy_texture(
if (tex->mapped)
VKFUNC(vkUnmapMemory)(device, tex->memory);
vkFreeMemory(device, tex->memory, NULL);
vkDestroyImageView(device, tex->view, NULL);
vkDestroyImage(device, tex->image, NULL);
VKFUNC(vkDestroyImageView)(device, tex->view, NULL);
VKFUNC(vkDestroyImage)(device, tex->image, NULL);
#ifdef VULKAN_DEBUG_TEXTURE_ALLOC
vulkan_track_dealloc(tex->image);
#endif
@ -1137,6 +1137,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, DestroyImage);
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CmdCopyImage);
/* Image Views */
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateImageView);
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, DestroyImageView);
/* Descriptor pools */
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateDescriptorPool);
@ -1146,6 +1150,7 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
/* Framebuffers */
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateFramebuffer);
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, DestroyFramebuffer);
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, AllocateCommandBuffers);
/* Memory allocation */

View File

@ -152,6 +152,10 @@ typedef struct vulkan_context
PFN_vkDestroyImage vkDestroyImage;
PFN_vkCmdCopyImage vkCmdCopyImage;
/* Image Views */
PFN_vkCreateImageView vkCreateImageView;
PFN_vkDestroyImageView vkDestroyImageView;
/* Queues */
PFN_vkGetDeviceQueue vkGetDeviceQueue;
PFN_vkQueueWaitIdle vkQueueWaitIdle;
@ -182,6 +186,7 @@ typedef struct vulkan_context
/* Framebuffers */
PFN_vkCreateFramebuffer vkCreateFramebuffer;
PFN_vkDestroyFramebuffer vkDestroyFramebuffer;
/* Memory allocation */
PFN_vkMapMemory vkMapMemory;

View File

@ -144,7 +144,7 @@ static void vulkan_init_framebuffers(
view.components.b = VK_COMPONENT_SWIZZLE_B;
view.components.a = VK_COMPONENT_SWIZZLE_A;
vkCreateImageView(vk->context->device,
VKFUNC(vkCreateImageView)(vk->context->device,
&view, NULL, &vk->swapchain[i].backbuffer.view);
/* Create the framebuffer */
@ -579,9 +579,9 @@ static void vulkan_deinit_framebuffers(
unsigned i;
for (i = 0; i < vk->num_swapchain_images; i++)
{
vkDestroyFramebuffer(vk->context->device,
VKFUNC(vkDestroyFramebuffer)(vk->context->device,
vk->swapchain[i].backbuffer.framebuffer, NULL);
vkDestroyImageView(vk->context->device,
VKFUNC(vkDestroyImageView)(vk->context->device,
vk->swapchain[i].backbuffer.view, NULL);
}