aboutsummaryrefslogtreecommitdiff
path: root/cube/cube.c
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-10-05 11:53:39 -0300
committerjeremyk-lunarg <jeremyk@lunarg.com>2019-10-23 08:57:35 -0600
commit7da3ea7cfa1dbedd92f7e1b2e3a72503ed9ced9a (patch)
tree8b637a99d73b8e66844930d2aa5087cf4c40eee0 /cube/cube.c
parent119e7c3bbae122f6cc5d778d068fb91e0e85d6a9 (diff)
downloadusermoji-7da3ea7cfa1dbedd92f7e1b2e3a72503ed9ced9a.tar.xz
cube: Try to bind to wl_compositor v4
VK_KHR_incremental_present requires the client to bind to wl_compositor v4. This is because internally some Vulkan Wayland drivers convert VkPresentRegionKHR to wl_surface.damage_buffer()[1], which is a v4-only request. If the Wayland compositor advertises wl_compositor v4, we can bind to it and make incremental present actually work. [1] https://gitlab.freedesktop.org/mesa/mesa/blob/master/src/vulkan/wsi/wsi_common_wayland.c#L862
Diffstat (limited to 'cube/cube.c')
-rw-r--r--cube/cube.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cube/cube.c b/cube/cube.c
index 7398a2c1..09a243a6 100644
--- a/cube/cube.c
+++ b/cube/cube.c
@@ -3636,12 +3636,16 @@ static const struct wl_seat_listener seat_listener = {
seat_handle_capabilities,
};
-static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface,
- uint32_t version UNUSED) {
+static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) {
struct demo *demo = data;
// pickup wayland objects when they appear
if (strcmp(interface, "wl_compositor") == 0) {
- demo->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1);
+ uint32_t minVersion = version < 4 ? version : 4;
+ demo->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, minVersion);
+ if (demo->VK_KHR_incremental_present_enabled && minVersion < 4) {
+ fprintf(stderr, "Wayland compositor doesn't support VK_KHR_incremental_present, disabling.\n");
+ demo->VK_KHR_incremental_present_enabled = false;
+ }
} else if (strcmp(interface, "wl_shell") == 0) {
demo->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
} else if (strcmp(interface, "wl_seat") == 0) {