summaryrefslogtreecommitdiff
path: root/progs/egl/segl/segl.h
blob: 20faf6ef027bb5210eb878638de993bb26402041 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef _SEGL_H_
#define _SEGL_H_

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

struct segl_winsys {
   EGLNativeDisplayType dpy;

   EGLNativeWindowType (*create_window)(struct segl_winsys *winsys,
                                        const char *name,
                                        EGLint width, EGLint height,
                                        EGLint visual);
   void (*destroy_window)(struct segl_winsys *winsys, EGLNativeWindowType win);

   EGLNativePixmapType (*create_pixmap)(struct segl_winsys *winsys,
                                        EGLint width, EGLint height,
                                        EGLint depth);
   void (*destroy_pixmap)(struct segl_winsys *winsys, EGLNativePixmapType pix);

   /* get current time in seconds */
   double (*now)(struct segl_winsys *winsys);
   /* log a message.  OPTIONAL */
   void (*vlog)(struct segl_winsys *winsys, const char *format, va_list ap);
};

struct segl {
   EGLBoolean verbose;

   struct segl_winsys *winsys;

   EGLint major, minor;
   EGLDisplay dpy;
   EGLConfig conf;
};

struct segl_winsys *
segl_get_winsys(EGLNativeDisplayType dpy);

struct segl *
segl_new(struct segl_winsys *winsys, const EGLint *attribs);

void
segl_destroy(struct segl *segl);

EGLBoolean
segl_create_window(struct segl *segl, const char *name,
                   EGLint width, EGLint height, const EGLint *attribs,
                   EGLNativeWindowType *win_ret, EGLSurface *surf_ret);

EGLBoolean
segl_create_pixmap(struct segl *segl,
                   EGLint width, EGLint height, const EGLint *attribs,
                   EGLNativePixmapType *pix_ret, EGLSurface *surf_ret);

void
segl_benchmark(struct segl *segl, double seconds,
               void (*draw_frame)(void *), void *draw_data);

#endif /* _SEGL_H_ */