GPUOpen-Archive / Anvil

Anvil is a cross-platform framework for Vulkan
MIT License
594 stars 62 forks source link

VK_ERROR_EXTENSION_NOT_PRESENT error if device group extension is not supported by GPU #124

Closed Silverlan closed 5 years ago

Silverlan commented 5 years ago

The Anvil::Vulkan::vkCreateInstance-call in Anvil::Instance::init will fail with a _VK_ERROR_EXTENSION_NOTPRESENT error, if the GPU does not support _VK_KHR_DEVICE_GROUP_CREATION_EXTENSIONNAME. I've had this problem occur on a machine with a GTX 970 GPU. For some reason this particular extension is enabled in the function regardless of whether it is supported or not. I've tried adding a check by changing

extension_enabled_status[VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME] = true;

to

if (is_instance_extension_supported(VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME) )
{
    extension_enabled_status[VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME] = true;
}
else
    is_device_group_creation_supported = false;

and everything seemed to work fine after that, but I'm not sure why this extension was handled different from the others in the first place?

DominikWitczakAMD commented 5 years ago

This is a good catch, thanks. The change proposal you drafted here is also correct. Please consider proposing a PR next time, this will speed up inclusion to the main branch (as it's less time-consuming to address on my end).

As to the origins of this flaw, I guess the whole problem from the fact we had kept mGPU support as private functionality for a fair amount of time. Originally this code used to be written around KHX version of the extension, later ported to KHR. The issue must have sneaked in unnoticed somewhere during this period.

Anyway, glad to hear somebody's eyes actually captured this :-)

DominikWitczakAMD commented 5 years ago

Apologies, I shouldn't have closed this issue just yet. I've already patched our private version, so the fix will be landing in the repo sometime next week.