尝试使用动态渲染扩展,验证层抱怨缺少 renderpass

Trying to use dynamic rendering extension, validation layers complain about missing renderpass

我想使用动态渲染扩展来最终摆脱 renderpasses。

然而,当我尝试制作管道时,我的验证层大喊:

required parameter pCreateInfos[0].renderPass specified as VK_NULL_HANDLE

为此创建信息。


    vk::GraphicsPipelineCreateInfo pipelineInfo{};
    pipelineInfo.stageCount = 2;
    pipelineInfo.pStages = shaderStages;
    pipelineInfo.pVertexInputState = &vertexInputInfo;
    pipelineInfo.pInputAssemblyState = &inputAssembly;
    pipelineInfo.pViewportState = &viewportState;
    pipelineInfo.pRasterizationState = &rasterizer;
    pipelineInfo.pMultisampleState = &multisampling;
    pipelineInfo.pColorBlendState = &colorBlending;
    pipelineInfo.layout = pipelineLayout;
    pipelineInfo.pDynamicState = &dynamicState;
    pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;

我正在尝试遵循此示例:https://github.com/SaschaWillems/Vulkan/blob/master/examples/dynamicrendering/dynamicrendering.cpp

如何让 vulkan 知道我不需要渲染通道?

设置代码


    vk::PhysicalDeviceDynamicRenderingFeaturesKHR dynamic_rendering = {};
    dynamic_rendering.dynamicRendering = true;

    features.pNext = &dynamic_rendering;

    // Setup general information about the current application.
    vk::ApplicationInfo program_info(
        "NeverEngine",
        VK_MAKE_VERSION(1, 0, 0),
        "No Engine",
        VK_MAKE_VERSION(1, 0, 0),
        VK_API_VERSION_1_2);
    // Create Vulkan instance to communicate with the loader.
    vk::InstanceCreateInfo create_info = {};
    create_info.pNext = &features;
    create_info.pApplicationInfo = &program_info,
    create_info.enabledLayerCount = static_cast<uint32_t>(VALIDATION_LAYERS.size()),
    create_info.ppEnabledLayerNames = VALIDATION_LAYERS.data(),
    create_info.enabledExtensionCount = static_cast<uint32_t>(required_extensions.size()),
    create_info.ppEnabledExtensionNames = required_extensions.data();

    auto [result, instance] = vk::createInstanceUnique(create_info);
    Assert(result == vk::Result::eSuccess, "Error: Failed to create instance");

从错误消息看来,验证层的版本是 1.2.198

来自changelog

VK_KHR_dynamic_rendering (Note: Validation Layer support is incomplete, incorrect results are possible)