Add Command Function pointers

This commit is contained in:
twinaphex 2016-02-29 23:04:17 +01:00
parent 67ea4e1d6b
commit 0e60d20705
3 changed files with 16 additions and 6 deletions

View File

@ -41,7 +41,7 @@ static VkDevice cached_device;
} while(0)
#define VK_GET_INSTANCE_PROC_ADDR(vk, inst, entrypoint) do { \
vk->context.fp.vk##entrypoint = (PFN_vk##entrypoint) vkGetInstanceProcAddr(inst, "vk"#entrypoint); \
vk->context.fp.vk##entrypoint = (PFN_vk##entrypoint) vk->context.fp.vkGetInstanceProcAddr(inst, "vk"#entrypoint); \
if (vk->context.fp.vk##entrypoint == NULL) { \
RARCH_ERR("vkGetInstanceProcAddr failed to find vk%s\n", #entrypoint); \
return false; \
@ -49,7 +49,7 @@ static VkDevice cached_device;
} while(0)
#define VK_GET_DEVICE_PROC_ADDR(vk, dev, entrypoint) do { \
vk->context.fp.vk##entrypoint = (PFN_vk##entrypoint) vkGetDeviceProcAddr(dev, "vk" #entrypoint); \
vk->context.fp.vk##entrypoint = (PFN_vk##entrypoint) vk->context.fp.vkGetDeviceProcAddr(dev, "vk" #entrypoint); \
if (vk->context.fp.vk##entrypoint == NULL) { \
RARCH_ERR("vkGetDeviceProcAddr failed to find vk%s\n", #entrypoint); \
return false; \
@ -284,7 +284,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
#if 0
vulkan_track_alloc(tex.image);
#endif
vkGetImageMemoryRequirements(device, tex.image, &mem_reqs);
VKFUNC(vkGetImageMemoryRequirements)(device, tex.image, &mem_reqs);
alloc.allocationSize = mem_reqs.size;
switch (type)
@ -323,7 +323,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
info.usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
VKFUNC(vkCreateImage)(device, &info, NULL, &tex.image);
vkGetImageMemoryRequirements(device, tex.image, &mem_reqs);
VKFUNC(vkGetImageMemoryRequirements)(device, tex.image, &mem_reqs);
alloc.allocationSize = mem_reqs.size;
alloc.memoryTypeIndex = vulkan_find_memory_type_fallback(&vk->context->memory_properties,
@ -1093,6 +1093,8 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
VKSYM(vk, DestroyInstance);
VKSYM(vk, AllocateMemory);
VKSYM(vk, FreeMemory);
VKSYM(vk, GetInstanceProcAddr);
VKSYM(vk, GetDeviceProcAddr);
app.pApplicationName = "RetroArch";
app.applicationVersion = 0;
@ -1152,6 +1154,9 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateImageView);
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, DestroyImageView);
/* Resource Memory Associations */
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, GetImageMemoryRequirements);
/* Descriptor pools */
VK_GET_INSTANCE_PROC_ADDR(vk, vk->context.instance, CreateDescriptorPool);

View File

@ -145,6 +145,10 @@ typedef struct vulkan_context
PFN_vkAllocateMemory vkAllocateMemory;
PFN_vkFreeMemory vkFreeMemory;
/* Command Function Pointers */
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
/* Buffers */
PFN_vkCreateBuffer vkCreateBuffer;
PFN_vkDestroyBuffer vkDestroyBuffer;
@ -168,6 +172,9 @@ typedef struct vulkan_context
PFN_vkCreateImageView vkCreateImageView;
PFN_vkDestroyImageView vkDestroyImageView;
/* Resource Memory Association */
PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
/* Queues */
PFN_vkGetDeviceQueue vkGetDeviceQueue;
PFN_vkQueueWaitIdle vkQueueWaitIdle;

View File

@ -502,11 +502,9 @@ static void vulkan_init_textures(vk_t *vk)
&vk->swapchain[i].texture);
if (vk->swapchain[i].texture.type == VULKAN_TEXTURE_STAGING)
{
vk->swapchain[i].texture_optimal = vulkan_create_texture(vk, NULL,
vk->tex_w, vk->tex_h, vk->tex_fmt,
NULL, NULL, VULKAN_TEXTURE_DYNAMIC);
}
}
}
}