Update version for v5.1.0 release
[qemu.git] / ui / egl-context.c
1 #include "qemu/osdep.h"
2 #include "ui/egl-context.h"
3
4 QEMUGLContext qemu_egl_create_context(DisplayChangeListener *dcl,
5 QEMUGLParams *params)
6 {
7 EGLContext ctx;
8 EGLint ctx_att_core[] = {
9 EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
10 EGL_CONTEXT_CLIENT_VERSION, params->major_ver,
11 EGL_CONTEXT_MINOR_VERSION_KHR, params->minor_ver,
12 EGL_NONE
13 };
14 EGLint ctx_att_gles[] = {
15 EGL_CONTEXT_CLIENT_VERSION, params->major_ver,
16 EGL_CONTEXT_MINOR_VERSION_KHR, params->minor_ver,
17 EGL_NONE
18 };
19 bool gles = (qemu_egl_mode == DISPLAYGL_MODE_ES);
20
21 ctx = eglCreateContext(qemu_egl_display, qemu_egl_config,
22 eglGetCurrentContext(),
23 gles ? ctx_att_gles : ctx_att_core);
24 return ctx;
25 }
26
27 void qemu_egl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx)
28 {
29 eglDestroyContext(qemu_egl_display, ctx);
30 }
31
32 int qemu_egl_make_context_current(DisplayChangeListener *dcl,
33 QEMUGLContext ctx)
34 {
35 return eglMakeCurrent(qemu_egl_display,
36 EGL_NO_SURFACE, EGL_NO_SURFACE, ctx);
37 }
38
39 QEMUGLContext qemu_egl_get_current_context(DisplayChangeListener *dcl)
40 {
41 return eglGetCurrentContext();
42 }