mirror of
https://github.com/libretro/RetroArch
synced 2025-03-01 16:13:40 +00:00
More properly enumerate GPUs.
Just pick the first one for now.
This commit is contained in:
parent
88ec0f522b
commit
0bcdf6ebe0
@ -817,6 +817,7 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
|
|||||||
VkDeviceCreateInfo device_info = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
|
VkDeviceCreateInfo device_info = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
|
||||||
uint32_t gpu_count = 1;
|
uint32_t gpu_count = 1;
|
||||||
bool found_queue = false;
|
bool found_queue = false;
|
||||||
|
VkPhysicalDevice *gpus = NULL;
|
||||||
static const float one = 1.0f;
|
static const float one = 1.0f;
|
||||||
static const char *device_extensions[] = {
|
static const char *device_extensions[] = {
|
||||||
"VK_KHR_swapchain",
|
"VK_KHR_swapchain",
|
||||||
@ -869,15 +870,27 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vkEnumeratePhysicalDevices(vk->context.instance,
|
if (vkEnumeratePhysicalDevices(vk->context.instance,
|
||||||
&gpu_count, &vk->context.gpu) != VK_SUCCESS)
|
&gpu_count, NULL) != VK_SUCCESS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (gpu_count != 1)
|
gpus = (VkPhysicalDevice*)calloc(gpu_count, sizeof(*gpus));
|
||||||
|
if (!gpus)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (vkEnumeratePhysicalDevices(vk->context.instance,
|
||||||
|
&gpu_count, gpus) != VK_SUCCESS)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (gpu_count < 1)
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Vulkan]: Failed to enumerate Vulkan physical device.\n");
|
RARCH_ERR("[Vulkan]: Failed to enumerate Vulkan physical device.\n");
|
||||||
|
free(gpus);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vk->context.gpu = gpus[0];
|
||||||
|
free(gpus);
|
||||||
|
|
||||||
vkGetPhysicalDeviceProperties(vk->context.gpu,
|
vkGetPhysicalDeviceProperties(vk->context.gpu,
|
||||||
&vk->context.gpu_properties);
|
&vk->context.gpu_properties);
|
||||||
vkGetPhysicalDeviceMemoryProperties(vk->context.gpu,
|
vkGetPhysicalDeviceMemoryProperties(vk->context.gpu,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user