1 #ifndef COREGL_INTERNAL_H
2 #define COREGL_INTERNAL_H
8 #include "modules/coregl_module.h"
10 #define unlikely(x) __builtin_expect(x, 0)
12 // Symbol definition for real
13 #define _COREGL_SYMBOL(IS_EXTENSION, RET_TYPE, FUNC_NAME, PARAM_LIST) extern RET_TYPE (*_sym_##FUNC_NAME) PARAM_LIST;
14 # include "headers/sym.h"
20 fprintf(stderr, __VA_ARGS__)
23 fprintf(stderr, __VA_ARGS__)
29 fprintf(stderr, __VA_ARGS__)
33 fprintf(trace_fp, __VA_ARGS__)
34 # define TRACE_END() \
36 #define _COREGL_TRACE_OUTPUT_INTERVAL_SEC 5
41 if (!(expr)) { fprintf(stderr, "\E[0;31;1m%s(%d) error. '"#expr"'\E[0m\n", __func__, __LINE__); }
47 typedef GLvoid * GLvoidptr;
48 typedef GLuint GLuintmask;
50 #define _COREGL_INT_INIT_VALUE -3
53 # define GLERR(fn, fl, ln, op)
55 # define GLERR(fn, fl, ln, op)
58 typedef struct _Trace_Data Trace_Data;
60 #define COREGL_OVERRIDE_API(mangle, func, prefix) \
61 mangle##func = prefix##func
63 typedef EGLSurface GLSurface;
64 typedef EGLDisplay GLDisplay;
65 typedef EGLContext GLContext;
67 typedef struct _GLThreadState
70 void *module_data[COREGL_MAX_MODULES];
73 extern void *glue_lib_handle;
74 extern void *egl_lib_handle;
76 #include "coregl_thread_pthread.h"
78 typedef struct _General_Trace_List
81 struct _General_Trace_List *next;
84 extern General_Trace_List *thread_trace_list;
85 extern Mutex general_trace_lists_access_mutex;
87 extern FILE *trace_fp;
89 extern int trace_api_flag;
90 extern int trace_api_all_flag;
91 extern int trace_ctx_flag;
92 extern int trace_ctx_force_flag;
93 extern int trace_state_flag;
95 #define USE_TRACEPATH (trace_api_flag == 1 || trace_ctx_flag == 1 || trace_state_flag == 1)
97 // Environment functions
98 extern const char *get_env_setting(const char *name);
100 // Main utility functions
101 extern int init_new_thread_state();
104 extern int mutex_lock(Mutex *mt);
105 extern int mutex_unlock(Mutex *mt);
106 extern int get_current_thread();
107 extern int set_current_thread_state(GLThreadState *tstate);
108 extern GLThreadState *get_current_thread_state();
111 // Override functions
112 extern void init_export();
113 extern void deinit_export();
116 extern void init_modules();
117 extern void deinit_modules();
118 extern void init_modules_tstate(GLThreadState *tstate);
119 extern void deinit_modules_tstate(GLThreadState *tstate);
122 // Debug & Trace functions
123 extern int add_to_general_trace_list(General_Trace_List **gtl, void *value);
124 extern int remove_from_general_trace_list(General_Trace_List **gtl, void *value);
126 #endif // COREGL_INTERNAL_H