-->

Vulkan on X11: vkGetPhysicalDeviceSurfaceCapabilit

2019-08-10 20:42发布

问题:

I am trying to get Vulkan running under X11.

I have (apparently) successfully created an instance, device and surface, and several calls relating to the surface also succeed, and even return reasonable values (for example vkGetPhysicalDeviceSurfaceFormatsKHR returns two formats). However, when I call vkGetPhysicalDeviceSurfaceCapabilitiesKHR, I get the following:

X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  14 (X_GetGeometry)
  Resource id in failed request:  0x5800009
  Serial number of failed request:  42
  Current serial number in output stream:  42

The X11 Window is 0x5800009, as referenced in the error. I am using Vulkan SDK 1.0.5, and Nvidia 364.12 drivers (if that is relevant).

回答1:

On the hunch that Vulkan was querying something about the Window that had not yet been created, I put a XSync(<display>, false) call before this one, and that seems to have solved the issue.

I am not sure whether this is required for proper operation (I am not an X11 expert), or whether this is an issue with Vulkan itself. If somebody has a better explanation, I would love to hear it.



回答2:

I had the same error on Linux with XCB and I resolved it (with the help of MuertoExcobito's answer) by calling xcb_flush after the window creation.



标签: c++ x11 vulkan