diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-02-11 12:16:56 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-11 12:16:56 +0800 |
| commit | c7f486c57cec2aae901dec6123fc57dfb5133f46 (patch) | |
| tree | b2942e3b6f287ad7e5f4b4408ba9f66010710b63 | |
| parent | aec57d849ae20a305d08348cf543d19eabc2e2d6 (diff) | |
Comment call to vkCreateInstance with a potential pitfall (#2642)
Although we could in principle write this explanatory message to stderr, that
would entangle this call with the layer search above for what is probably a
very unlikely possibility on any normal system.
| -rw-r--r-- | tools/gfx/vulkan/vk-device.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp index 866b53d23..b5eec0b72 100644 --- a/tools/gfx/vulkan/vk-device.cpp +++ b/tools/gfx/vulkan/vk-device.cpp @@ -221,7 +221,13 @@ Result DeviceImpl::initVulkanInstanceAndDevice( for (auto apiVersion : apiVersionsToTry) { applicationInfo.apiVersion = apiVersion; - if (m_api.vkCreateInstance(&instanceCreateInfo, nullptr, &instance) == VK_SUCCESS) + // If r is VK_ERROR_LAYER_NOT_PRESENT, it's almost certainly + // because the layer shared library failed to load (we check that + // the layer is known earlier). It might, for example, be absent + // from the system library search path, and not referenced with an + // absolute path in VkLayer_khronos_validation.json. + const auto r = m_api.vkCreateInstance(&instanceCreateInfo, nullptr, &instance) ; + if (r == VK_SUCCESS) { break; } |
