Results 1 to 2 of 2

Thread: vkCreateSwapchainKHR Fail

  1. #1
    Newbie
    Join Date
    Sep 2017
    Posts
    2

    vkCreateSwapchainKHR Fail

    Even though validation layers and debug callback extensions enabled and working (they respond to wrong structs etc.), I'm still getting a "VK_ERROR_VALIDATION_FAILED_EXT" result from vkCreateSwapchainKHR(), and there's no validation layer error to pinpoint the mistake...
    Swap chain creation (using GTX 970 ) :

    Code :
    VkBool32 isSupported = false;
    vkGetPhysicalDeviceSurfaceSupportKHR( physicalDevices[0], 0, surface, &isSupported);
     
    if (!isSupported) {
        std::cout << "*ERROR* This device doesn't support surfaces" << std::endl;
    }
     
    VkSurfaceCapabilitiesKHR surfCaps;
    vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevices[0], surface, &surfCaps);
     
    std::vector<VkSurfaceFormatKHR> deviceFormats;
    uint32_t formatCount;
    vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevices[0], surface, &formatCount, nullptr);
    deviceFormats.resize(formatCount);
    vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevices[0], surface, &formatCount, deviceFormats.data());
     
     
    swapChainInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
    swapChainInfo.pNext = nullptr;
    swapChainInfo.flags = 0;
    swapChainInfo.surface = surface;
     
    swapChainInfo.minImageCount = surfCaps.minImageCount; 
    swapChainInfo.imageFormat = VK_FORMAT_B8G8R8A8_UNORM;
    swapChainInfo.imageColorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
    swapChainInfo.imageExtent = surfCaps.currentExtent;
    swapChainInfo.imageArrayLayers = 1;
    swapChainInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
    swapChainInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
     
    swapChainInfo.queueFamilyIndexCount = 0;
    swapChainInfo.pQueueFamilyIndices = VK_NULL_HANDLE;
    swapChainInfo.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; 
    swapChainInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
    swapChainInfo.presentMode = VK_PRESENT_MODE_FIFO_KHR;
    swapChainInfo.clipped = VK_TRUE; // TODO : TEST clipping against another window
    swapChainInfo.oldSwapchain = VK_NULL_HANDLE;
     
    result = vkCreateSwapchainKHR( device, &swapChainInfo, nullptr, &swapChain );
    if (result) {
        std::cout << "*ERROR* Swapchain Creation Failed :" << result << std::endl;
    }

  2. #2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean