Nvoglv64.dll crashes w/ "Access violation reading location" at vkCreateComputePipelines

I’ve just switched from Vulkan 1.2.198 to Vulkan 1.3.224 and the creation of a compute pipeline stopped working giving me the error I wrote in the title.

I’ve attached the problematic shader on this post, you can find both the source code and the compiled SPV code. (To compile it I’ve used glslc --target-env=vulkan1.3 --target-spv=spv1.4 …).

shaders.zip (12.8 KB)

I’ve tried updating drivers and now I’m on 516.94, GPU is NVIDIA GeForce RTX 2060 SUPER. I’m still experiencing the same issue.

HI @loryruta,
Please provide a minimal test code with executable. We hve no enough information.

Here’s the source code of a small repro. I’ve also zipped a compiled binary for windows x64

OS: Windows 10 Home
OS version: 10.0.19044 Build 19044
Architecture: x64
Device: NVIDIA GeForce RTX 2060 SUPER
Driver version: 519.94
Vulkan version: 1.3.224.0

vk_driver_bug_20220830.zip (1.8 MB)

The command I used to recompile the shader (run in ./shaders directory):
glslc --target-env=vulkan1.3 --target-spv=spv1.4 -I . -g shade.comp -o shade.comp.spv

Hi there @loryruta, welcome to the NVIDIA developer forums!

Thank you for the additional information, hopefully this will help us help you!

@AndreyOGL_D3D thank you for stepping up! If you are able to use the provided code and reproduce, please do not hesitate to share your insights. That is very much appreciated!

Meanwhile I will see if i can bring some engineers in on this topic.

Thanks!

@loryruta doesn’t work on nVidia GT 1030, also on Intel UHD 630,

It works on the PC of a friend of mine with the following details:

API version: 1.3.205
Device name: NVIDIA GeForce RTX 3070 Ti
Driver version: 516.236.0

I’ve edited a little bit the repro so you can easily check driver version/device name and whether it’s working or not. If it writes “ALL OK!” then the pipeline has correctly been created.

vk_driver_bug.zip (32.8 KB)

@loryruta

  1. Don’t pack to archive *.pdb, *.ilk
  2. Pack Visual Studio solution, some people doesn’t know about CMake, ninja, meson…
  3. Use Vulkan Validation layers!

You have some errors: Intel UHD 630:

Vulkan Debug Ouput: ERROR: [VUID-VkPipelineLayoutCreateInfo-descriptorType-03016] Code 1451322977 : Validation Error: [ VUID-VkPipelineLayoutCreateInfo-descriptorType-03016 ] Object 0: handle = 0x2aaef44c728, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x56816e61 | vkCreatePipelineLayout(): max per-stage sampler bindings count (65539) exceeds device maxPerStageDescriptorSamplers limit (64). The Vulkan spec states: The total number of descriptors in descriptor set layouts created without the VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT bit set with a descriptorType of VK_DESCRIPTOR_TYPE_SAMPLER and VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER accessible to any given shader stage across all elements of pSetLayouts must be less than or equal to VkPhysicalDeviceLimits::maxPerStageDescriptorSamplers (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: ERROR: [VUID-VkPipelineLayoutCreateInfo-descriptorType-03019] Code 123232845 : Validation Error: [ VUID-VkPipelineLayoutCreateInfo-descriptorType-03019 ] Object 0: handle = 0x2aaef44c728, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x758624d | vkCreatePipelineLayout(): max per-stage sampled image bindings count (65539) exceeds device maxPerStageDescriptorSampledImages limit (200). The Vulkan spec states: The total number of descriptors in descriptor set layouts created without the VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT bit set with a descriptorType of VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, and VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER accessible to any given shader stage across all elements of pSetLayouts must be less than or equal to VkPhysicalDeviceLimits::maxPerStageDescriptorSampledImages (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: ERROR: [VUID-VkPipelineLayoutCreateInfo-descriptorType-03028] Code 1649030924 : Validation Error: [ VUID-VkPipelineLayoutCreateInfo-descriptorType-03028 ] Object 0: handle = 0x2aaef44c728, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x624a370c | vkCreatePipelineLayout(): sum of sampler bindings among all stages (65539) exceeds device maxDescriptorSetSamplers limit (576). The Vulkan spec states: The total number of descriptors in descriptor set layouts created without the VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT bit set with a descriptorType of VK_DESCRIPTOR_TYPE_SAMPLER and VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER accessible across all shader stages and across all elements of pSetLayouts must be less than or equal to VkPhysicalDeviceLimits::maxDescriptorSetSamplers (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: ERROR: [VUID-VkPipelineLayoutCreateInfo-descriptorType-03033] Code 1719637218 : Validation Error: [ VUID-VkPipelineLayoutCreateInfo-descriptorType-03033 ] Object 0: handle = 0x2aaef44c728, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x667f94e2 | vkCreatePipelineLayout(): sum of sampled image bindings among all stages (65539) exceeds device maxDescriptorSetSampledImages limit (1800). The Vulkan spec states: The total number of descriptors in descriptor set layouts created without the VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT bit set with a descriptorType of VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, and VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER accessible across all shader stages and across all elements of pSetLayouts must be less than or equal to VkPhysicalDeviceLimits::maxDescriptorSetSampledImages (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: ERROR: [VUID-VkComputePipelineCreateInfo-layout-01687] Code 1932956818 : Validation Error: [ VUID-VkComputePipelineCreateInfo-layout-01687 ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_PIPELINE; | MessageID = 0x73369492 | Invalid Pipeline CreateInfo State: Shader Stage VK_SHADER_STAGE_COMPUTE_BIT exceeds component limit VkPhysicalDeviceLimits::maxPerStageResources (200) The Vulkan spec states: The number of resources in layout accessible to the compute shader stage must be less than or equal to VkPhysicalDeviceLimits::maxPerStageResources (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: WARNING: [UNASSIGNED-BestPractices-SpirvDeprecated_WorkgroupSize] Code 2076578180 : Validation Warning: [ UNASSIGNED-BestPractices-SpirvDeprecated_WorkgroupSize ] Object 0: handle = 0x2aaef44c728, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7bc61184 | vkCreateComputePipelines(): pCreateInfos[ 0] is using the Workgroup built-in which SPIR-V 1.6 deprecated. The VK_KHR_maintenance4 extension exposes a new LocalSizeId execution mode that should be used instead.

nVidia 1030:

Vulkan Debug Ouput: WARNING: [UNASSIGNED-BestPractices-SpirvDeprecated_WorkgroupSize] Code 2076578180 : Validation Warning: [ UNASSIGNED-BestPractices-SpirvDeprecated_WorkgroupSize ] Object 0: handle = 0x274c016b1d0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7bc61184 | vkCreateComputePipelines(): pCreateInfos[ 0] is using the Workgroup built-in which SPIR-V 1.6 deprecated. The VK_KHR_maintenance4 extension exposes a new LocalSizeId execution mode that should be used instead.
Vulkan Debug Ouput: ERROR: [VUID-vkDestroyDevice-device-00378] Code 1901072314 : Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x274c016b1d0, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0xead9370000000008, type = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x274c016b1d0, VkDescriptorSetLayout 0xead9370000000008 has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: ERROR: [VUID-vkDestroyDevice-device-00378] Code 1901072314 : Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x274c016b1d0, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0xcb3ee80000000007, type = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x274c016b1d0, VkDescriptorSetLayout 0xcb3ee80000000007 has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: ERROR: [VUID-vkDestroyDevice-device-00378] Code 1901072314 : Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x274c016b1d0, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0xe7f79a0000000005, type = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x274c016b1d0, VkDescriptorSetLayout 0xe7f79a0000000005 has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: ERROR: [VUID-vkDestroyDevice-device-00378] Code 1901072314 : Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x274c016b1d0, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0xf443490000000006, type = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x274c016b1d0, VkDescriptorSetLayout 0xf443490000000006 has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: ERROR: [VUID-vkDestroyDevice-device-00378] Code 1901072314 : Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x274c016b1d0, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0xcfef35000000000a, type = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x274c016b1d0, VkDescriptorSetLayout 0xcfef35000000000a has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (Vulkan® 1.3.224 - A Specification (with all registered extensions))
Vulkan Debug Ouput: ERROR: [VUID-vkDestroyDevice-device-00378] Code 1901072314 : Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x274c016b1d0, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0xee647e0000000009, type = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x274c016b1d0, VkDescriptorSetLayout 0xee647e0000000009 has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (Vulkan® 1.3.224 - A Specification (with all registered extensions))

Your last

API version: 1.3.205 Device name: NVIDIA GeForce GT 1030 Driver version: 516.376.0 ALL OK!

API version: 1.3.212 Device name: Intel(R) UHD Graphics Driver version: 0.404.1994 ALL OK!

I attached source code with modification

#pragma once

#include <cmath>
#include <cstdarg>
#include <stdexcept>
#include <vector>
#include <optional>
#include <set>
#include <fstream>
#ifdef _WIN32
#include <windows.h>
#endif

#include <vulkan/vulkan.h>

#pragma comment(lib, "vulkan-1.lib")

struct QueueFamilyIndices
{
    std::optional<uint32_t> graphicsFamily;

    bool isComplete()
    {
        return graphicsFamily.has_value();
    }
};

QueueFamilyIndices findQueueFamilies(VkPhysicalDevice device)
{
    QueueFamilyIndices indices;

    uint32_t queueFamilyCount = 0;
    vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, nullptr);

    std::vector<VkQueueFamilyProperties> queueFamilies(queueFamilyCount);
    vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, queueFamilies.data());

    int i = 0;
    for (const auto& queueFamily : queueFamilies)
    {
        if (queueFamily.queueFlags & VK_QUEUE_GRAPHICS_BIT)
        {
            indices.graphicsFamily = i;
        }

        if (indices.isComplete())
        {
            break;
        }

        i++;
    }

    return indices;
}

void loadBinFile(char const* filePath, std::vector<char>& buffer)
{
    std::ifstream f(filePath, std::ios::ate | std::ios::binary);
    if (!f.is_open()) {
        throw std::runtime_error("Failed to open file");
    }

    auto fileSize = f.tellg();
    buffer.resize((size_t) std::ceilf(float(fileSize) / float(sizeof(uint32_t))) * sizeof(uint32_t)); // Rounds to a multiple of 4 because codeSize requires it

    f.seekg(0);
    f.read(buffer.data(), fileSize);

    f.close();
}

void log(const char* Message, ...)
{
    va_list	argumentPtr;
    va_start(argumentPtr, Message);
    vfprintf(stderr, Message, argumentPtr);
    va_end(argumentPtr);
#ifdef _WIN32
    char strText[1024];
    va_start(argumentPtr, Message);
    vsnprintf(strText, std::size(strText), Message, argumentPtr);
    va_end(argumentPtr);
    OutputDebugStringA(strText);
#endif
}

#define LogMsg(...) log(__VA_ARGS__)
#define LogMsgErr(...) log(__VA_ARGS__)

VkBool32 DebugUtilsMessengerCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
    VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT* callbackData,
    void* userData)
{
     if (VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT == messageSeverity) {
        LogMsgErr("Vulkan Debug Ouput: ERROR: [%s] Code %d : %s\n", callbackData->pMessageIdName, callbackData->messageIdNumber, callbackData->pMessage);
    }
    else if (VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT == messageSeverity) {
        if (messageTypes & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) {
            LogMsg("Vulkan Debug Ouput: PERFORMANCE_WARNING: [%s] Code %d : %s\n", callbackData->pMessageIdName, callbackData->messageIdNumber, callbackData->pMessage);
        }
        else {
            LogMsg("Vulkan Debug Ouput: WARNING: [%s] Code %d : %s\n", callbackData->pMessageIdName, callbackData->messageIdNumber, callbackData->pMessage);
        }
    }
    else if (VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT == messageSeverity) {
        LogMsg("Vulkan Debug Ouput: INFO: [%s] Code %d : %s\n", callbackData->pMessageIdName, callbackData->messageIdNumber, callbackData->pMessage);
    }
    else if (VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT == messageSeverity) {
        LogMsg("Vulkan Debug Ouput: VERBOSE: [%s] Code %d : %s\n", callbackData->pMessageIdName, callbackData->messageIdNumber, callbackData->pMessage);
    }
    return false;
}


int main()
{
    VkApplicationInfo appInfo{};
    appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
    appInfo.pApplicationName = "vk_bug_report_20220830";
    appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
    appInfo.pEngineName = "No Engine";
    appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
    appInfo.apiVersion = VK_API_VERSION_1_3;

    const char* instance_extensions[] = { VK_EXT_DEBUG_UTILS_EXTENSION_NAME };

    // Instance
    VkInstanceCreateInfo createInfo{};
    createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
    createInfo.pApplicationInfo = &appInfo;
    createInfo.enabledExtensionCount = 1;
    createInfo.ppEnabledExtensionNames = instance_extensions;

    const VkValidationFeatureEnableEXT enables[] = {
        VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT,
        VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
        VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT,
        // If VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT is in pEnabledValidationFeatures, 
        // VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT must not also be in pEnabledValidationFeatures
        //VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT,
        VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT
    };
    VkValidationFeaturesEXT validationFeatures = {};
    validationFeatures.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT;
    validationFeatures.enabledValidationFeatureCount = _countof(enables);
    validationFeatures.pEnabledValidationFeatures = enables;

    createInfo.pNext = &validationFeatures;

    const char* instance_layers[] = {
            "VK_LAYER_KHRONOS_validation"
    };
    createInfo.enabledLayerCount = 1;
    createInfo.ppEnabledLayerNames = instance_layers;
    VkInstance instance;
    if (vkCreateInstance(&createInfo, nullptr, &instance) != VK_SUCCESS)
    {
        throw std::runtime_error("Failed to create Vulkan instance");
    }

    // Physical device
    uint32_t deviceCount = 0;
    vkEnumeratePhysicalDevices(instance, &deviceCount, nullptr);

    if (deviceCount == 0) {
        throw std::runtime_error("Failed to find physical device");
    }

    std::vector<VkPhysicalDevice> devices(deviceCount);
    vkEnumeratePhysicalDevices(instance, &deviceCount, devices.data());

    VkPhysicalDevice physicalDevice = devices.at(0); // TAKING THE FIRST PHYSICAL DEVICE AVAILABLE

    // Logical device
    QueueFamilyIndices indices = findQueueFamilies(physicalDevice);

    std::vector<VkDeviceQueueCreateInfo> queueCreateInfos;
    std::set<uint32_t> uniqueQueueFamilies = { indices.graphicsFamily.value() };

    float queuePriority = 1.0f;
    for (uint32_t queueFamily : uniqueQueueFamilies) {
        VkDeviceQueueCreateInfo queueCreateInfo{};
        queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
        queueCreateInfo.queueFamilyIndex = queueFamily;
        queueCreateInfo.queueCount = 1;
        queueCreateInfo.pQueuePriorities = &queuePriority;
        queueCreateInfos.push_back(queueCreateInfo);
    }

    VkPhysicalDeviceFeatures features{
        .samplerAnisotropy = false,
    };

    VkPhysicalDeviceVulkan12Features vulkan12Features{
        .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
        .pNext = nullptr,
        .storageBuffer8BitAccess = true,
        .uniformAndStorageBuffer8BitAccess = true,
        .storagePushConstant8 = true,
        .descriptorBindingPartiallyBound = true,
        .descriptorBindingVariableDescriptorCount = true,
        .runtimeDescriptorArray = true,
        .samplerFilterMinmax = true,
        .separateDepthStencilLayouts = true,
    };

    std::vector<char const*> deviceExtensions{
        VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME
     };

    VkDeviceCreateInfo deviceCreateInfo{};
    deviceCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
    deviceCreateInfo.pNext = &vulkan12Features;
    deviceCreateInfo.queueCreateInfoCount = static_cast<uint32_t>(queueCreateInfos.size());
    deviceCreateInfo.pQueueCreateInfos = queueCreateInfos.data();
    deviceCreateInfo.pEnabledFeatures = &features;
    deviceCreateInfo.enabledExtensionCount = deviceExtensions.size();
    deviceCreateInfo.ppEnabledExtensionNames = deviceExtensions.data();
    deviceCreateInfo.enabledLayerCount = 0;

    VkDevice device;
    if (vkCreateDevice(physicalDevice, &deviceCreateInfo, nullptr, &device) != VK_SUCCESS)
    {
        throw std::runtime_error("Failed to create device");
    }

    PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT = reinterpret_cast<PFN_vkSetDebugUtilsObjectNameEXT>(vkGetInstanceProcAddr(instance, "vkSetDebugUtilsObjectNameEXT"));
    PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT = reinterpret_cast<PFN_vkCreateDebugUtilsMessengerEXT>(vkGetInstanceProcAddr(instance, "vkCreateDebugUtilsMessengerEXT"));
    PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT = reinterpret_cast<PFN_vkDestroyDebugUtilsMessengerEXT>(vkGetInstanceProcAddr(instance, "vkDestroyDebugUtilsMessengerEXT"));

    VkDebugUtilsMessengerEXT vkCb;

    const VkDebugUtilsMessengerCreateInfoEXT callback = {
        VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
        NULL,
        0,													// flags
        VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
        VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT |
        VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT |
        VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT,	// messageSeverity
        VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT |
        VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
        VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT,	// messageType
        DebugUtilsMessengerCallback,						// pfnUserCallback
        NULL												// pUserData
    };
    VkResult err = vkCreateDebugUtilsMessengerEXT(instance, &callback, NULL, &vkCb);



    VkQueue graphicsQueue;
    vkGetDeviceQueue(device, indices.graphicsFamily.value(), 0, &graphicsQueue);

    VkPipelineLayout pipelineLayout;

    std::vector<VkDescriptorSetLayout> descriptorSetLayouts{};
    std::vector<VkDescriptorSetLayoutBinding> bindings{};
    std::vector<VkDescriptorBindingFlags> binding_flags{};

    VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo{};
    descriptorSetLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;

    VkDescriptorSetLayoutBindingFlagsCreateInfo descriptorSetLayoutBindingFlagsCreateInfo{};
    descriptorSetLayoutBindingFlagsCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO;

    VkDescriptorSetLayout descriptorSetLayout;

    // Descriptor set layout 0
    bindings = {
        VkDescriptorSetLayoutBinding{ // u_gbuffer_normals
            .binding = 0,
            .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
        VkDescriptorSetLayoutBinding{ // u_gbuffer_texcoords
            .binding = 1,
            .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
        VkDescriptorSetLayoutBinding{ // u_gbuffer_material_indices
            .binding = 2,
            .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
        VkDescriptorSetLayoutBinding{ // u_depth_buffer
            .binding = 3,
            .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
    };

    descriptorSetLayoutCreateInfo.pNext = nullptr;
    descriptorSetLayoutCreateInfo.bindingCount = bindings.size();
    descriptorSetLayoutCreateInfo.pBindings = bindings.data();

    vkCreateDescriptorSetLayout(device, &descriptorSetLayoutCreateInfo, nullptr, &descriptorSetLayout);

    descriptorSetLayouts.push_back(descriptorSetLayout);

    // Descriptor set layout 1
    bindings = {
        VkDescriptorSetLayoutBinding{ // u_cluster_references
            .binding = 0,
            .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
        VkDescriptorSetLayoutBinding{ // AssignedLightBuffer
            .binding = 1,
            .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
    };

    descriptorSetLayoutCreateInfo.pNext = nullptr;
    descriptorSetLayoutCreateInfo.bindingCount = bindings.size();
    descriptorSetLayoutCreateInfo.pBindings = bindings.data();

    vkCreateDescriptorSetLayout(device, &descriptorSetLayoutCreateInfo, nullptr, &descriptorSetLayout);

    descriptorSetLayouts.push_back(descriptorSetLayout);

    // Descriptor set layout 2
    bindings = {
        VkDescriptorSetLayoutBinding{ // textures
            .binding = 0,
            .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
            .descriptorCount = 65535,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
    };

    binding_flags = {
        VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT,
    };

    descriptorSetLayoutBindingFlagsCreateInfo.bindingCount = (uint32_t) binding_flags.size(),
    descriptorSetLayoutBindingFlagsCreateInfo.pBindingFlags = binding_flags.data();

    descriptorSetLayoutCreateInfo.pNext = &descriptorSetLayoutBindingFlagsCreateInfo;
    descriptorSetLayoutCreateInfo.bindingCount = bindings.size();
    descriptorSetLayoutCreateInfo.pBindings = bindings.data();

    vkCreateDescriptorSetLayout(device, &descriptorSetLayoutCreateInfo, nullptr, &descriptorSetLayout);

    descriptorSetLayouts.push_back(descriptorSetLayout);

    // Descriptor set layout 3
    bindings = {
        VkDescriptorSetLayoutBinding{ // PointLightPositionBuffer
            .binding = 0,
            .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
        VkDescriptorSetLayoutBinding{ // PointLightBuffer
            .binding = 1,
            .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
        VkDescriptorSetLayoutBinding{ // DirectionalLightBuffer
            .binding = 2,
            .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
    };

    descriptorSetLayoutCreateInfo.pNext = nullptr;
    descriptorSetLayoutCreateInfo.bindingCount = bindings.size();
    descriptorSetLayoutCreateInfo.pBindings = bindings.data();

    vkCreateDescriptorSetLayout(device, &descriptorSetLayoutCreateInfo, nullptr, &descriptorSetLayout);

    descriptorSetLayouts.push_back(descriptorSetLayout);

    // Descriptor set layout 4
    bindings = {
        VkDescriptorSetLayoutBinding{ // MaterialBuffer
            .binding = 0,
            .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
    };

    descriptorSetLayoutCreateInfo.pNext = nullptr;
    descriptorSetLayoutCreateInfo.bindingCount = bindings.size();
    descriptorSetLayoutCreateInfo.pBindings = bindings.data();

    vkCreateDescriptorSetLayout(device, &descriptorSetLayoutCreateInfo, nullptr, &descriptorSetLayout);

    descriptorSetLayouts.push_back(descriptorSetLayout);

    // Descriptor set layout 5
    bindings = {
        VkDescriptorSetLayoutBinding{ // u_output
            .binding = 0,
            .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
            .descriptorCount = 1,
            .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
        },
    };

    descriptorSetLayoutCreateInfo.pNext = nullptr;
    descriptorSetLayoutCreateInfo.bindingCount = bindings.size();
    descriptorSetLayoutCreateInfo.pBindings = bindings.data();

    vkCreateDescriptorSetLayout(device, &descriptorSetLayoutCreateInfo, nullptr, &descriptorSetLayout);

    descriptorSetLayouts.push_back(descriptorSetLayout);

    // Pipeline layout
    struct
    {
        float cameraPosition[3];
        float cameraFarPlane;
        float cameraView[16];
        float cameraProjection[16];
    } pushConstants;

    VkPushConstantRange pushConstantRange{};
    pushConstantRange.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
    pushConstantRange.offset = 0;
    pushConstantRange.size = sizeof(pushConstants);

    VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo{};
    pipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
    pipelineLayoutCreateInfo.setLayoutCount = descriptorSetLayouts.size();
    pipelineLayoutCreateInfo.pSetLayouts = descriptorSetLayouts.data();
    pipelineLayoutCreateInfo.pushConstantRangeCount = 1;
    pipelineLayoutCreateInfo.pPushConstantRanges = &pushConstantRange;

    vkCreatePipelineLayout(device, &pipelineLayoutCreateInfo, nullptr, &pipelineLayout);

    // Shader module
    std::vector<char> shaderCode;
    loadBinFile("shaders/shade.comp.spv", shaderCode);

    VkShaderModuleCreateInfo shaderModuleCreateInfo{};
    shaderModuleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
    shaderModuleCreateInfo.codeSize = shaderCode.size();
    shaderModuleCreateInfo.pCode = reinterpret_cast<uint32_t const*>(shaderCode.data());

    VkShaderModule shaderModule;
    if (vkCreateShaderModule(device, &shaderModuleCreateInfo, nullptr, &shaderModule) != VK_SUCCESS)
    {
        throw std::runtime_error("Coudln't create shader module");
    }

    // Pipeline
    VkPipelineShaderStageCreateInfo computePipelineShaderStageCreateInfo{};
    computePipelineShaderStageCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
    computePipelineShaderStageCreateInfo.stage = VK_SHADER_STAGE_COMPUTE_BIT;
    computePipelineShaderStageCreateInfo.module = shaderModule;
    computePipelineShaderStageCreateInfo.pName = "main";
    computePipelineShaderStageCreateInfo.pSpecializationInfo = nullptr;

    VkComputePipelineCreateInfo computePipelineCreateInfo{};
    computePipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
    computePipelineCreateInfo.stage = computePipelineShaderStageCreateInfo;
    computePipelineCreateInfo.layout = pipelineLayout;

    VkPipeline pipeline = VK_NULL_HANDLE;
    if (vkCreateComputePipelines(device, VK_NULL_HANDLE, 1, &computePipelineCreateInfo, nullptr, &pipeline) != VK_SUCCESS)
    {
        throw std::runtime_error("Failed to create compute pipeline");
    }
    
    // Bye bye
    vkDestroyShaderModule(device, shaderModule, nullptr);
    vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
    vkDestroyPipeline(device, pipeline, nullptr);
    vkDestroyDevice(device, nullptr);
    vkDestroyInstance(instance, nullptr);

    return 0;
}

Yes, I’ve packed the first repro version fast, I’ve built it using the Debug configuration and I’ve packed the whole binary folder. For the second one I’ve used the Release configuration so those files aren’t there anymore.

Surely people are much more familiar with a Visual Studio solutions, but using CMake I could also target people on a Linux environment so I thought it’d have been better.

I’ve used Validation layers and I had no errors!

Intel UHD 630 gives errors because of its limited capabilities.
NVIDIA 1030 gives errors on exit (at vkDestroyDevice), so no way I could see those because it has crashed before reaching them.

However, excluding Intel UHD 630 which basically gives errors at every line, I’m happy to see it works on NVIDIA 1030. So it must be an issue with my specific GPU and driver version. Hope this tests will be helpful for NVIDIA engineers

Hi,

I’ve still not solved the issue, do you have any news?