1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:08:11 +00:00
serenity/Userland/Libraries/LibAccelGfx/Context.h
Andrew Kaster 2cc6abf309 LibAccelGfx: Don't predicate using EGL/egl.h on Linux
Any platform that has OpenGL and EGL should be able to use the class.
2023-11-01 14:30:30 -06:00

46 lines
976 B
C++

/*
* Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Assertions.h>
#include <AK/OwnPtr.h>
// Make sure egl.h doesn't give us definitions from X11 headers
#define EGL_NO_X11
#include <EGL/egl.h>
#undef EGL_NO_X11
namespace AccelGfx {
class Context {
public:
static Context& the();
struct Surface {
EGLSurface egl_surface { 0 };
};
Surface create_surface(int width, int height);
void destroy_surface(Surface surface);
void set_active_surface(Surface surface);
static OwnPtr<Context> create();
Context(EGLDisplay egl_display, EGLContext egl_context, EGLConfig egl_config)
: m_egl_display(egl_display)
, m_egl_context(egl_context)
, m_egl_config(egl_config)
{
}
private:
EGLDisplay m_egl_display { nullptr };
EGLContext m_egl_context { nullptr };
EGLConfig m_egl_config { nullptr };
};
}