opengl_context_egl_wayland.h (1278B)
1 // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com> 2 // SPDX-License-Identifier: (GPL-3.0 OR PolyForm-Strict-1.0.0) 3 4 #pragma once 5 6 #include "opengl_context_egl.h" 7 8 #include <wayland-egl.h> 9 10 class OpenGLContextEGLWayland final : public OpenGLContextEGL 11 { 12 public: 13 OpenGLContextEGLWayland(const WindowInfo& wi); 14 ~OpenGLContextEGLWayland() override; 15 16 static std::unique_ptr<OpenGLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try, 17 Error* error); 18 19 std::unique_ptr<OpenGLContext> CreateSharedContext(const WindowInfo& wi, Error* error) override; 20 void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override; 21 22 protected: 23 EGLDisplay GetPlatformDisplay(Error* error) override; 24 EGLSurface CreatePlatformSurface(EGLConfig config, void* win, Error* error) override; 25 26 private: 27 bool LoadModule(Error* error); 28 29 wl_egl_window* m_wl_window = nullptr; 30 31 void* m_wl_module = nullptr; 32 wl_egl_window* (*m_wl_egl_window_create)(struct wl_surface* surface, int width, int height); 33 void (*m_wl_egl_window_destroy)(struct wl_egl_window* egl_window); 34 void (*m_wl_egl_window_resize)(struct wl_egl_window* egl_window, int width, int height, int dx, int dy); 35 };