Vulkan and MoltenVK problem with retina/HiDPI display on macOS

Started by 4nt01n3, April 25, 2018, 08:30:57

Previous topic - Next topic

4nt01n3

Hi !

I am not sure this is a LWJGL related problem or if it comes from GLFW... or my code ;)

When using Vulkan with the MoltenVK port on macOS the physical device capabilities (vkGetPhysicalDeviceSurfaceCapabilitiesKHR()) always report a max extent of half the size in real pixels making graphics look fuzzy. This does not happen on Windows 10 (I cannot test under Linux, my graphic card being too old). Trying to double the extent will simply create a framebuffer that cannot fit the window (we see 1/4 of it).

I tried passing a window hint GLFW_COCOA_RETINA_FRAMEBUFFER, but without effect, I imagine it is related to OpenGL ? However it is not needed on OpenGL, by default the framebuffer is always using real device pixels.

Did I missed a configuration option ?

Thanks


spasi

Are you using the latest 3.1.7 snapshot? Afaict it was a GLFW bug that has been fixed.

4nt01n3

No effectively ! Thanks !

Indeed I used a version downloaded on the 2018-04-07.

However the version 2018-04-25 I downloaded today segfaults when loading the Vulkan library (drop-in replacement of all the jars).

But good to know this is fixed, I can wait a stable version :)

Thanks

PS. The error when using the most recent nightly :

Stack: [0x00007ffee30a0000,0x00007ffee38a0000],  sp=0x00007ffee3899010,  free space=8164k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libMoltenVK.dylib+0xc666]  vkGetInstanceProcAddr+0x46
j  org.lwjgl.system.JNI.callPPP(JJJ)J+0
j  org.lwjgl.vulkan.VK$GlobalCommands.getFunctionAddress(Ljava/lang/String;Z)J+20
j  org.lwjgl.vulkan.VK$GlobalCommands.<init>(Lorg/lwjgl/system/FunctionProvider;)V+70
j  org.lwjgl.vulkan.VK.create(Lorg/lwjgl/system/FunctionProvider;)V+25
j  org.lwjgl.vulkan.VK.create()V+135
j  org.lwjgl.vulkan.VK.<clinit>()V+19

spasi

Quote from: 4nt01n3 on April 25, 2018, 12:20:23However the version 2018-04-25 I downloaded today segfaults when loading the Vulkan library (drop-in replacement of all the jars).

Hmm, I cannot reproduce this (using the HelloVulkan sample). Could you post an MCVE that crashes with the latest snapshot?

4nt01n3

Quote from: spasi on April 25, 2018, 20:44:14
Hmm, I cannot reproduce this (using the HelloVulkan sample). Could you post an MCVE that crashes with the latest snapshot?

Ok I found the problem : I had a DYLD_LIBRARY_PATH environment variable that was still containing my local MoltenVK library. So it was probably not using the library in lwjgl-vulkan-natives-macos.jar. Silly me, and sorry for the inconvenience.

A remnant of the times when I did not used the vulkan-natives.

It not only run well, but indeed the framebuffer is now at the correct real pixel dimensions ! :)

Thanks a lot !