vkGetPhysicalDeviceSurfaceSupportKHR sometimes returns presentSupport as false


This topic contains 4 replies, has 2 voices, and was last updated by  kruseborn 8 months, 4 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1208

    kruseborn
    Participant
    VkBool32 presentSupport;
    vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, i, windowSurface, &presentSupport);

    Sometimes vkGetPhysicalDeviceSurfaceSupportKHR returns presentSupport as true and sometimes it returns it as false. However, even if the return value is false, everything gets render correctly and shows up on screen.

    #1209

    Bill Hollings
    Keymaster

    @kruseborn

    It’s hard to see how that is happening. The logic is pretty simple for returning that value.

    Are you encountering this on iOS or OS X?

    Is there any pattern to when it returns one value or the other?

    Are you able to provide us with instructions or sample code in order to reproduce the issue?

    …Bill

    #1212

    kruseborn
    Participant

    I am encountering this on OS X, I usually solve it by restarting the computer. However, the application still works even though presentSupport does not return a positive value.

    static void findQueueFamilies() {
    	// Check queue families
    	uint32_t queueFamilyCount = 0;
    	vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, nullptr);
    	assert(queueFamilyCount != 0);
    
    	std::vector<VkQueueFamilyProperties> queueFamilies(queueFamilyCount);
    	vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, queueFamilies.data());
    
    	bool foundGraphicsQueueFamily = false;
    	bool foundPresentQueueFamily = false;
    
    	for (uint32_t i = 0; i < queueFamilyCount; i++) {
    		VkBool32 presentSupport;
            
    		vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, i, windowSurface, &presentSupport);
    		if (queueFamilies[i].queueCount > 0 && queueFamilies[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
    			vkContext.graphicsQueueFamilyIndex = i;
    			foundGraphicsQueueFamily = true;
    
    			if (presentSupport) {
    				vkContext.presentQueueFamilyIndex = i;
    				foundPresentQueueFamily = true;
    				break;
    			}
    		}
    		if (!foundPresentQueueFamily && presentSupport) {
    			vkContext.presentQueueFamilyIndex = i;
    			foundPresentQueueFamily = true;
    		}
    	}
        assert(foundGraphicsQueueFamily && foundPresentQueueFamily);
    } 
    #1216

    Bill Hollings
    Keymaster

    @kruseborn

    I have not been able to replicate this on a MacBook 2014 running Sierra 10.12.4.

    The presentSupport always comes back as true for either the discrete or integrated GPU.

    Normally, the only reason why that value would come back as false should be if the GPU reports that it is running headless (with no display attached)…which should never happen on a MacBook.

    The fact that restarting your computer resets this issue indicates that it might be an issue within Apple’s Metal drivers on your particular platform. What Mac and OS X version are you using?

    …Bill

    #1230

    kruseborn
    Participant

    I am using a Mac Pro but the screens are connected to a kvm switch because I am sharing the screens with a windows computer. I have now tested running it without the kvm switch and I have not seen the error anymore, so that is probably it, thanks:)

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.