diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index 3f99a56871..a498a43549 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -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); diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index 93706fb55c..a4e3223667 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -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; diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 0271f78ba3..e471aae763 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -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); - } } } }