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. */ /* We're not reusing the objects themselves. */
if (old && old->view != VK_NULL_HANDLE) 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) if (old && old->image != VK_NULL_HANDLE)
{ {
VKFUNC(vkDestroyImage)(vk->context->device, old->image, NULL); 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.levelCount = 1;
view.subresourceRange.layerCount = 1; view.subresourceRange.layerCount = 1;
vkCreateImageView(device, &view, NULL, &tex.view); VKFUNC(vkCreateImageView)(device, &view, NULL, &tex.view);
vkGetImageSubresourceLayout(device, tex.image, &subresource, &layout); vkGetImageSubresourceLayout(device, tex.image, &subresource, &layout);
tex.stride = layout.rowPitch; tex.stride = layout.rowPitch;
@ -503,8 +503,8 @@ void vulkan_destroy_texture(
if (tex->mapped) if (tex->mapped)
VKFUNC(vkUnmapMemory)(device, tex->memory); VKFUNC(vkUnmapMemory)(device, tex->memory);
vkFreeMemory(device, tex->memory, NULL); vkFreeMemory(device, tex->memory, NULL);
vkDestroyImageView(device, tex->view, NULL); VKFUNC(vkDestroyImageView)(device, tex->view, NULL);
vkDestroyImage(device, tex->image, NULL); VKFUNC(vkDestroyImage)(device, tex->image, NULL);
#ifdef VULKAN_DEBUG_TEXTURE_ALLOC #ifdef VULKAN_DEBUG_TEXTURE_ALLOC
vulkan_track_dealloc(tex->image); vulkan_track_dealloc(tex->image);
#endif #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, DestroyImage);
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CmdCopyImage); 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 */ /* Descriptor pools */
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateDescriptorPool); 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 */ /* Framebuffers */
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateFramebuffer); 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); VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, AllocateCommandBuffers);
/* Memory allocation */ /* Memory allocation */

View File

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

View File

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