1 #ifndef __EVAS_ENGINE_H__
2 #define __EVAS_ENGINE_H__
3
4 #ifdef HAVE_CONFIG_H
5 # include <config.h>
6 #endif
7
8 #include <OpenGL/gl.h>
9
10 #include "../gl_common/evas_gl_common.h"
11 #include "Evas_Engine_GL_Cocoa.h"
12 #include "../gl_generic/Evas_Engine_GL_Generic.h"
13
14
15 extern int _evas_engine_gl_cocoa_log_dom;
16
17 #ifdef ERR
18 # undef ERR
19 #endif
20 #define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_gl_cocoa_log_dom, __VA_ARGS__)
21
22 #ifdef DBG
23 # undef DBG
24 #endif
25 #define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_gl_cocoa_log_dom, __VA_ARGS__)
26
27 #ifdef INF
28 # undef INF
29 #endif
30 #define INF(...) EINA_LOG_DOM_INFO(_evas_engine_gl_cocoa_log_dom, __VA_ARGS__)
31
32 #ifdef WRN
33 # undef WRN
34 #endif
35 #define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_gl_cocoa_log_dom, __VA_ARGS__)
36
37 #ifdef CRI
38 # undef CRI
39 #endif
40 #define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_gl_cocoa_log_dom, __VA_ARGS__)
41
42 typedef struct _Render_Engine Render_Engine;
43
44 struct _Render_Engine
45 {
46 Render_Output_GL_Generic generic;
47
48 Outbuf *win;
49 };
50
51 struct _Context_3D
52 {
53 Outbuf *ob;
54 void *ns_gl_context;
55 };
56
57 struct _Outbuf
58 {
59 Evas_Engine_Info_GL_Cocoa *info;
60 Evas_Engine_GL_Context *gl_context;
61
62 void *ns_gl_view; // NSOpenGLView*
63 void *ns_window; // NSWindow*
64
65 int w;
66 int h;
67 int rot;
68 Render_Output_Swap_Mode swap_mode;
69
70 Eina_Bool drew;
71 };
72
73
74 static inline Outbuf *
eng_get_ob(const Render_Engine * re)75 eng_get_ob(const Render_Engine *re)
76 {
77 return re->generic.software.ob;
78 }
79
80 extern Evas_GL_Common_Context_New glsym_evas_gl_common_context_new;
81 extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_free;
82 extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_flush;
83 extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_use;
84 extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_done;
85 extern Evas_GL_Common_Context_Resize_Call glsym_evas_gl_common_context_resize;
86 extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_newframe;
87 extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock;
88 extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock;
89 extern Evas_Gl_Symbols glsym_evas_gl_symbols;
90
91 Outbuf *evas_outbuf_new(Evas_Engine_Info_GL_Cocoa *info, int w, int h);
92 void evas_outbuf_free(Outbuf *ob);
93 void evas_outbuf_use(Outbuf *ob);
94 int evas_outbuf_rot_get(Outbuf *ob);
95 Render_Output_Swap_Mode evas_outbuf_buffer_state_get(Outbuf *ob);
96 void evas_outbuf_gl_context_use(Context_3D *ctx);
97 Eina_Bool evas_outbuf_update_region_first_rect(Outbuf *ob);
98 void *evas_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
99 void evas_outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h);
100 void evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage, Tilebuf_Rect *buffer_damage, Evas_Render_Mode render_mode);
101 Evas_Engine_GL_Context *evas_outbuf_gl_context_get(Outbuf *ob);
102 Context_3D *evas_outbuf_gl_context_new(Outbuf *ob);
103 void evas_outbuf_gl_context_use(Context_3D *ctx);
104 void evas_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth);
105 void *evas_outbuf_egl_display_get(Outbuf *ob);
106
107 #define GL_COCOA_UNIMPLEMENTED_CALL_SO_RETURN(...) \
108 do { \
109 CRI("[%s] IS AN UNIMPLEMENTED CALL. PLEASE REPORT!!", __func__); \
110 return __VA_ARGS__; \
111 } while (0)
112
113 #endif /* __EVAS_ENGINE_H__ */
114