baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.88k stars 1.33k forks source link

crash if "VK_KHR_get_physical_device_properties2" is not enabled when "Enable API Validation" #3362

Closed llcxiongmao closed 3 months ago

llcxiongmao commented 3 months ago

Description

crash if "VK_KHR_get_physical_device_properties2" is not enabled when "Enable API Validation", I do not find any note from doc, it is a bug?

Steps to reproduce

Environment

baldurk commented 3 months ago

I can't reproduce this, making that change the program runs fine even with API validation enabled.

I'm not sure this is a RenderDoc crash. Do you have any third party software active on your system that might interact with vulkan? for example screen recording/overlay/monitoring software that could enable a vulkan layer, or the 'vkconfig' tool?

llcxiongmao commented 3 months ago

It is not RenderDoc crash, the launch app crash. vkCreateDevice will no return, abort directly. So please check this little code:


#include <cstdio>
#include <Windows.h>

#define VK_USE_PLATFORM_WIN32_KHR
#include <vulkan/vulkan.h>

int main() {
    VkApplicationInfo app_info = {};
    app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
    app_info.pNext = nullptr;
    app_info.pApplicationName = "aaaa";
    app_info.applicationVersion = 0;
    app_info.pEngineName = "aaaa";
    app_info.engineVersion = 0;
    app_info.apiVersion = VK_API_VERSION_1_0;

    // If not enable "VK_KHR_get_physical_device_properties2",
    // it is will crash when "Enable API Validation" checked.
    const char* _tmp[] = {
        VK_KHR_SURFACE_EXTENSION_NAME,  //
        VK_KHR_WIN32_SURFACE_EXTENSION_NAME,
        // "VK_KHR_get_physical_device_properties2"
    };

    VkInstanceCreateInfo inst_info = {};
    inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
    inst_info.pNext = nullptr;
    inst_info.flags = 0;
    inst_info.pApplicationInfo = &app_info;
    inst_info.enabledLayerCount = 0;
    inst_info.ppEnabledLayerNames = nullptr;
    inst_info.enabledExtensionCount = 2;
    inst_info.ppEnabledExtensionNames = _tmp;
    VkInstance newInstance = VK_NULL_HANDLE;
    vkCreateInstance(&inst_info, nullptr, &newInstance);

    uint32_t nGpus = 100;
    VkPhysicalDevice gpus[100] = {};
    vkEnumeratePhysicalDevices(newInstance, &nGpus, gpus);

    VkDeviceCreateInfo device_info = {};
    device_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
    device_info.pNext = nullptr;
    device_info.flags = 0;
    device_info.queueCreateInfoCount = 0;
    device_info.pQueueCreateInfos = nullptr;
    device_info.enabledLayerCount = 0;
    device_info.ppEnabledLayerNames = nullptr;
    device_info.enabledExtensionCount = 0;
    device_info.ppEnabledExtensionNames = nullptr;
    device_info.pEnabledFeatures = nullptr;
    VkDevice newDevice = VK_NULL_HANDLE;
    printf("message: 0\n");
    // This call will no return, abort directly.
    vkCreateDevice(gpus[0], &device_info, NULL, &newDevice);
    printf("message: 1\n");
    (void)getchar();
    return 0;
}

When i check "Enable API Validation" and launch, the app will crash at vkCreateDevice otherwise it is run good.

baldurk commented 3 months ago

I understood exactly what you were reporting, I get that it's the application crashing not the RenderDoc UI. I'm saying I don't think it's a bug in RenderDoc. I compiled and ran your program and it ran completely fine from RenderDoc with "Enable API validation".

You didn't answer any of my questions above, please answer the questions so I can help diagnose the problem especially as I suspect this is caused by some third party software on your computer.

llcxiongmao commented 3 months ago

My computer have no software interact with vulkan, but i will find other clear computer to test. Thank you for responding so quickly.

llcxiongmao commented 3 months ago

I cannot reproduce this issues on other clear computer, so this is my local machine issues. Thanks and I close this issues.

llcxiongmao commented 2 months ago

I solve this issue by reinstall vulkan sdk. I hope it can help you if you have the same problem.