1 // 2 // Copyright 2021-2022 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // WindowSurfaceVkWayland.h: 7 // Defines the class interface for WindowSurfaceVkWayland, implementing WindowSurfaceVk. 8 // 9 10 #ifndef LIBANGLE_RENDERER_VULKAN_WAYLAND_WINDOWSURFACEVKWAYLAND_H_ 11 #define LIBANGLE_RENDERER_VULKAN_WAYLAND_WINDOWSURFACEVKWAYLAND_H_ 12 13 #include "libANGLE/renderer/vulkan/SurfaceVk.h" 14 15 struct wl_display; 16 struct wl_egl_window; 17 18 namespace rx 19 { 20 21 class WindowSurfaceVkWayland : public WindowSurfaceVk 22 { 23 public: 24 // Requests of new sizes from client go through this callback, but actual resize will happen 25 // before the next operation which would provoke a backbuffer to be pulled. 26 static void ResizeCallback(wl_egl_window *window, void *payload); 27 28 WindowSurfaceVkWayland(const egl::SurfaceState &surfaceState, 29 EGLNativeWindowType window, 30 wl_display *display); 31 32 // On Wayland, currentExtent is undefined (0xFFFFFFFF, 0xFFFFFFFF). 33 // Whatever the application sets a swapchain's imageExtent to will be the size of the window, 34 // after the first image is presented 35 egl::Error getUserWidth(const egl::Display *display, EGLint *value) const override; 36 egl::Error getUserHeight(const egl::Display *display, EGLint *value) const override; 37 38 angle::Result getAttachmentRenderTarget(const gl::Context *context, 39 GLenum binding, 40 const gl::ImageIndex &imageIndex, 41 GLsizei samples, 42 FramebufferAttachmentRenderTarget **rtOut) override; 43 44 private: 45 angle::Result createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) override; 46 angle::Result getCurrentWindowSize(vk::Context *context, gl::Extents *extentsOut) override; 47 48 wl_display *mWaylandDisplay; 49 gl::Extents mExtents; 50 bool mResized; 51 }; 52 53 } // namespace rx 54 55 #endif // LIBANGLE_RENDERER_VULKAN_WAYLAND_WINDOWSURFACEVKWAYLAND_H_ 56