Fix for physical device enumeration
This commit is contained in:
parent
7194db8dad
commit
40f13fc770
1 changed files with 14 additions and 3 deletions
|
|
@ -469,14 +469,25 @@ void VulkanExampleBase::initVulkan(bool enableValidation)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Physical device
|
// Physical device
|
||||||
// Note : This example will always use the first physical device reported
|
uint32_t gpuCount = 0;
|
||||||
uint32_t gpuCount;
|
// Get number of available physical devices
|
||||||
err = vkEnumeratePhysicalDevices(instance, &gpuCount, &physicalDevice);
|
err = vkEnumeratePhysicalDevices(instance, &gpuCount, nullptr);
|
||||||
|
assert(!err);
|
||||||
|
assert(gpuCount > 0);
|
||||||
|
// Enumerate devices
|
||||||
|
std::vector<VkPhysicalDevice> physicalDevices(gpuCount);
|
||||||
|
err = vkEnumeratePhysicalDevices(instance, &gpuCount, physicalDevices.data());
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Could not enumerate phyiscal devices : \n" + vkTools::errorString(err), "Fatal error");
|
vkTools::exitFatal("Could not enumerate phyiscal devices : \n" + vkTools::errorString(err), "Fatal error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note :
|
||||||
|
// This example will always use the first physical device reported,
|
||||||
|
// change the vector index if you have multiple Vulkan devices installed
|
||||||
|
// and want to use another one
|
||||||
|
physicalDevice = physicalDevices[0];
|
||||||
|
|
||||||
// Find a queue that supports graphics operations
|
// Find a queue that supports graphics operations
|
||||||
uint32_t graphicsQueueIndex = 0;
|
uint32_t graphicsQueueIndex = 0;
|
||||||
uint32_t queueCount;
|
uint32_t queueCount;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue