Mac, Vulkan, Blank Window with Discrete GPU

Hello,

I have been going through the Vulkan Tutorial at: https://vulkan-tutorial.com/
and finally got to the section where you actually draw a triangle. Everything
works when VkPhysicalDevice is set to the integrated GPU

If I add code to select the discrete GPU I get a black screen. No errors or messages
from the validation layers.

I tried enabling VK_EXT_metal_surface to the vkInstance creation info but no change.
I’m not sure if the issue is with GLFW or not, but I thought someone here might have some insight.

Here is my setup:
Late 2018 MacBook Pro with
Integrated: Intel® UHD Graphics 630
Discrete: AMD Radeon Pro 560X
GLFW 3.3.2

Thanks,
Wayne Anderson

Hello, welcome to the forum!

I was unable to reproduce this with GLFW 3.3.2 on a 2013 MBP with an Intel and an Nvidia GPU using the triangle-vulkan test. It would render on either device. Tried both the 1.1.130 and 1.2.131 Vulkan SDKs.

Does GLFW report any errors?

Thanks, elmindreda for checking this on your machine. Your result motivated me to double check my code and I found an issue with my GPU scoring code that causes the built-in GPU to score higher (More on that below), So it’s actually the integrated GPU that’s not rendering. Sorry for the confusion. I was able to confirm that my code runs just fine on my late 2012 Mac mini with intel HD 4000 graphics. This all suggests that the problem may be specific to the integrated UHD Graphics 630. No errors are being reported either by GLFW or any Vulkan validation layers using either GPU.

On that GPU scoring code: I use the following code to get the GPU VRAM…

size_t vram;
auto heapsPointer = memoryProps.memoryHeaps;
auto heaps = std::vector(heapsPointer, heapsPointer + memoryProps.memoryHeapCount);
for (const auto& heap : heaps)
{
if (heap.flags & VkMemoryHeapFlagBits::VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
{
// Device local heap, should be size of total GPU VRAM.
// heap.size will be the size of VRAM in bytes. (bigger is better)
vram += heap.size;
}
}

The discrete GPU reports 4 GB of vram as expected. The integrated GPU reports 32 GB (it’s actually 1536 MB)

OOPS, forgot a couple of lines on that sample code. Above size_t vram add
VkPhysicalDeviceMemoryProperties memoryProps;
vkGetPhysicalDeviceMemoryProperties(device, &memoryProps);

One more quick follow-up:

I built the ‘cube’ sample from https://github.com/LunarG/VulkanTools. This code uses a native Mac window and calls vkCreateMetalSurfaceEXT directly and it works with both GPUs on my machine.
This suggests that it is an issue with GLFW and the UHD Graphics 630 on MacBook Pro’s. Since the preferred discrete GPU is working, I don’t consider this to be a high priority issue but I’ll submit a bug report on Git Hub anyway.

Just adding a link to the Github issue for this problem