summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/egl_helpers.h
blob: 32ec5d12e42e7f1b92bdf6d9bb7d70262b4a6467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef MP_GL_EGL_HELPERS_H
#define MP_GL_EGL_HELPERS_H

#include <stdbool.h>

#include <EGL/egl.h>
#include <EGL/eglext.h>

#include "video/out/gpu/context.h"

struct mp_log;

bool mpegl_create_context(struct ra_ctx *ctx, EGLDisplay display,
                          EGLContext *out_context, EGLConfig *out_config);

struct mpegl_cb {
    // if set, pick the desired config from the given list and return its index
    // defaults to 0 (they are sorted by eglChooseConfig). return a negative
    // number to indicate an error condition or that no suitable configs could
    // be found.
    int (*refine_config)(void *user_data, EGLConfig *configs, int num_configs);
    void *user_data;
};

bool mpegl_create_context_cb(struct ra_ctx *ctx, EGLDisplay display,
                             struct mpegl_cb cb, EGLContext *out_context,
                             EGLConfig *out_config);

struct GL;
void mpegl_load_functions(struct GL *gl, struct mp_log *log);

EGLDisplay mpegl_get_display(EGLenum platform, const char *platform_ext_name,
                             void *native_display);

EGLSurface mpegl_create_window_surface(EGLDisplay dpy, EGLConfig config,
                                       void *native_window);

#endif