Answer to the Question
The loader reports VK_ERROR_LAYER_NOT_PRESENT in two distinct situations:
- Missing layer binary. The loader cannot locate
VK_LAYER_KHRONOS_validation in any of the search directories (VK_LAYER_PATH, default OS paths, or the layer’s own runtime directory).
- API‑version mismatch. The layer binary is found, but its
VK_LAYER_PROPERTIES.apiVersion is lower than the Vulkan API version requested by the application during vkCreateDevice.
Likely Explanation
In many deployments the loader silently skips a layer that cannot be loaded (missing file, wrong architecture, or unmet dependencies). When the application later requests that layer, the loader returns VK_ERROR_LAYER_NOT_PRESENT even though the binary exists on disk but was not loaded earlier.
Confirmed Facts
According to the Vulkan loader specification, the error code is emitted in both of the scenarios above. The loader performs the check only after the instance has been created, during vkCreateDevice, and it does not distinguish between the two causes in the return value.
Programmatic Verification Steps
- Enumerate instance layers.
uint32_t layerCount = 0;
vkEnumerateInstanceLayerProperties(&layerCount, NULL);
std::vector instanceLayers(layerCount);
vkEnumerateInstanceLayerProperties(&layerCount, instanceLayers.data());
Check that VK_LAYER_KHRONOS_validation appears in instanceLayers. If it is missing, the loader cannot find the binary. Adjust VK_LAYER_PATH or install the layer.
- Create the instance.
VkInstance instance;
VkInstanceCreateInfo icci = {};
icci.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
icci.enabledLayerCount = 1;
const char *layers[] = {"VK_LAYER_KHRONOS_validation"};
icci.ppEnabledLayerNames = layers;
// ... (add extensions, etc.)
vkCreateInstance(&icci, NULL, &instance);
- Enumerate device layers for the created instance.
uint32_t devLayerCount = 0;
vkEnumerateDeviceLayerProperties(instance, &devLayerCount, NULL);
std::vector deviceLayers(devLayerCount);
vkEnumerateDeviceLayerProperties(instance, &devLayerCount, deviceLayers.data());
Verify that the layer is present and that its apiVersion field is >= the Vulkan API version you plan to request in vkCreateDevice. The apiVersion is a 32‑bit value where the high 16 bits are the major version.
- Adjust request if necessary.
- If the layer is missing, install or locate the correct binary.
- If the
apiVersion is too low, either downgrade your VkDeviceCreateInfo::apiVersion or obtain a newer layer that supports the desired version.
- Optional: Enable verbose loader logging.
setenv("VK_LOADER_DEBUG", "verbose", 1);
Check the console output; it will state whether the loader found the binary and whether it rejected it due to an API version mismatch.
Diagnostic Detail Needed
To tailor the recommendation precisely, could you confirm the Vulkan API version you are requesting in vkCreateDevice (e.g., 1.2.182)? This determines whether a version mismatch is the likely culprit.