#include "evas_common.h" /* Also includes international specific stuff */
#include "evas_private.h"
-
-#define EVAS_GL_NO_GL_H_CHECK 1
-#include "Evas_GL.h"
-
#ifdef HAVE_DLSYM
# include <dlfcn.h> /* dlopen,dlclose,etc */
+
+# define EVAS_GL 1
+# define EVAS_GL_NO_GL_H_CHECK 1
+# include "Evas_GL.h"
+
#else
-# error software_generic should not get compiled if dlsym is not found on the system!
+# warning software_generic will not be able to have Evas_GL API.
#endif
+#ifdef EVAS_GL
//----------------------------------//
-// OSMesa...
+// OSMesa...
#define OSMESA_MAJOR_VERSION 6
#define OSMESA_MINOR_VERSION 5
typedef void (*OSMESAproc)();
typedef struct osmesa_context *OSMesaContext;
+#endif
typedef struct _Render_Engine_GL_Surface Render_Engine_GL_Surface;
typedef struct _Render_Engine_GL_Context Render_Engine_GL_Context;
int initialized;
int w, h;
+#ifdef EVAS_GL
GLenum internal_fmt;
+#endif
int internal_cpp; // Component per pixel. ie. RGB = 3
int depth_bits;
Render_Engine_GL_Context *current_ctx;
};
+#ifdef EVAS_GL
struct _Render_Engine_GL_Context
{
int initialized;
Render_Engine_GL_Surface *current_sfc;
};
-
//------------------------------------------------------//
-typedef void (*_eng_fn) (void );
+typedef void (*_eng_fn) (void );
typedef _eng_fn (*glsym_func_eng_fn) ();
typedef void (*glsym_func_void) ();
typedef unsigned int (*glsym_func_uint) ();
static void (*_sym_glGetProgramBinary) (GLuint a, GLsizei b, GLsizei* c, GLenum* d, void* e) = NULL;
static void (*_sym_glProgramBinary) (GLuint a, GLenum b, const void* c, GLint d) = NULL;
static void (*_sym_glProgramParameteri) (GLuint a, GLuint b, GLint d) = NULL;
+#endif
/*
*****
static void *
eng_gl_surface_create(void *data __UNUSED__, void *config, int w, int h)
{
+#ifdef EVAS_GL
Render_Engine_GL_Surface *sfc;
Evas_GL_Config *cfg;
}
return sfc;
+#else
+ (void) config;
+ (void) w;
+ (void) h;
+ return NULL;
+#endif
}
static int
eng_gl_surface_destroy(void *data __UNUSED__, void *surface)
{
+#ifdef EVAS_GL
Render_Engine_GL_Surface *sfc;
sfc = (Render_Engine_GL_Surface*)surface;
surface = NULL;
return 1;
+#else
+ (void) surface;
+ return 1;
+#endif
}
static void *
eng_gl_context_create(void *data __UNUSED__, void *share_context)
{
+#ifdef EVAS_GL
Render_Engine_GL_Context *ctx;
Render_Engine_GL_Context *share_ctx;
ctx->initialized = 0;
return ctx;
+#else
+ (void) share_context;
+ return NULL;
+#endif
}
static int
eng_gl_context_destroy(void *data __UNUSED__, void *context)
{
+#ifdef EVAS_GL
Render_Engine_GL_Context *ctx;
ctx = (Render_Engine_GL_Context*)context;
context = NULL;
return 1;
+#else
+ (void) context;
+ return 0;
+#endif
}
static int
eng_gl_make_current(void *data __UNUSED__, void *surface, void *context)
{
+#ifdef EVAS_GL
Render_Engine_GL_Surface *sfc;
Render_Engine_GL_Context *ctx;
OSMesaContext share_ctx;
sfc->current_ctx = ctx;
return 1;
+#else
+ (void) surface;
+ (void) context;
+ return 1;
+#endif
}
// FIXME!!! Implement later
static void *
eng_gl_proc_address_get(void *data __UNUSED__, const char *name)
{
+#ifdef EVAS_GL
if (_sym_OSMesaGetProcAddress) return _sym_OSMesaGetProcAddress(name);
return dlsym(RTLD_DEFAULT, name);
+#else
+ (void) name;
+ return NULL;
+#endif
}
static int
eng_gl_native_surface_get(void *data __UNUSED__, void *surface, void *native_surface)
{
+#ifdef EVAS_GL
Render_Engine_GL_Surface *sfc;
Evas_Native_Surface *ns;
ns->data.x11.visual = sfc->buffer;
return 1;
+#else
+ (void) surface;
+ (void) native_surface;
+ return 1;
+#endif
}
static void *
eng_gl_api_get(void *data __UNUSED__)
{
+#ifdef EVAS_GL
return &gl_funcs;
+#else
+ return NULL;
+#endif
}
//------------------------------------------------//
// Load Symbols //
// //
//----------------------------------------------------------------//
+#ifdef EVAS_GL
static void
sym_missing(void)
{
ERR("GL symbols missing!\n");
}
-
-static int
+static int
glue_sym_init(void)
{
//------------------------------------------------//
return 1;
}
-static int
+static int
gl_sym_init(void)
{
//------------------------------------------------//
DBG("GL Library is GLES.");
gl_lib_is_gles = 1;
}
-
+
return 1;
}
//n = binaryformat = length = 0;
//shaders = binary = 0;
}
+#endif
//--------------------------------------------------------------//
+#ifdef EVAS_GL
static void
override_gl_apis(Evas_GL_API *api)
{
ORD(glShaderSource); // Do precision stripping in both cases
#undef ORD
}
+#endif
//-------------------------------------------//
static int
gl_lib_init(void)
{
+#ifdef EVAS_GL
// dlopen OSMesa
gl_lib_handle = dlopen("libOSMesa.so.1", RTLD_NOW);
if (!gl_lib_handle) gl_lib_handle = dlopen("libOSMesa.so", RTLD_NOW);
if (!gl_sym_init()) return 0;
override_gl_apis(&gl_funcs);
-
+
return 1;
+#else
+ return 0;
+#endif
}
-static void
-init_gl()
+static void
+init_gl(void)
{
DBG("Initializing Software OpenGL APIs...\n");