Skip to content

Commit 841baca

Browse files
authored
Merge pull request #455 from mattakins/fix-dolphin-vulkan-swapchain-capacity
Libretro: fix launch hang on devices with Vulkan swapchains that have more than eight images
2 parents 1af289b + b27ebad commit 841baca

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

Source/Core/DolphinLibretro/Vulkan.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,17 @@ static struct
7777
} initInfo;
7878
static bool DEDICATED_ALLOCATION;
7979

80-
#define VULKAN_MAX_SWAPCHAIN_IMAGES 8
80+
struct VkSwapchainImage
81+
{
82+
VkImage handle;
83+
VkDeviceMemory memory;
84+
retro_vulkan_image retro_image;
85+
};
86+
8187
struct VkSwapchainKHR_T
8288
{
8389
uint32_t count;
84-
struct
85-
{
86-
VkImage handle;
87-
VkDeviceMemory memory;
88-
retro_vulkan_image retro_image;
89-
} images[VULKAN_MAX_SWAPCHAIN_IMAGES];
90+
std::vector<VkSwapchainImage> images;
9091
std::mutex mutex;
9192
std::condition_variable condVar;
9293
int current_index;
@@ -270,7 +271,7 @@ vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInf
270271
chain.count++;
271272
swapchain_mask >>= 1;
272273
}
273-
assert(chain.count <= VULKAN_MAX_SWAPCHAIN_IMAGES);
274+
chain.images.resize(chain.count);
274275

275276
for (uint32_t i = 0; i < chain.count; i++)
276277
{
@@ -448,7 +449,7 @@ static VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapc
448449
vkFreeMemory(device, chain.images[i].memory, pAllocator);
449450
}
450451

451-
memset(&chain.images, 0x00, sizeof(chain.images));
452+
chain.images.clear();
452453
chain.count = 0;
453454
chain.current_index = -1;
454455
}

0 commit comments

Comments
 (0)