summaryrefslogtreecommitdiffstats
path: root/tools/gfx
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-02-11 12:16:56 +0800
committerGitHub <noreply@github.com>2023-02-11 12:16:56 +0800
commitc7f486c57cec2aae901dec6123fc57dfb5133f46 (patch)
treeb2942e3b6f287ad7e5f4b4408ba9f66010710b63 /tools/gfx
parentaec57d849ae20a305d08348cf543d19eabc2e2d6 (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.
Diffstat (limited to 'tools/gfx')
-rw-r--r--tools/gfx/vulkan/vk-device.cpp8
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;
}