找不到某些月球SDK验证层

时间:2019-03-14 04:03:05

标签: c++ linux sdk vulkan

我正在手动检查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

它们全部返回空,所以看来我没有正确安装SDK或做错了事。

我的安装只是下载sdk并链接到include目录,再运行setup-env.sh脚本(我在编译之前每次都这样做)。我不确定是否意外跳过了某个步骤,例如运行脚本。

1 个答案:

答案 0 :(得分:4)

您正在使用旧文档。在撰写本文时,最新的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,而上述所有内容均已弃用。