1 #ifndef _QEMU_YAGL_GLES_OGL_MACROS_H
2 #define _QEMU_YAGL_GLES_OGL_MACROS_H
7 * GLES OpenGL prototyping macros.
11 #define YAGL_GLES_OGL_PROC0(func) \
12 void (APIENTRY *func)(void);
14 #define YAGL_GLES_OGL_PROC_RET0(ret_type, func) \
15 ret_type (APIENTRY *func)(void);
17 #define YAGL_GLES_OGL_PROC1(func, arg0_type, arg0) \
18 void (APIENTRY *func)(arg0_type arg0);
20 #define YAGL_GLES_OGL_PROC_RET1(ret_type, func, arg0_type, arg0) \
21 ret_type (APIENTRY *func)(arg0_type arg0);
23 #define YAGL_GLES_OGL_PROC2(func, arg0_type, arg1_type, arg0, arg1) \
24 void (APIENTRY *func)(arg0_type arg0, arg1_type arg1);
26 #define YAGL_GLES_OGL_PROC_RET2(ret_type, func, arg0_type, arg1_type, arg0, arg1) \
27 ret_type (APIENTRY *func)(arg0_type arg0, arg1_type arg1);
29 #define YAGL_GLES_OGL_PROC3(func, arg0_type, arg1_type, arg2_type, arg0, arg1, arg2) \
30 void (APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2);
32 #define YAGL_GLES_OGL_PROC4(func, arg0_type, arg1_type, arg2_type, arg3_type, arg0, arg1, arg2, arg3) \
33 void (APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3);
35 #define YAGL_GLES_OGL_PROC5(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg0, arg1, arg2, arg3, arg4) \
36 void (APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4);
38 #define YAGL_GLES_OGL_PROC6(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg0, arg1, arg2, arg3, arg4, arg5) \
39 void (APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, \
40 arg4_type arg4, arg5_type arg5);
42 #define YAGL_GLES_OGL_PROC7(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \
43 void (APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, \
44 arg4_type arg4, arg5_type arg5, arg6_type arg6);
46 #define YAGL_GLES_OGL_PROC8(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
47 void (APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, \
48 arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg7);
50 #define YAGL_GLES_OGL_PROC9(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
51 void (APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, \
52 arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg7, \
60 * GLES OpenGL basic implementation macros.
64 #define YAGL_GLES_OGL_PROC_IMPL0(obj_type, ps_type, driver_type, func) \
65 static void driver_type##_##func(struct obj_type *driver_ps) \
67 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
71 #define YAGL_GLES_OGL_PROC_IMPL_RET0(obj_type, ps_type, driver_type, ret_type, func) \
72 static ret_type driver_type##_##func(struct obj_type *driver_ps) \
74 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
75 return d->gl##func(); \
78 #define YAGL_GLES_OGL_PROC_IMPL1(obj_type, ps_type, driver_type, func, arg0_type, arg0) \
79 static void driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0) \
81 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
85 #define YAGL_GLES_OGL_PROC_IMPL_RET1(obj_type, ps_type, driver_type, ret_type, func, arg0_type, arg0) \
86 static ret_type driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0) \
88 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
89 return d->gl##func(arg0); \
92 #define YAGL_GLES_OGL_PROC_IMPL2(obj_type, ps_type, driver_type, func, arg0_type, arg1_type, arg0, arg1) \
93 static void driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0, arg1_type arg1) \
95 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
96 d->gl##func(arg0, arg1); \
99 #define YAGL_GLES_OGL_PROC_IMPL_RET2(obj_type, ps_type, driver_type, ret_type, func, arg0_type, arg1_type, arg0, arg1) \
100 static ret_type driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0, arg1_type arg1) \
102 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
103 return d->gl##func(arg0, arg1); \
106 #define YAGL_GLES_OGL_PROC_IMPL3(obj_type, ps_type, driver_type, func, arg0_type, arg1_type, arg2_type, arg0, arg1, arg2) \
107 static void driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0, arg1_type arg1, arg2_type arg2) \
109 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
110 d->gl##func(arg0, arg1, arg2); \
113 #define YAGL_GLES_OGL_PROC_IMPL4(obj_type, ps_type, driver_type, func, arg0_type, arg1_type, arg2_type, arg3_type, arg0, arg1, arg2, arg3) \
114 static void driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3) \
116 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
117 d->gl##func(arg0, arg1, arg2, arg3); \
120 #define YAGL_GLES_OGL_PROC_IMPL5(obj_type, ps_type, driver_type, func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg0, arg1, arg2, arg3, arg4) \
121 static void driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4) \
123 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
124 d->gl##func(arg0, arg1, arg2, arg3, arg4); \
127 #define YAGL_GLES_OGL_PROC_IMPL6(obj_type, ps_type, driver_type, func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg0, arg1, arg2, arg3, arg4, arg5) \
128 static void driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, arg5_type arg5) \
130 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
131 d->gl##func(arg0, arg1, arg2, arg3, arg4, arg5); \
134 #define YAGL_GLES_OGL_PROC_IMPL7(obj_type, ps_type, driver_type, func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \
135 static void driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, arg5_type arg5, arg6_type arg6) \
137 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
138 d->gl##func(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
141 #define YAGL_GLES_OGL_PROC_IMPL8(obj_type, ps_type, driver_type, func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
142 static void driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg7) \
144 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
145 d->gl##func(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
148 #define YAGL_GLES_OGL_PROC_IMPL9(obj_type, ps_type, driver_type, func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
149 static void driver_type##_##func(struct obj_type *driver_ps, arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8) \
151 struct driver_type *d = (struct driver_type*)(((struct ps_type*)driver_ps)->driver); \
152 d->gl##func(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
160 * GLES OpenGL function loading/assigning macros.
164 #define YAGL_GLES_OGL_GET_PROC(driver, func) \
166 *(void**)(&driver->func) = yagl_dyn_lib_procaddr_get(dyn_lib, #func); \
167 if (!driver->func) { \
168 YAGL_LOG_ERROR("Unable to get symbol: %s", \
169 yagl_dyn_lib_get_error(dyn_lib)); \
174 #define YAGL_GLES_OGL_ASSIGN_PROC(driver_type, driver_ps, func) \
175 driver_ps->base.func = &driver_type##_##func