1
/* ECTOR - EFL retained mode drawing library
2
* Copyright (C) 2014 Cedric Bail
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library;
16
* if not, see <http://www.gnu.org/licenses/>.
23
#include "ector_private.h"
26
int _ector_log_dom_global = 0;
28
static int _ector_main_count = 0;
33
if (EINA_LIKELY(_ector_main_count > 0))
34
return ++_ector_main_count;
39
_ector_log_dom_global = eina_log_domain_register("ector", ECTOR_DEFAULT_LOG_COLOR);
40
if (_ector_log_dom_global < 0)
42
EINA_LOG_ERR("Could not register log domain: ector");
46
_ector_main_count = 1;
48
eina_log_timing(_ector_log_dom_global, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT);
51
return _ector_main_count;
54
efl_object_shutdown();
66
ector_glsym_set(void *(*glsym)(void *lib, const char *name), void *lib)
68
Eina_Bool r = EINA_TRUE;
70
if (!glsym) return EINA_FALSE;
72
#define ORD(a) do { GL.a = glsym(lib, #a); if (!GL.a) { GL.a = (void*) donothing; r = EINA_FALSE; } } while (0)
76
ORD(glBindAttribLocation);
78
ORD(glBindFramebuffer);
79
ORD(glBindRenderbuffer);
83
ORD(glBlendEquationSeparate);
85
ORD(glBlendFuncSeparate);
88
ORD(glCheckFramebufferStatus);
95
ORD(glCompressedTexImage2D);
96
ORD(glCompressedTexSubImage2D);
97
ORD(glCopyTexImage2D);
98
ORD(glCopyTexSubImage2D);
102
ORD(glDeleteBuffers);
103
ORD(glDeleteFramebuffers);
104
ORD(glDeleteProgram);
105
ORD(glDeleteRenderbuffers);
107
ORD(glDeleteTextures);
113
ORD(glDisableVertexAttribArray);
117
ORD(glEnableVertexAttribArray);
120
ORD(glFramebufferRenderbuffer);
121
ORD(glFramebufferTexture2D);
124
ORD(glGenerateMipmap);
125
ORD(glGenFramebuffers);
126
ORD(glGenRenderbuffers);
128
ORD(glGetActiveAttrib);
129
ORD(glGetActiveUniform);
130
ORD(glGetAttachedShaders);
131
ORD(glGetAttribLocation);
133
ORD(glGetBufferParameteriv);
136
ORD(glGetFramebufferAttachmentParameteriv);
139
ORD(glGetProgramInfoLog);
140
ORD(glGetProgramBinary);
141
ORD(glGetRenderbufferParameteriv);
143
ORD(glGetShaderInfoLog);
144
ORD(glGetShaderPrecisionFormat);
145
ORD(glGetShaderSource);
147
ORD(glGetTexParameterfv);
148
ORD(glGetTexParameteriv);
151
ORD(glGetUniformLocation);
152
ORD(glGetVertexAttribfv);
153
ORD(glGetVertexAttribiv);
154
ORD(glGetVertexAttribPointerv);
158
ORD(glIsFramebuffer);
160
ORD(glIsRenderbuffer);
166
ORD(glPolygonOffset);
167
ORD(glProgramBinary);
168
ORD(glProgramParameteri);
170
ORD(glReleaseShaderCompiler);
171
ORD(glRenderbufferStorage);
172
ORD(glSampleCoverage);
177
ORD(glStencilFuncSeparate);
179
ORD(glStencilMaskSeparate);
181
ORD(glStencilOpSeparate);
183
ORD(glTexParameterf);
184
ORD(glTexParameterfv);
185
ORD(glTexParameteri);
186
ORD(glTexParameteriv);
187
ORD(glTexSubImage2D);
204
ORD(glUniformMatrix2fv);
205
ORD(glUniformMatrix3fv);
206
ORD(glUniformMatrix4fv);
208
ORD(glValidateProgram);
209
ORD(glVertexAttrib1f);
210
ORD(glVertexAttrib1fv);
211
ORD(glVertexAttrib2f);
212
ORD(glVertexAttrib2fv);
213
ORD(glVertexAttrib3f);
214
ORD(glVertexAttrib3fv);
215
ORD(glVertexAttrib4f);
216
ORD(glVertexAttrib4fv);
217
ORD(glVertexAttribPointer);
227
if (_ector_main_count <= 0)
229
EINA_LOG_ERR("Init count not greater than 0 in shutdown of ector.");
234
if (EINA_LIKELY(_ector_main_count > 0))
235
return _ector_main_count;
238
eina_log_timing(_ector_log_dom_global,
239
EINA_LOG_STATE_START,
240
EINA_LOG_STATE_SHUTDOWN);
242
efl_object_shutdown();
244
eina_log_domain_unregister(_ector_log_dom_global);
247
return _ector_main_count;