找不到一些 lunar SDK 验证层

Cannot find some lunar SDK validation layers

我正在手动检查被 VK_LAYER_LUNARG_standard_validation

包裹的底层

已找到包装器,但未找到根据 documentation 应包装的一些验证层。

我正在这样查询图层:

const std::vector<const char*> validationLayers =
{
    "VK_LAYER_GOOGLE_threading",
    "VK_LAYER_LUNARG_parameter_validation",
    "VK_LAYER_LUNARG_device_limits",
    "VK_LAYER_LUNARG_object_tracker",
    "VK_LAYER_LUNARG_image",
    "VK_LAYER_LUNARG_core_validation",
    "VK_LAYER_LUNARG_swapchain",
    "VK_LAYER_GOOGLE_unique_objects",
};

void PrintLayerStatus(VkLayerProperties layer_info, string layer_name, bool layer_found)
{
    string major = to_string(VK_VERSION_MAJOR(layer_info.specVersion));
    string minor = to_string(VK_VERSION_MINOR(layer_info.specVersion));
    string patch = to_string(VK_VERSION_PATCH(layer_info.specVersion));
    string version = major + "." + minor + "." + patch;

    string mark = (layer_found) ? string(CHECK) : string(CROSS);
    RecordLog("\n" + string(layer_name) + ", "
        "Vulkan version " + version + ", "
        + "layer version " + to_string(layer_info.implementationVersion),
        "[" + mark + "]", 77, '.');
    if(layer_found) RecordLog("\tDescription:", string(layer_info.description), 20);
}

// Find available validation layers
bool CheckValidationLayerSupport()
{
    // Query validation layers currently isntalled
    uint32_t layerCount;
    vkEnumerateInstanceLayerProperties(&layerCount, nullptr);
    std::vector<VkLayerProperties> availableLayers(layerCount);
    vkEnumerateInstanceLayerProperties(&layerCount, availableLayers.data());

    RecordLogHeader("Requesting Vulkan validation layers\t ["
        + to_string(layerCount) + "]");

    RecordLog("Layer", "Found Status", 80-12);
    RecordLog(SEPARATOR_BAR);
    // Check needed validation layers against found layers`
    for (const char* layerName : validationLayers)
    {
        bool layerFound = false;
        VkLayerProperties layer_info;
        for (const auto& layerProperties : availableLayers)
        {
            if (strcmp(layerName, layerProperties.layerName) == 0)
            {
                layerFound = true;
                layer_info = layerProperties;
                break;
            }
        }

        PrintLayerStatus(layer_info, layerName, layerFound);
    }

    return true;
}

产生输出:

================================================================================
Requesting Vulkan validation layers      [16]
================================================================================

Layer                                                               Found Status
--------------------------------------------------------------------------------

VK_LAYER_GOOGLE_threading, Vulkan version 1.1.92, layer version 1............[✓]
        Description:       Google Validation Layer

VK_LAYER_LUNARG_parameter_validation, Vulkan version 1.1.92, layer version 1.[✓]
        Description:       LunarG Validation Layer

VK_LAYER_LUNARG_device_limits, Vulkan version 1.1.92, layer version 1........[✗]

VK_LAYER_LUNARG_object_tracker, Vulkan version 1.1.92, layer version 1.......[✓]
        Description:       LunarG Validation Layer

VK_LAYER_LUNARG_image, Vulkan version 1.1.92, layer version 1................[✗]

VK_LAYER_LUNARG_core_validation, Vulkan version 1.1.92, layer version 1......[✓]
        Description:       LunarG Validation Layer

VK_LAYER_LUNARG_swapchain, Vulkan version 1.1.92, layer version 1............[✗]

VK_LAYER_GOOGLE_unique_objects, Vulkan version 1.1.92, layer version 1.......[✓]
        Description:       Google Validation Layer

我还 运行 使用 grep 的 vulkaninfo 来查看我是否可以找到这些层

vulkaninfo | grep VK_LAYER_LUNARG_image

全部return都是空的,看来我没有正确安装SDK或者我做错了什么。

我的安装只是下载 sdk 并链接到包含目录加上 运行 setup-env.sh 脚本(我每次在编译之前都这样做)。我不确定我是否不小心跳过了一个步骤,比如 运行 一个脚本。

您使用的是旧文档。在撰写本文时,最新的 SDK 版本是 1.1.101。

根据 doc VK_LAYER_LUNARG_standard_validation 包括:

  1. VK_LAYER_GOOGLE_threading
  2. VK_LAYER_LUNARG_parameter_validation
  3. VK_LAYER_LUNARG_object_tracker
  4. VK_LAYER_LUNARG_core_validation
  5. VK_LAYER_GOOGLE_unique_objects

这些似乎符合您的输出。

当然这可能(并且确实)随着时间的推移而改变:

VK_LAYER_LUNARG_device_limits 在 SDK 1.0.21 中与 VK_LAYER_LUNARG_core_validationVK_LAYER_LUNARG_parameter_validation 合并。

VK_LAYER_LUNARG_image 在 SDK 1.0.42 中与 VK_LAYER_LUNARG_core_validation 合并。

VK_LAYER_LUNARG_swapchain 在 SDK 1.0.51 中与 VK_LAYER_LUNARG_core_validation 合并。

更新:在 1.1.106 中引入了 VK_LAYER_KHRONOS_validation,以上所有内容均已弃用。