2013-06-20 03:53:29 -07:00
|
|
|
#include "evas_common_private.h" /* Also includes international specific stuff */
|
2009-10-09 05:10:27 -07:00
|
|
|
#include "evas_engine.h"
|
|
|
|
|
2013-04-09 17:40:37 -07:00
|
|
|
//#define TIMDBG 1
|
|
|
|
#ifdef TIMDBG
|
|
|
|
# include <sys/time.h>
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2011-10-15 02:31:04 -07:00
|
|
|
#ifdef HAVE_DLSYM
|
|
|
|
# include <dlfcn.h> /* dlopen,dlclose,etc */
|
|
|
|
#else
|
|
|
|
# error gl_x11 should not get compiled if dlsym is not found on the system!
|
|
|
|
#endif
|
|
|
|
|
2013-10-29 03:06:33 -07:00
|
|
|
#ifdef EVAS_CSERVE2
|
|
|
|
#include "evas_cs2_private.h"
|
|
|
|
#endif
|
|
|
|
|
2011-05-01 19:14:00 -07:00
|
|
|
#define EVAS_GL_NO_GL_H_CHECK 1
|
|
|
|
#include "Evas_GL.h"
|
2010-01-21 00:44:11 -08:00
|
|
|
|
2013-04-11 05:23:07 -07:00
|
|
|
#define EVAS_GL_UPDATE_TILE_SIZE 16
|
|
|
|
|
2014-07-04 04:51:32 -07:00
|
|
|
static int safe_native = -1;
|
2012-09-25 20:49:33 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
typedef struct _Render_Engine Render_Engine;
|
2010-08-02 23:09:53 -07:00
|
|
|
|
|
|
|
struct _Render_Engine
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
Render_Engine_GL_Generic generic;
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
};
|
|
|
|
|
2014-07-04 04:51:32 -07:00
|
|
|
const char *debug_dir;
|
|
|
|
int swap_buffer_debug_mode = -1;
|
|
|
|
int swap_buffer_debug = 0;
|
|
|
|
int partial_render_debug = -1;
|
|
|
|
int extn_have_buffer_age = 1;
|
|
|
|
|
2010-08-02 23:09:53 -07:00
|
|
|
static int initted = 0;
|
|
|
|
static int gl_wins = 0;
|
2013-12-11 01:26:45 -08:00
|
|
|
#ifdef GL_GLES
|
2014-01-06 20:13:01 -08:00
|
|
|
static int extn_have_y_inverted = 1;
|
2013-12-11 01:26:45 -08:00
|
|
|
#endif
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
|
2011-12-17 21:03:24 -08:00
|
|
|
typedef void (*_eng_fn) (void);
|
|
|
|
typedef _eng_fn (*glsym_func_eng_fn) ();
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
typedef void (*glsym_func_void) ();
|
|
|
|
typedef void *(*glsym_func_void_ptr) ();
|
|
|
|
typedef int (*glsym_func_int) ();
|
|
|
|
typedef unsigned int (*glsym_func_uint) ();
|
2011-12-17 21:03:24 -08:00
|
|
|
typedef const char *(*glsym_func_const_char_ptr) ();
|
2010-08-02 23:09:53 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
Evas_GL_Common_Image_Call glsym_evas_gl_common_image_ref = NULL;
|
|
|
|
Evas_GL_Common_Image_Call glsym_evas_gl_common_image_unref = NULL;
|
|
|
|
Evas_GL_Common_Image_Call glsym_evas_gl_common_image_free = NULL;
|
|
|
|
Evas_GL_Common_Image_Call glsym_evas_gl_common_image_native_disable = NULL;
|
|
|
|
Evas_GL_Common_Image_Call glsym_evas_gl_common_image_native_enable = NULL;
|
|
|
|
Evas_GL_Common_Image_New_From_Data glsym_evas_gl_common_image_new_from_data = NULL;
|
|
|
|
Evas_GL_Common_Context_Call glsym_evas_gl_common_image_all_unload = NULL;
|
|
|
|
Evas_GL_Preload glsym_evas_gl_preload_init = NULL;
|
|
|
|
Evas_GL_Preload glsym_evas_gl_preload_shutdown = NULL;
|
|
|
|
EVGL_Engine_Call glsym_evgl_engine_shutdown = NULL;
|
2014-07-25 11:05:37 -07:00
|
|
|
Evas_Gl_Symbols glsym_evas_gl_symbols = NULL;
|
2014-07-11 06:16:03 -07:00
|
|
|
|
|
|
|
Evas_GL_Common_Context_New glsym_evas_gl_common_context_new = NULL;
|
|
|
|
Evas_GL_Common_Context_Call glsym_evas_gl_common_context_flush = NULL;
|
|
|
|
Evas_GL_Common_Context_Call glsym_evas_gl_common_context_free = NULL;
|
|
|
|
Evas_GL_Common_Context_Call glsym_evas_gl_common_context_use = NULL;
|
|
|
|
Evas_GL_Common_Context_Call glsym_evas_gl_common_context_newframe = NULL;
|
|
|
|
Evas_GL_Common_Context_Call glsym_evas_gl_common_context_done = NULL;
|
|
|
|
Evas_GL_Common_Context_Resize_Call glsym_evas_gl_common_context_resize = NULL;
|
|
|
|
Evas_GL_Common_Buffer_Dump_Call glsym_evas_gl_common_buffer_dump = NULL;
|
|
|
|
Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock = NULL;
|
|
|
|
Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock = NULL;
|
|
|
|
Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_relax = NULL;
|
|
|
|
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2010-01-28 21:32:51 -08:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
#ifndef EGL_NATIVE_PIXMAP_KHR
|
|
|
|
# define EGL_NATIVE_PIXMAP_KHR 0x30b0
|
|
|
|
#endif
|
2013-11-28 01:18:16 -08:00
|
|
|
#ifndef EGL_Y_INVERTED_NOK
|
|
|
|
# define EGL_Y_INVERTED_NOK 0x307F
|
|
|
|
#endif
|
2013-04-09 16:36:33 -07:00
|
|
|
|
2011-12-17 21:03:24 -08:00
|
|
|
_eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
|
|
|
|
void *(*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const int *e) = NULL;
|
|
|
|
void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
|
|
|
|
void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
|
2014-07-06 11:19:28 -07:00
|
|
|
unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL;
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
#else
|
2013-04-09 16:36:33 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
typedef XID (*glsym_func_xid) ();
|
|
|
|
|
|
|
|
_eng_fn (*glsym_glXGetProcAddress) (const char *a) = NULL;
|
|
|
|
void (*glsym_glXBindTexImage) (Display *a, GLXDrawable b, int c, int *d) = NULL;
|
|
|
|
void (*glsym_glXReleaseTexImage) (Display *a, GLXDrawable b, int c) = NULL;
|
|
|
|
int (*glsym_glXGetVideoSync) (unsigned int *a) = NULL;
|
|
|
|
int (*glsym_glXWaitVideoSync) (int a, int b, unsigned int *c) = NULL;
|
|
|
|
XID (*glsym_glXCreatePixmap) (Display *a, void *b, Pixmap c, const int *d) = NULL;
|
|
|
|
void (*glsym_glXDestroyPixmap) (Display *a, XID b) = NULL;
|
|
|
|
void (*glsym_glXQueryDrawable) (Display *a, XID b, int c, unsigned int *d) = NULL;
|
|
|
|
int (*glsym_glXSwapIntervalSGI) (int a) = NULL;
|
|
|
|
void (*glsym_glXSwapIntervalEXT) (Display *s, GLXDrawable b, int c) = NULL;
|
2013-04-09 17:40:37 -07:00
|
|
|
void (*glsym_glXReleaseBuffersMESA) (Display *a, XID b) = NULL;
|
2012-05-15 06:13:05 -07:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-04-09 17:40:37 -07:00
|
|
|
#ifdef TIMDBG
|
|
|
|
static double
|
|
|
|
gettime(void)
|
|
|
|
{
|
|
|
|
struct timeval timev;
|
|
|
|
|
|
|
|
gettimeofday(&timev, NULL);
|
|
|
|
return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
measure(int end, const char *name)
|
|
|
|
{
|
|
|
|
FILE *fs;
|
|
|
|
static unsigned long user = 0, kern = 0, user2 = 0, kern2 = 0;
|
|
|
|
static double t = 0.0, t2 = 0.0;
|
|
|
|
unsigned long u = 0, k = 0;
|
|
|
|
|
|
|
|
fs = fopen("/proc/self/stat", "rb");
|
|
|
|
if (fs) {
|
|
|
|
fscanf(fs, "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s "
|
|
|
|
"%lu %lu %*s", &u, &k);
|
|
|
|
fclose(fs);
|
|
|
|
}
|
|
|
|
if (end)
|
|
|
|
{
|
|
|
|
long hz;
|
|
|
|
|
|
|
|
t2 = gettime();
|
|
|
|
user2 = u;
|
|
|
|
kern2 = k;
|
|
|
|
hz = sysconf(_SC_CLK_TCK);
|
|
|
|
fprintf(stderr, "(%8lu %8lu) k=%4lu u=%4lu == tot=%4lu@%4li in=%3.5f < %s\n",
|
|
|
|
user, kern, kern2 - kern, user2 - user,
|
|
|
|
(kern2 - kern) + (user2 - user), hz, t2 - t, name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
user = u;
|
|
|
|
kern = k;
|
|
|
|
t = gettime();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
static inline Outbuf *
|
|
|
|
eng_get_ob(Render_Engine *re)
|
|
|
|
{
|
|
|
|
return re->generic.software.ob;
|
|
|
|
}
|
2013-05-20 02:09:50 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
//----------------------------------------------------------//
|
|
|
|
// NEW_EVAS_GL Engine Functions
|
|
|
|
static void *
|
|
|
|
evgl_eng_display_get(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, NULL); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
|
|
|
{
|
|
|
|
ERR("Invalid Render Engine Data!");
|
2013-05-20 02:09:50 -07:00
|
|
|
return NULL;
|
2012-09-24 00:41:27 -07:00
|
|
|
}
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2014-07-11 06:16:03 -07:00
|
|
|
if (eng_get_ob(re))
|
|
|
|
return (void*)eng_get_ob(re)->egl_disp;
|
2012-05-15 06:13:05 -07:00
|
|
|
#else
|
2014-07-11 06:16:03 -07:00
|
|
|
if (eng_get_ob(re)->info)
|
|
|
|
return (void*)eng_get_ob(re)->info->info.display;
|
2012-05-15 06:13:05 -07:00
|
|
|
#endif
|
2012-09-24 00:41:27 -07:00
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
static void *
|
|
|
|
evgl_eng_evas_surface_get(void *data)
|
2010-01-21 00:44:11 -08:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, NULL); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
|
|
|
{
|
|
|
|
ERR("Invalid Render Engine Data!");
|
2013-05-20 02:09:50 -07:00
|
|
|
return NULL;
|
2012-09-24 00:41:27 -07:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2014-07-11 06:16:03 -07:00
|
|
|
if (eng_get_ob(re))
|
|
|
|
return (void*)eng_get_ob(re)->egl_surface[0];
|
2012-09-24 00:41:27 -07:00
|
|
|
#else
|
2014-07-11 06:16:03 -07:00
|
|
|
if (eng_get_ob(re))
|
|
|
|
return (void*)eng_get_ob(re)->win;
|
2012-09-24 00:41:27 -07:00
|
|
|
#endif
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
static int
|
|
|
|
evgl_eng_make_current(void *data, void *surface, void *context, int flush)
|
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
|
|
|
int ret = 0;
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, 0); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
|
|
|
{
|
|
|
|
ERR("Invalid Render Engine Data!");
|
|
|
|
return 0;
|
|
|
|
}
|
2011-12-17 21:03:24 -08:00
|
|
|
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
#ifdef GL_GLES
|
|
|
|
EGLContext ctx = (EGLContext)context;
|
|
|
|
EGLSurface sfc = (EGLSurface)surface;
|
2014-07-11 06:16:03 -07:00
|
|
|
EGLDisplay dpy = eng_get_ob(re)->egl_disp; //eglGetCurrentDisplay();
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2013-04-09 17:40:37 -07:00
|
|
|
if ((!context) && (!surface))
|
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ret = eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("eglMakeCurrent() failed! Error Code=%#x", eglGetError());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
2013-04-09 17:40:37 -07:00
|
|
|
}
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
if ((eglGetCurrentContext() != ctx) ||
|
|
|
|
(eglGetCurrentSurface(EGL_READ) != sfc) ||
|
|
|
|
(eglGetCurrentSurface(EGL_DRAW) != sfc) )
|
|
|
|
{
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
//!!!! Does it need to be flushed with it's set to NULL above??
|
|
|
|
// Flush remainder of what's in Evas' pipeline
|
|
|
|
if (flush) eng_window_use(NULL);
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
// Do a make current
|
|
|
|
ret = eglMakeCurrent(dpy, sfc, sfc, ctx);
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("eglMakeCurrent() failed! Error Code=%#x", eglGetError());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
return 1;
|
2012-05-15 06:13:05 -07:00
|
|
|
#else
|
2012-09-24 00:41:27 -07:00
|
|
|
GLXContext ctx = (GLXContext)context;
|
|
|
|
Window sfc = (Window)surface;
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2013-04-09 17:40:37 -07:00
|
|
|
if ((!context) && (!surface))
|
2012-09-24 00:41:27 -07:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
ret = glXMakeCurrent(eng_get_ob(re)->info->info.display, None, NULL);
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("glXMakeCurrent() failed!");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
2012-05-15 06:13:05 -07:00
|
|
|
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
if ((glXGetCurrentContext() != ctx))
|
|
|
|
{
|
|
|
|
//!!!! Does it need to be flushed with it's set to NULL above??
|
|
|
|
// Flush remainder of what's in Evas' pipeline
|
|
|
|
if (flush) eng_window_use(NULL);
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
// Do a make current
|
2014-07-11 06:16:03 -07:00
|
|
|
ret = glXMakeCurrent(eng_get_ob(re)->info->info.display, sfc, ctx);
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("glXMakeCurrent() failed. Ret: %d! Context: %p Surface: %p", ret, (void*)ctx, (void*)sfc);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
#endif
|
|
|
|
}
|
2012-05-15 06:13:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
static void *
|
|
|
|
evgl_eng_native_window_create(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, NULL); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
|
|
|
{
|
|
|
|
ERR("Invalid Render Engine Data!");
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
XSetWindowAttributes attr;
|
|
|
|
Window win;
|
|
|
|
|
|
|
|
attr.backing_store = NotUseful;
|
|
|
|
attr.override_redirect = True;
|
|
|
|
attr.border_pixel = 0;
|
|
|
|
attr.background_pixmap = None;
|
|
|
|
attr.bit_gravity = NorthWestGravity;
|
|
|
|
attr.win_gravity = NorthWestGravity;
|
|
|
|
attr.save_under = False;
|
|
|
|
attr.do_not_propagate_mask = NoEventMask;
|
|
|
|
attr.event_mask = 0;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
win = XCreateWindow(eng_get_ob(re)->info->info.display,
|
|
|
|
DefaultRootWindow(eng_get_ob(re)->info->info.display),
|
2012-09-24 00:41:27 -07:00
|
|
|
0, 0, 2, 2, 0,
|
|
|
|
CopyFromParent, InputOutput, CopyFromParent,
|
|
|
|
CWBackingStore | CWOverrideRedirect |
|
|
|
|
CWBorderPixel | CWBackPixmap |
|
|
|
|
CWSaveUnder | CWDontPropagate |
|
|
|
|
CWEventMask | CWBitGravity |
|
|
|
|
CWWinGravity, &attr);
|
|
|
|
if (!win)
|
|
|
|
{
|
|
|
|
ERR("Creating native X window failed.");
|
|
|
|
return NULL;
|
|
|
|
}
|
Adding MSAA (Multisample Anti-Aliased) Surface Option to Evas GL.
Currently, this feature is only supported in EGL/GLESv2 environment
with GL_IMG_multisampled_render_to_texture extension supported.
_____________________
from: (sanghee park) sh15.park@samsung.com
Dear all,
I compose this mail to ask reviewal this patch about multisampling on the evasgl.
I want to make multisampling capacity to enhance rendering quality of the evasgl.
But if MSAA is applied always, this have possibility lowering rendering performance,
I separated user's input level to high, mid, low, none.
If you want to test this patch, try to examine rendering qulity on EGL circumstance with multisampling level.
Plaese review it, and any suggestion will be appreciated.
Best Regards,
SangHee
SVN revision: 70992
2012-05-14 01:52:56 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
return (void*)win;
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
static int
|
|
|
|
evgl_eng_native_window_destroy(void *data, void *native_window)
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, 0); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
2012-06-27 01:19:25 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ERR("Invalid Render Engine Data!");
|
|
|
|
return 0;
|
2012-06-27 01:19:25 -07:00
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!native_window)
|
2012-06-27 01:19:25 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ERR("Inavlid native surface.");
|
|
|
|
return 0;
|
2012-06-27 01:19:25 -07:00
|
|
|
}
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
XDestroyWindow(eng_get_ob(re)->info->info.display, (Window)native_window);
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
native_window = NULL;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
return 1;
|
|
|
|
}
|
2012-06-27 01:19:25 -07:00
|
|
|
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
// Theoretically, we wouldn't need this functoin if the surfaceless context
|
|
|
|
// is supported. But, until then...
|
|
|
|
static void *
|
|
|
|
evgl_eng_window_surface_create(void *data, void *native_window)
|
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, NULL); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
|
|
|
{
|
|
|
|
ERR("Invalid Render Engine Data!");
|
|
|
|
return NULL;
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
}
|
2008-04-11 17:32:30 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
#ifdef GL_GLES
|
|
|
|
EGLSurface surface = EGL_NO_SURFACE;
|
|
|
|
|
|
|
|
// Create resource surface for EGL
|
2014-07-11 06:16:03 -07:00
|
|
|
surface = eglCreateWindowSurface(eng_get_ob(re)->egl_disp,
|
|
|
|
eng_get_ob(re)->egl_config,
|
2012-09-24 00:41:27 -07:00
|
|
|
(EGLNativeWindowType)native_window,
|
|
|
|
NULL);
|
|
|
|
if (!surface)
|
|
|
|
{
|
|
|
|
ERR("Creating window surface failed. Error: %#x.", eglGetError());
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-02-27 20:07:49 -08:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
return (void*)surface;
|
|
|
|
#else
|
|
|
|
/*
|
|
|
|
// We don't need to create new one for GLX
|
|
|
|
Window surface;
|
2011-11-10 00:59:09 -08:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
surface = eng_get_ob(re)->win;
|
2010-01-21 00:44:11 -08:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
return (void *)surface;
|
|
|
|
*/
|
|
|
|
return (void*)native_window;
|
|
|
|
#endif
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-08-26 02:40:48 -07:00
|
|
|
static int
|
2012-09-24 00:41:27 -07:00
|
|
|
evgl_eng_window_surface_destroy(void *data, void *surface)
|
2010-08-26 02:40:48 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, 0); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
2010-08-26 02:40:48 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ERR("Invalid Render Engine Data!");
|
|
|
|
return 0;
|
2010-08-26 02:40:48 -07:00
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
#ifdef GL_GLES
|
|
|
|
if (!surface)
|
|
|
|
{
|
|
|
|
ERR("Invalid surface.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
eglDestroySurface(eng_get_ob(re)->egl_disp, (EGLSurface)surface);
|
2012-09-24 00:41:27 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 1;
|
2012-11-13 06:07:39 -08:00
|
|
|
if (surface) return 0;
|
2010-08-26 02:40:48 -07:00
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
static void *
|
|
|
|
evgl_eng_context_create(void *data, void *share_ctx)
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, NULL); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
|
|
|
{
|
|
|
|
ERR("Invalid Render Engine Data!");
|
|
|
|
return NULL;
|
|
|
|
}
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2012-09-24 00:41:27 -07:00
|
|
|
EGLContext context = EGL_NO_CONTEXT;
|
2012-05-15 06:13:05 -07:00
|
|
|
int context_attrs[3];
|
2012-09-24 00:41:27 -07:00
|
|
|
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
|
|
|
|
context_attrs[1] = 2;
|
|
|
|
context_attrs[2] = EGL_NONE;
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
// Share context already assumes that it's sharing with evas' context
|
|
|
|
if (share_ctx)
|
2012-05-15 06:13:05 -07:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
context = eglCreateContext(eng_get_ob(re)->egl_disp,
|
|
|
|
eng_get_ob(re)->egl_config,
|
2012-09-24 00:41:27 -07:00
|
|
|
(EGLContext)share_ctx,
|
|
|
|
context_attrs);
|
2012-05-15 06:13:05 -07:00
|
|
|
}
|
|
|
|
else
|
2012-05-02 19:33:18 -07:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
context = eglCreateContext(eng_get_ob(re)->egl_disp,
|
|
|
|
eng_get_ob(re)->egl_config,
|
|
|
|
eng_get_ob(re)->egl_context[0], // Evas' GL Context
|
2012-05-15 06:13:05 -07:00
|
|
|
context_attrs);
|
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!context)
|
2012-05-15 06:13:05 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ERR("Engine Context Creations Failed. Error: %#x.", eglGetError());
|
2012-05-15 06:13:05 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
return (void*)context;
|
2012-05-15 06:13:05 -07:00
|
|
|
#else
|
2012-09-24 00:41:27 -07:00
|
|
|
GLXContext context = NULL;
|
|
|
|
|
|
|
|
// Share context already assumes that it's sharing with evas' context
|
|
|
|
if (share_ctx)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
context = glXCreateContext(eng_get_ob(re)->info->info.display,
|
|
|
|
eng_get_ob(re)->visualinfo,
|
2012-09-24 00:41:27 -07:00
|
|
|
(GLXContext)share_ctx,
|
2012-05-15 06:13:05 -07:00
|
|
|
1);
|
2012-09-24 00:41:27 -07:00
|
|
|
}
|
|
|
|
else
|
2011-11-10 00:59:09 -08:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
context = glXCreateContext(eng_get_ob(re)->info->info.display,
|
|
|
|
eng_get_ob(re)->visualinfo,
|
|
|
|
eng_get_ob(re)->context, // Evas' GL Context
|
2012-09-24 00:41:27 -07:00
|
|
|
1);
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!context)
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ERR("Internal Resource Context Creations Failed.");
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
return (void*)context;
|
2012-05-15 06:13:05 -07:00
|
|
|
#endif
|
|
|
|
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-09-24 00:41:27 -07:00
|
|
|
evgl_eng_context_destroy(void *data, void *context)
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, 0); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if ((!re) || (!context))
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ERR("Invalid Render Input Data. Engine: %p, Context: %p", data, context);
|
|
|
|
return 0;
|
2012-05-15 06:13:05 -07:00
|
|
|
}
|
2012-09-24 00:41:27 -07:00
|
|
|
|
|
|
|
#ifdef GL_GLES
|
2014-07-11 06:16:03 -07:00
|
|
|
eglDestroyContext(eng_get_ob(re)->egl_disp, (EGLContext)context);
|
2012-09-24 00:41:27 -07:00
|
|
|
#else
|
2014-07-11 06:16:03 -07:00
|
|
|
glXDestroyContext(eng_get_ob(re)->info->info.display, (GLXContext)context);
|
2012-07-23 20:57:27 -07:00
|
|
|
#endif
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
evgl_eng_string_get(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, NULL); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
2012-06-27 01:19:25 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ERR("Invalid Render Engine Data!");
|
|
|
|
return NULL;
|
2012-06-27 01:19:25 -07:00
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
#ifdef GL_GLES
|
2014-07-11 06:16:03 -07:00
|
|
|
return eglQueryString(eng_get_ob(re)->egl_disp, EGL_EXTENSIONS);
|
2012-09-24 00:41:27 -07:00
|
|
|
#else
|
2014-07-11 06:16:03 -07:00
|
|
|
return glXQueryExtensionsString(eng_get_ob(re)->info->info.display,
|
|
|
|
eng_get_ob(re)->info->info.screen);
|
2012-09-24 00:41:27 -07:00
|
|
|
#endif
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
static void *
|
|
|
|
evgl_eng_proc_address_get(const char *name)
|
|
|
|
{
|
|
|
|
#ifdef GL_GLES
|
|
|
|
if (glsym_eglGetProcAddress) return glsym_eglGetProcAddress(name);
|
|
|
|
return dlsym(RTLD_DEFAULT, name);
|
|
|
|
#else
|
|
|
|
if (glsym_glXGetProcAddress) return glsym_glXGetProcAddress(name);
|
|
|
|
return dlsym(RTLD_DEFAULT, name);
|
|
|
|
#endif
|
|
|
|
}
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2012-08-01 18:15:38 -07:00
|
|
|
static int
|
2012-09-24 00:41:27 -07:00
|
|
|
evgl_eng_rotation_angle_get(void *data)
|
2012-08-01 18:15:38 -07:00
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* EVGLINIT(re, 0); */
|
2012-09-24 00:41:27 -07:00
|
|
|
if (!re)
|
2012-08-01 18:15:38 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ERR("Invalid Render Engine Data!");
|
|
|
|
return 0;
|
2012-08-01 18:15:38 -07:00
|
|
|
}
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
if ((eng_get_ob(re)) && (eng_get_ob(re)->gl_context))
|
|
|
|
return eng_get_ob(re)->gl_context->rot;
|
2012-09-24 00:41:27 -07:00
|
|
|
else
|
2012-08-01 18:15:38 -07:00
|
|
|
{
|
2012-09-24 00:41:27 -07:00
|
|
|
ERR("Unable to retrieve rotation angle.");
|
2012-08-01 18:15:38 -07:00
|
|
|
return 0;
|
|
|
|
}
|
2012-09-24 00:41:27 -07:00
|
|
|
}
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
static const EVGL_Interface evgl_funcs =
|
2012-09-24 00:41:27 -07:00
|
|
|
{
|
|
|
|
evgl_eng_display_get,
|
|
|
|
evgl_eng_evas_surface_get,
|
|
|
|
evgl_eng_native_window_create,
|
|
|
|
evgl_eng_native_window_destroy,
|
|
|
|
evgl_eng_window_surface_create,
|
|
|
|
evgl_eng_window_surface_destroy,
|
|
|
|
evgl_eng_context_create,
|
|
|
|
evgl_eng_context_destroy,
|
|
|
|
evgl_eng_make_current,
|
|
|
|
evgl_eng_proc_address_get,
|
|
|
|
evgl_eng_string_get,
|
|
|
|
evgl_eng_rotation_angle_get
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------//
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2012-11-21 23:58:06 -08:00
|
|
|
gl_symbols(void)
|
2012-09-24 00:41:27 -07:00
|
|
|
{
|
|
|
|
static int done = 0;
|
|
|
|
|
|
|
|
if (done) return;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
#define LINK2GENERIC(sym) \
|
|
|
|
glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
|
|
|
|
|
|
|
|
// Get function pointer to evas_gl_common that is now provided through the link of GL_Generic.
|
|
|
|
LINK2GENERIC(evas_gl_common_image_all_unload);
|
|
|
|
LINK2GENERIC(evas_gl_common_image_ref);
|
|
|
|
LINK2GENERIC(evas_gl_common_image_unref);
|
|
|
|
LINK2GENERIC(evas_gl_common_image_new_from_data);
|
|
|
|
LINK2GENERIC(evas_gl_common_image_native_disable);
|
|
|
|
LINK2GENERIC(evas_gl_common_image_free);
|
|
|
|
LINK2GENERIC(evas_gl_common_image_native_enable);
|
|
|
|
LINK2GENERIC(evas_gl_common_context_new);
|
|
|
|
LINK2GENERIC(evas_gl_common_context_flush);
|
|
|
|
LINK2GENERIC(evas_gl_common_context_free);
|
|
|
|
LINK2GENERIC(evas_gl_common_context_use);
|
|
|
|
LINK2GENERIC(evas_gl_common_context_newframe);
|
|
|
|
LINK2GENERIC(evas_gl_common_context_done);
|
|
|
|
LINK2GENERIC(evas_gl_common_context_resize);
|
|
|
|
LINK2GENERIC(evas_gl_common_buffer_dump);
|
|
|
|
LINK2GENERIC(evas_gl_preload_render_lock);
|
|
|
|
LINK2GENERIC(evas_gl_preload_render_unlock);
|
|
|
|
LINK2GENERIC(evas_gl_preload_render_relax);
|
|
|
|
LINK2GENERIC(evas_gl_preload_init);
|
|
|
|
LINK2GENERIC(evas_gl_preload_shutdown);
|
|
|
|
LINK2GENERIC(evgl_engine_shutdown);
|
2014-07-25 11:05:37 -07:00
|
|
|
LINK2GENERIC(evas_gl_symbols);
|
2014-07-11 06:16:03 -07:00
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
#ifdef GL_GLES
|
|
|
|
#define FINDSYM(dst, sym, typ) \
|
2013-03-08 02:35:36 -08:00
|
|
|
if (glsym_eglGetProcAddress) { \
|
|
|
|
if (!dst) dst = (typ)glsym_eglGetProcAddress(sym); \
|
|
|
|
} else { \
|
|
|
|
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym); \
|
|
|
|
}
|
2012-09-24 00:41:27 -07:00
|
|
|
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressKHR", glsym_func_eng_fn);
|
2012-09-24 00:41:27 -07:00
|
|
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn);
|
|
|
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressARB", glsym_func_eng_fn);
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
|
2012-09-24 00:41:27 -07:00
|
|
|
|
2014-07-25 11:05:37 -07:00
|
|
|
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress);
|
|
|
|
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_eglCreateImage, "eglCreateImageKHR", glsym_func_void_ptr);
|
2012-09-24 00:41:27 -07:00
|
|
|
FINDSYM(glsym_eglCreateImage, "eglCreateImageEXT", glsym_func_void_ptr);
|
|
|
|
FINDSYM(glsym_eglCreateImage, "eglCreateImageARB", glsym_func_void_ptr);
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_eglCreateImage, "eglCreateImage", glsym_func_void_ptr);
|
2012-09-24 00:41:27 -07:00
|
|
|
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageKHR", glsym_func_void);
|
2012-09-24 00:41:27 -07:00
|
|
|
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageARB", glsym_func_void);
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_eglDestroyImage, "eglDestroyImage", glsym_func_void);
|
2012-09-24 00:41:27 -07:00
|
|
|
|
|
|
|
FINDSYM(glsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES", glsym_func_void);
|
|
|
|
|
2013-06-14 04:30:17 -07:00
|
|
|
FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamageEXT", glsym_func_uint);
|
|
|
|
FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamageINTEL", glsym_func_uint);
|
|
|
|
FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamage", glsym_func_uint);
|
2013-03-11 23:26:32 -07:00
|
|
|
|
|
|
|
|
2012-08-01 18:15:38 -07:00
|
|
|
#else
|
2012-09-24 00:41:27 -07:00
|
|
|
#define FINDSYM(dst, sym, typ) \
|
2013-03-08 02:35:36 -08:00
|
|
|
if (glsym_glXGetProcAddress) { \
|
|
|
|
if (!dst) dst = (typ)glsym_glXGetProcAddress(sym); \
|
|
|
|
} else { \
|
|
|
|
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym); \
|
|
|
|
}
|
2012-09-24 00:41:27 -07:00
|
|
|
|
|
|
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressEXT", glsym_func_eng_fn);
|
|
|
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressARB", glsym_func_eng_fn);
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddress", glsym_func_eng_fn);
|
2012-09-24 00:41:27 -07:00
|
|
|
|
2014-07-25 11:05:37 -07:00
|
|
|
glsym_evas_gl_symbols((void*)glsym_glXGetProcAddress);
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageARB", glsym_func_void);
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_glXBindTexImage, "glXBindTexImage", glsym_func_void);
|
2012-09-24 00:41:27 -07:00
|
|
|
|
|
|
|
FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImageEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImageARB", glsym_func_void);
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImage", glsym_func_void);
|
2012-09-24 00:41:27 -07:00
|
|
|
|
|
|
|
FINDSYM(glsym_glXGetVideoSync, "glXGetVideoSyncSGI", glsym_func_int);
|
|
|
|
|
|
|
|
FINDSYM(glsym_glXWaitVideoSync, "glXWaitVideoSyncSGI", glsym_func_int);
|
|
|
|
|
|
|
|
FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmapEXT", glsym_func_xid);
|
|
|
|
FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmapARB", glsym_func_xid);
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmap", glsym_func_xid);
|
2012-09-24 00:41:27 -07:00
|
|
|
|
|
|
|
FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmapEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmapARB", glsym_func_void);
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmap", glsym_func_void);
|
2012-09-24 00:41:27 -07:00
|
|
|
|
|
|
|
FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableARB", glsym_func_void);
|
2013-03-13 03:37:04 -07:00
|
|
|
FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawable", glsym_func_void);
|
2012-09-24 00:41:27 -07:00
|
|
|
|
|
|
|
FINDSYM(glsym_glXSwapIntervalSGI, "glXSwapIntervalMESA", glsym_func_int);
|
|
|
|
FINDSYM(glsym_glXSwapIntervalSGI, "glXSwapIntervalSGI", glsym_func_int);
|
|
|
|
|
|
|
|
FINDSYM(glsym_glXSwapIntervalEXT, "glXSwapIntervalEXT", glsym_func_void);
|
|
|
|
|
2013-04-09 17:40:37 -07:00
|
|
|
FINDSYM(glsym_glXReleaseBuffersMESA, "glXReleaseBuffersMESA", glsym_func_void);
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
#endif
|
2012-11-21 23:58:06 -08:00
|
|
|
|
|
|
|
done = 1;
|
2012-09-24 00:41:27 -07:00
|
|
|
}
|
|
|
|
|
2013-03-11 23:26:32 -07:00
|
|
|
static void
|
|
|
|
gl_extn_veto(Render_Engine *re)
|
|
|
|
{
|
|
|
|
const char *str = NULL;
|
|
|
|
#ifdef GL_GLES
|
2014-07-11 06:16:03 -07:00
|
|
|
str = eglQueryString(eng_get_ob(re)->egl_disp, EGL_EXTENSIONS);
|
2013-03-11 23:26:32 -07:00
|
|
|
if (str)
|
|
|
|
{
|
|
|
|
if (getenv("EVAS_GL_INFO"))
|
|
|
|
printf("EGL EXTN:\n%s\n", str);
|
2013-04-09 16:36:33 -07:00
|
|
|
if (!strstr(str, "EGL_EXT_buffer_age"))
|
|
|
|
{
|
|
|
|
extn_have_buffer_age = 0;
|
|
|
|
}
|
2014-01-06 20:13:01 -08:00
|
|
|
if (!strstr(str, "EGL_NOK_texture_from_pixmap"))
|
2013-11-28 01:18:16 -08:00
|
|
|
{
|
2014-01-06 20:13:01 -08:00
|
|
|
extn_have_y_inverted = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const GLubyte *vendor, *renderer;
|
|
|
|
|
|
|
|
vendor = glGetString(GL_VENDOR);
|
|
|
|
renderer = glGetString(GL_RENDERER);
|
|
|
|
// XXX: workaround mesa bug!
|
|
|
|
// looking for mesa and intel build which is known to
|
|
|
|
// advertise the EGL_NOK_texture_from_pixmap extension
|
|
|
|
// but not set it correctly. guessing vendor/renderer
|
|
|
|
// strings will be like the following:
|
|
|
|
// OpenGL vendor string: Intel Open Source Technology Center
|
|
|
|
// OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Desktop
|
2014-03-19 03:48:46 -07:00
|
|
|
if (((vendor) && (strstr((const char *)vendor, "Intel"))) &&
|
|
|
|
((renderer) && (strstr((const char *)renderer, "Mesa"))) &&
|
|
|
|
((renderer) && (strstr((const char *)renderer, "Intel")))
|
2014-01-06 20:13:01 -08:00
|
|
|
)
|
|
|
|
extn_have_y_inverted = 0;
|
2013-11-28 01:18:16 -08:00
|
|
|
}
|
2014-04-05 06:21:13 -07:00
|
|
|
if (!strstr(str, "EGL_EXT_swap_buffers_with_damage"))
|
|
|
|
{
|
|
|
|
glsym_eglSwapBuffersWithDamage = NULL;
|
|
|
|
}
|
2013-04-09 17:40:37 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (getenv("EVAS_GL_INFO"))
|
|
|
|
printf("NO EGL EXTN!\n");
|
|
|
|
extn_have_buffer_age = 0;
|
2013-03-11 23:26:32 -07:00
|
|
|
}
|
|
|
|
#else
|
2014-07-11 06:16:03 -07:00
|
|
|
str = glXQueryExtensionsString(eng_get_ob(re)->info->info.display,
|
|
|
|
eng_get_ob(re)->info->info.screen);
|
2013-03-11 23:26:32 -07:00
|
|
|
if (str)
|
|
|
|
{
|
|
|
|
if (getenv("EVAS_GL_INFO"))
|
|
|
|
printf("GLX EXTN:\n%s\n", str);
|
|
|
|
if (!strstr(str, "_texture_from_pixmap"))
|
|
|
|
{
|
|
|
|
glsym_glXBindTexImage = NULL;
|
|
|
|
glsym_glXReleaseTexImage = NULL;
|
|
|
|
}
|
2014-07-30 00:16:45 -07:00
|
|
|
if (!strstr(str, "GLX_SGI_video_sync"))
|
2013-03-11 23:26:32 -07:00
|
|
|
{
|
|
|
|
glsym_glXGetVideoSync = NULL;
|
|
|
|
glsym_glXWaitVideoSync = NULL;
|
|
|
|
}
|
2013-04-09 16:36:33 -07:00
|
|
|
if (!strstr(str, "GLX_EXT_buffer_age"))
|
|
|
|
{
|
|
|
|
extn_have_buffer_age = 0;
|
|
|
|
}
|
2013-04-09 17:40:37 -07:00
|
|
|
if (!strstr(str, "GLX_EXT_swap_control"))
|
|
|
|
{
|
|
|
|
glsym_glXSwapIntervalEXT = NULL;
|
|
|
|
}
|
|
|
|
if (!strstr(str, "GLX_SGI_swap_control"))
|
|
|
|
{
|
|
|
|
glsym_glXSwapIntervalSGI = NULL;
|
|
|
|
}
|
|
|
|
if (!strstr(str, "GLX_MESA_release_buffers"))
|
|
|
|
{
|
|
|
|
glsym_glXReleaseBuffersMESA = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (getenv("EVAS_GL_INFO"))
|
|
|
|
printf("NO GLX EXTN!\n");
|
|
|
|
glsym_glXBindTexImage = NULL;
|
|
|
|
glsym_glXReleaseTexImage = NULL;
|
|
|
|
glsym_glXGetVideoSync = NULL;
|
|
|
|
glsym_glXWaitVideoSync = NULL;
|
|
|
|
extn_have_buffer_age = 0;
|
|
|
|
glsym_glXSwapIntervalEXT = NULL;
|
|
|
|
glsym_glXSwapIntervalSGI = NULL;
|
|
|
|
glsym_glXReleaseBuffersMESA = NULL;
|
2013-03-11 23:26:32 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-09-24 00:41:27 -07:00
|
|
|
int _evas_engine_GL_X11_log_dom = -1;
|
|
|
|
/* function tables - filled in later (func and parent func) */
|
|
|
|
static Evas_Func func, pfunc;
|
|
|
|
|
|
|
|
static void *
|
2012-11-10 03:07:35 -08:00
|
|
|
eng_info(Evas *eo_e EINA_UNUSED)
|
2012-09-24 00:41:27 -07:00
|
|
|
{
|
|
|
|
Evas_Engine_Info_GL_X11 *info;
|
|
|
|
|
|
|
|
info = calloc(1, sizeof(Evas_Engine_Info_GL_X11));
|
|
|
|
info->magic.magic = rand();
|
|
|
|
info->func.best_visual_get = eng_best_visual_get;
|
|
|
|
info->func.best_colormap_get = eng_best_colormap_get;
|
|
|
|
info->func.best_depth_get = eng_best_depth_get;
|
|
|
|
info->render_mode = EVAS_RENDER_MODE_BLOCKING;
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-11-04 03:51:42 -08:00
|
|
|
eng_info_free(Evas *eo_e EINA_UNUSED, void *info)
|
2012-09-24 00:41:27 -07:00
|
|
|
{
|
|
|
|
Evas_Engine_Info_GL_X11 *in;
|
|
|
|
// dont free! why bother? its not worth it
|
|
|
|
// eina_log_domain_unregister(_evas_engine_GL_X11_log_dom);
|
|
|
|
in = (Evas_Engine_Info_GL_X11 *)info;
|
|
|
|
free(in);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_re_winfree(Render_Engine *re)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
if (!eng_get_ob(re)->surf) return;
|
|
|
|
glsym_evas_gl_preload_render_relax(eng_preload_make_current, eng_get_ob(re));
|
|
|
|
eng_window_unsurf(eng_get_ob(re));
|
2013-05-20 02:09:50 -07:00
|
|
|
}
|
|
|
|
|
2009-03-24 02:05:32 -07:00
|
|
|
static int
|
2012-10-08 18:58:41 -07:00
|
|
|
eng_setup(Evas *eo_e, void *in)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-06-26 14:29:46 -07:00
|
|
|
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
2002-11-08 00:02:15 -08:00
|
|
|
Render_Engine *re;
|
2012-05-15 06:13:05 -07:00
|
|
|
Evas_Engine_Info_GL_X11 *info;
|
2014-07-04 04:51:32 -07:00
|
|
|
Render_Engine_Swap_Mode swap_mode = MODE_FULL;
|
2012-09-25 20:49:33 -07:00
|
|
|
const char *s;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
info = (Evas_Engine_Info_GL_X11 *)in;
|
2014-07-04 04:51:32 -07:00
|
|
|
|
|
|
|
if ((s = getenv("EVAS_GL_SWAP_MODE")))
|
|
|
|
{
|
|
|
|
if ((!strcasecmp(s, "full")) ||
|
|
|
|
(!strcasecmp(s, "f")))
|
|
|
|
swap_mode = MODE_FULL;
|
|
|
|
else if ((!strcasecmp(s, "copy")) ||
|
|
|
|
(!strcasecmp(s, "c")))
|
|
|
|
swap_mode = MODE_COPY;
|
|
|
|
else if ((!strcasecmp(s, "double")) ||
|
|
|
|
(!strcasecmp(s, "d")) ||
|
|
|
|
(!strcasecmp(s, "2")))
|
|
|
|
swap_mode = MODE_DOUBLE;
|
|
|
|
else if ((!strcasecmp(s, "triple")) ||
|
|
|
|
(!strcasecmp(s, "t")) ||
|
|
|
|
(!strcasecmp(s, "3")))
|
|
|
|
swap_mode = MODE_TRIPLE;
|
|
|
|
else if ((!strcasecmp(s, "quadruple")) ||
|
|
|
|
(!strcasecmp(s, "q")) ||
|
|
|
|
(!strcasecmp(s, "4")))
|
|
|
|
swap_mode = MODE_QUADRUPLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// in most gl implementations - egl and glx here that we care about the TEND
|
|
|
|
// to either swap or copy backbuffer and front buffer, but strictly that is
|
|
|
|
// not true. technically backbuffer content is totally undefined after a swap
|
|
|
|
// and thus you MUST re-render all of it, thus MODE_FULL
|
|
|
|
swap_mode = MODE_FULL;
|
|
|
|
// BUT... reality is that lmost every implementation copies or swaps so
|
|
|
|
// triple buffer mode can be used as it is a superset of double buffer and
|
|
|
|
// copy (though using those explicitly is more efficient). so let's play with
|
|
|
|
// triple buffer mdoe as a default and see.
|
|
|
|
// re->mode = MODE_TRIPLE;
|
|
|
|
// XXX: note - the above seems to break on some older intel chipsets and
|
|
|
|
// drivers. it seems we CANT depend on backbuffer staying around. bugger!
|
|
|
|
switch (info->swap_mode)
|
|
|
|
{
|
|
|
|
case EVAS_ENGINE_GL_X11_SWAP_MODE_FULL:
|
|
|
|
swap_mode = MODE_FULL;
|
|
|
|
break;
|
|
|
|
case EVAS_ENGINE_GL_X11_SWAP_MODE_COPY:
|
|
|
|
swap_mode = MODE_COPY;
|
|
|
|
break;
|
|
|
|
case EVAS_ENGINE_GL_X11_SWAP_MODE_DOUBLE:
|
|
|
|
swap_mode = MODE_DOUBLE;
|
|
|
|
break;
|
|
|
|
case EVAS_ENGINE_GL_X11_SWAP_MODE_TRIPLE:
|
|
|
|
swap_mode = MODE_TRIPLE;
|
|
|
|
break;
|
|
|
|
case EVAS_ENGINE_GL_X11_SWAP_MODE_QUADRUPLE:
|
|
|
|
swap_mode = MODE_QUADRUPLE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
swap_mode = MODE_AUTO;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (safe_native == -1)
|
|
|
|
{
|
|
|
|
s = getenv("EVAS_GL_SAFE_NATIVE");
|
|
|
|
safe_native = 0;
|
|
|
|
if (s) safe_native = atoi(s);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s = (const char *)glGetString(GL_RENDERER);
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
if (strstr(s, "PowerVR SGX 540") ||
|
|
|
|
strstr(s, "Mali-400 MP"))
|
|
|
|
safe_native = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set this env var to dump files every frame
|
|
|
|
// Or set the global var in gdb to 1|0 to turn it on and off
|
|
|
|
if (getenv("EVAS_GL_SWAP_BUFFER_DEBUG_ALWAYS"))
|
|
|
|
swap_buffer_debug = 1;
|
|
|
|
|
|
|
|
if (swap_buffer_debug_mode == -1)
|
|
|
|
{
|
|
|
|
if (
|
|
|
|
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
|
|
|
|
(getuid() == geteuid()) &&
|
|
|
|
#endif
|
|
|
|
((debug_dir = getenv("EVAS_GL_SWAP_BUFFER_DEBUG_DIR"))))
|
|
|
|
{
|
|
|
|
int stat;
|
|
|
|
// Create a directory with 0775 permission
|
|
|
|
stat = mkdir(debug_dir, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
|
|
|
|
if ((!stat) || errno == EEXIST) swap_buffer_debug_mode = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
swap_buffer_debug_mode = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!e->engine.data.output)
|
2006-12-09 00:52:08 -08:00
|
|
|
{
|
2014-07-04 04:51:32 -07:00
|
|
|
Outbuf *ob;
|
|
|
|
Render_Engine_Merge_Mode merge_mode = MERGE_BOUNDING;
|
2014-07-11 06:16:03 -07:00
|
|
|
|
|
|
|
if (!initted)
|
|
|
|
{
|
|
|
|
evas_common_cpu_init();
|
|
|
|
evas_common_blend_init();
|
|
|
|
evas_common_image_init();
|
|
|
|
evas_common_convert_init();
|
|
|
|
evas_common_scale_init();
|
|
|
|
evas_common_rectangle_init();
|
|
|
|
evas_common_polygon_init();
|
|
|
|
evas_common_line_init();
|
|
|
|
evas_common_font_init();
|
|
|
|
evas_common_draw_init();
|
|
|
|
evas_common_tilebuf_init();
|
|
|
|
glsym_evas_gl_preload_init();
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2012-05-15 06:13:05 -07:00
|
|
|
#else
|
|
|
|
int eb, evb;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
if (!glXQueryExtension(info->info.display, &eb, &evb)) return 0;
|
|
|
|
#endif
|
2011-11-10 00:59:09 -08:00
|
|
|
re = calloc(1, sizeof(Render_Engine));
|
|
|
|
if (!re) return 0;
|
2014-07-04 04:51:32 -07:00
|
|
|
ob = eng_window_new(info, eo_e,
|
|
|
|
info->info.display,
|
|
|
|
info->info.drawable,
|
|
|
|
info->info.screen,
|
|
|
|
info->info.visual,
|
|
|
|
info->info.colormap,
|
|
|
|
info->info.depth,
|
|
|
|
e->output.w, e->output.h,
|
|
|
|
info->indirect,
|
|
|
|
info->info.destination_alpha,
|
|
|
|
info->info.rotation,
|
|
|
|
swap_mode);
|
|
|
|
if (!ob)
|
2011-11-10 00:59:09 -08:00
|
|
|
{
|
|
|
|
free(re);
|
|
|
|
return 0;
|
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: Re: [E-devel] [E-Devel][Review][Patch] Evas GL Extensions + a
bug fix
Here's an initial attempt at the GL extensions issue for Evas GL.
I have been in discussion with a few EFL developers regarding how we should
provide extensions. Essentially, there are two ways to go about doing this.
1. provide evas_gl_proc_address_get() function as it is done in other
glue layers
2. provide all the extension functions in the EVAS_GL_API struct.
#1 approach is how it's done in other glue layers and the driver implementor can
provide new extensions easily. It is however pretty annoying to get the
function prototypes right and use the function pointers and etc.
#2 approach provides all the extension functions in the struct so it's
definitely easier to use. Adding new extensions can be a pain as people may
have to wait for new version releases.
For now, we thought it was OK to just throw them in the struct as in
#2 and try it out. So, I've implemented this approach. As for the extensions,
I've basically included all the extensions in gl2ext.h as EvasGL currently
provides all the GLES 2.0 functions. In order to display the right
information, I had to override glGetString() with GL_EXTENSIONS as parameter to properly
display the supported extensions.
Also, I've added a few EGL extensions that have been
modified for EvasGL use. For example, eglCreateImage/eglDestroyImage has been
defined as folllows.
EvasGLImage (*evasglCreateImage) (int target, void* buffer, int*
attrib_list); void
(*evasglDestroyImage)
(EvasGLImage image);
const char *evas_gl_string_query() function was added to return a string of
supported EvasGL extensions. So essentially, a user can search this string to see
if the desired extension is supported. if it is, he can use the functions. He can
always check if the function pointers are NULL as well.
Take a look at the pach and let me know what you think.
______________
While I was adding the extension code, I've added a few fixes/ changes
to the EvasGL.
1. glDeletBuffers bug
- When I wad destroying evasgl context, I was deleting the context FBO with
glDeleteBuffers instead of glDeleteFramebuffers. This code in effect was
deleting BOs in other contexts and we had some funky behaviors as a
result. The
bug has been fixed.
2. make_current
- I've made some changes to the make current code and also added a resource
context to the engine data. the resource context is used for creating surface
texture/ fbos when surface/ context is created. Before, i was using evas'
context but thought it'd be a good idea to use a separate context.
SVN revision: 64139
2011-10-18 01:13:23 -07:00
|
|
|
}
|
2014-07-04 04:51:32 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
|
|
|
|
eng_outbuf_swap_mode,
|
|
|
|
eng_outbuf_get_rot,
|
|
|
|
eng_outbuf_reconfigure,
|
|
|
|
eng_outbuf_region_first_rect,
|
|
|
|
eng_outbuf_new_region_for_update,
|
|
|
|
eng_outbuf_push_updated_region,
|
|
|
|
eng_outbuf_push_free_region_for_update,
|
|
|
|
NULL,
|
|
|
|
eng_outbuf_flush,
|
|
|
|
eng_window_free,
|
|
|
|
eng_window_use,
|
|
|
|
eng_outbuf_gl_context_get,
|
|
|
|
eng_outbuf_egl_display_get,
|
|
|
|
eng_gl_context_new,
|
|
|
|
eng_gl_context_use,
|
|
|
|
&evgl_funcs,
|
|
|
|
e->output.w, e->output.h))
|
2014-07-04 04:51:32 -07:00
|
|
|
{
|
|
|
|
free(re);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-21 04:37:02 -07:00
|
|
|
e->engine.data.output = re;
|
2010-05-17 21:22:33 -07:00
|
|
|
gl_wins++;
|
2012-09-24 00:41:27 -07:00
|
|
|
|
2014-07-04 04:51:32 -07:00
|
|
|
if ((s = getenv("EVAS_GL_PARTIAL_MERGE")))
|
|
|
|
{
|
|
|
|
if ((!strcmp(s, "bounding")) ||
|
|
|
|
(!strcmp(s, "b")))
|
|
|
|
merge_mode = MERGE_BOUNDING;
|
|
|
|
else if ((!strcmp(s, "full")) ||
|
|
|
|
(!strcmp(s, "f")))
|
|
|
|
merge_mode = MERGE_FULL;
|
|
|
|
}
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode);
|
2014-07-04 04:51:32 -07:00
|
|
|
|
2010-05-17 21:22:33 -07:00
|
|
|
if (!initted)
|
|
|
|
{
|
2013-03-11 23:26:32 -07:00
|
|
|
gl_extn_veto(re);
|
2013-05-20 02:09:50 -07:00
|
|
|
// evgl_engine_init(re, &evgl_funcs);
|
2010-05-17 21:22:33 -07:00
|
|
|
initted = 1;
|
|
|
|
}
|
2014-07-11 06:16:03 -07:00
|
|
|
|
2006-12-09 00:52:08 -08:00
|
|
|
}
|
2006-03-08 00:02:34 -08:00
|
|
|
else
|
|
|
|
{
|
2012-05-15 06:13:05 -07:00
|
|
|
re = e->engine.data.output;
|
2014-07-11 06:16:03 -07:00
|
|
|
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
|
2010-01-25 06:02:14 -08:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
if ((eng_get_ob(re)->info->info.display != eng_get_ob(re)->disp) ||
|
|
|
|
(eng_get_ob(re)->info->info.drawable != eng_get_ob(re)->win) ||
|
|
|
|
(eng_get_ob(re)->info->info.screen != eng_get_ob(re)->screen) ||
|
|
|
|
(eng_get_ob(re)->info->info.visual != eng_get_ob(re)->visual) ||
|
|
|
|
(eng_get_ob(re)->info->info.colormap != eng_get_ob(re)->colormap) ||
|
|
|
|
(eng_get_ob(re)->info->info.depth != eng_get_ob(re)->depth) ||
|
|
|
|
(eng_get_ob(re)->info->info.destination_alpha != eng_get_ob(re)->alpha))
|
2010-07-28 01:11:30 -07:00
|
|
|
{
|
2014-07-04 04:51:32 -07:00
|
|
|
Outbuf *ob;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
eng_get_ob(re)->gl_context->references++;
|
2014-05-27 22:32:39 -07:00
|
|
|
gl_wins--;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2014-07-04 04:51:32 -07:00
|
|
|
ob = eng_window_new(info, eo_e,
|
2014-07-11 06:16:03 -07:00
|
|
|
eng_get_ob(re)->info->info.display,
|
|
|
|
eng_get_ob(re)->info->info.drawable,
|
|
|
|
eng_get_ob(re)->info->info.screen,
|
|
|
|
eng_get_ob(re)->info->info.visual,
|
|
|
|
eng_get_ob(re)->info->info.colormap,
|
|
|
|
eng_get_ob(re)->info->info.depth,
|
2014-07-04 04:51:32 -07:00
|
|
|
e->output.w, e->output.h,
|
2014-07-11 06:16:03 -07:00
|
|
|
eng_get_ob(re)->info->indirect,
|
|
|
|
eng_get_ob(re)->info->info.destination_alpha,
|
|
|
|
eng_get_ob(re)->info->info.rotation,
|
2014-07-04 04:51:32 -07:00
|
|
|
swap_mode);
|
2014-07-08 01:59:58 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
eng_window_free(eng_get_ob(re));
|
|
|
|
re->generic.software.ob = NULL;
|
2014-07-08 01:59:58 -07:00
|
|
|
|
2014-07-04 04:51:32 -07:00
|
|
|
eng_window_use(ob);
|
|
|
|
if (ob)
|
2014-05-27 22:32:39 -07:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
evas_render_engine_software_generic_update(&re->generic.software, ob,
|
2014-07-04 04:51:32 -07:00
|
|
|
e->output.w, e->output.h);
|
|
|
|
|
2014-05-27 22:32:39 -07:00
|
|
|
gl_wins++;
|
2014-07-11 06:16:03 -07:00
|
|
|
eng_get_ob(re)->gl_context->references--;
|
2014-05-27 22:32:39 -07:00
|
|
|
}
|
2010-08-26 02:40:48 -07:00
|
|
|
}
|
2014-07-11 06:16:03 -07:00
|
|
|
else if ((eng_get_ob(re)->w != e->output.w) ||
|
|
|
|
(eng_get_ob(re)->h != e->output.h) ||
|
|
|
|
(eng_get_ob(re)->info->info.rotation != eng_get_ob(re)->rot))
|
2010-08-26 02:40:48 -07:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
eng_outbuf_reconfigure(eng_get_ob(re), e->output.w, e->output.h, eng_get_ob(re)->info->info.rotation, 0);
|
|
|
|
if (re->generic.software.tb)
|
|
|
|
evas_common_tilebuf_free(re->generic.software.tb);
|
|
|
|
re->generic.software.tb = evas_common_tilebuf_new(e->output.w, e->output.h);
|
|
|
|
if (re->generic.software.tb)
|
|
|
|
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
2014-07-04 04:51:32 -07:00
|
|
|
TILESIZE, TILESIZE);
|
2010-07-28 01:11:30 -07:00
|
|
|
}
|
2010-01-25 06:02:14 -08:00
|
|
|
}
|
2006-03-08 00:02:34 -08:00
|
|
|
}
|
2014-07-11 06:16:03 -07:00
|
|
|
if (!eng_get_ob(re))
|
2010-05-17 20:49:59 -07:00
|
|
|
{
|
|
|
|
free(re);
|
|
|
|
return 0;
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-17 20:49:59 -07:00
|
|
|
if (!e->engine.data.output)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
if (eng_get_ob(re))
|
2010-05-17 21:22:33 -07:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
eng_window_free(eng_get_ob(re));
|
2010-05-17 21:22:33 -07:00
|
|
|
gl_wins--;
|
|
|
|
}
|
2010-05-17 20:49:59 -07:00
|
|
|
free(re);
|
|
|
|
return 0;
|
|
|
|
}
|
2014-07-04 04:51:32 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
evas_render_engine_software_generic_tile_strict_set(&re->generic.software, EINA_TRUE);
|
2011-11-10 00:59:09 -08:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!e->engine.data.context)
|
2012-05-15 06:13:05 -07:00
|
|
|
e->engine.data.context =
|
|
|
|
e->engine.func->context_new(e->engine.data.output);
|
2014-07-11 06:16:03 -07:00
|
|
|
eng_window_use(eng_get_ob(re));
|
2012-06-27 01:19:25 -07:00
|
|
|
|
2009-03-24 02:05:32 -07:00
|
|
|
return 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_free(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-17 20:49:59 -07:00
|
|
|
if (re)
|
|
|
|
{
|
2014-07-04 04:51:32 -07:00
|
|
|
#ifndef GL_GLES
|
2014-07-11 06:16:03 -07:00
|
|
|
Display *disp = eng_get_ob(re)->disp;
|
|
|
|
Window win = eng_get_ob(re)->win;
|
2014-07-04 04:51:32 -07:00
|
|
|
#endif
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_preload_render_relax(eng_preload_make_current, eng_get_ob(re));
|
2013-06-23 19:41:32 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
#if 0
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2012-05-15 06:13:05 -07:00
|
|
|
// Destroy the resource surface
|
|
|
|
// Only required for EGL case
|
|
|
|
if (re->surface)
|
2014-07-11 06:16:03 -07:00
|
|
|
eglDestroySurface(eng_get_ob(re)->egl_disp, re->surface);
|
2012-05-15 06:13:05 -07:00
|
|
|
#endif
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
// Destroy the resource context
|
|
|
|
_destroy_internal_context(re, context);
|
|
|
|
#endif
|
2013-07-30 03:45:40 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
if (gl_wins == 1) glsym_evgl_engine_shutdown(re);
|
2014-07-04 04:51:32 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
evas_render_engine_software_generic_clean(&re->generic.software);
|
2014-07-04 04:51:32 -07:00
|
|
|
|
|
|
|
#ifndef GL_GLES
|
|
|
|
if (glsym_glXReleaseBuffersMESA)
|
|
|
|
glsym_glXReleaseBuffersMESA(disp, win);
|
2013-04-09 17:40:37 -07:00
|
|
|
#endif
|
2014-07-04 04:51:32 -07:00
|
|
|
gl_wins--;
|
2013-05-02 03:06:10 -07:00
|
|
|
|
2010-05-17 20:49:59 -07:00
|
|
|
free(re);
|
|
|
|
}
|
2010-05-17 21:22:33 -07:00
|
|
|
if ((initted == 1) && (gl_wins == 0))
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_preload_shutdown();
|
2010-05-17 21:22:33 -07:00
|
|
|
evas_common_image_shutdown();
|
|
|
|
evas_common_font_shutdown();
|
|
|
|
initted = 0;
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2007-03-03 08:05:15 -08:00
|
|
|
/* vsync games - not for now though */
|
2010-01-29 09:14:50 -08:00
|
|
|
#define VSYNC_TO_SCREEN 1
|
2007-03-03 08:05:15 -08:00
|
|
|
|
2014-07-04 04:51:32 -07:00
|
|
|
Eina_Bool
|
2013-06-23 19:41:32 -07:00
|
|
|
eng_preload_make_current(void *data, void *doit)
|
|
|
|
{
|
2014-07-04 04:51:32 -07:00
|
|
|
Outbuf *ob = data;
|
2013-06-23 19:41:32 -07:00
|
|
|
|
|
|
|
if (doit)
|
|
|
|
{
|
|
|
|
#ifdef GL_GLES
|
2014-07-04 04:51:32 -07:00
|
|
|
if (!eglMakeCurrent(ob->egl_disp, ob->egl_surface[0], ob->egl_surface[0], ob->egl_context[0]))
|
2013-06-23 19:41:32 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
#else
|
2014-07-04 04:51:32 -07:00
|
|
|
if (!glXMakeCurrent(ob->info->info.display, ob->win, ob->context))
|
2013-06-23 19:41:32 -07:00
|
|
|
{
|
2014-07-04 04:51:32 -07:00
|
|
|
ERR("glXMakeCurrent(%p, 0x%x, %p) failed", ob->info->info.display, (unsigned int)ob->win, (void *)ob->context);
|
2013-06-23 19:41:32 -07:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#ifdef GL_GLES
|
2014-07-04 04:51:32 -07:00
|
|
|
if (!eglMakeCurrent(ob->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT))
|
2013-06-23 19:41:32 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
#else
|
2014-07-04 04:51:32 -07:00
|
|
|
if (!glXMakeCurrent(ob->info->info.display, None, NULL))
|
2013-06-23 19:41:32 -07:00
|
|
|
{
|
2014-07-04 04:51:32 -07:00
|
|
|
ERR("glXMakeCurrent(%p, None, NULL) failed", ob->info->info.display);
|
2013-06-23 19:41:32 -07:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
static Eina_Bool
|
|
|
|
eng_canvas_alpha_get(void *data, void *info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
|
|
|
return re->generic.software.ob->alpha;
|
|
|
|
}
|
|
|
|
|
2010-04-12 01:23:53 -07:00
|
|
|
static void
|
|
|
|
eng_output_dump(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_common_image_image_all_unload();
|
|
|
|
evas_common_font_font_all_unload();
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_common_image_all_unload(eng_get_ob(re)->gl_context);
|
2010-08-26 02:40:48 -07:00
|
|
|
_re_winfree(re);
|
2007-06-16 19:56:59 -07:00
|
|
|
}
|
|
|
|
|
2010-01-21 00:44:11 -08:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
|
typedef struct _Native Native;
|
|
|
|
|
|
|
|
struct _Native
|
|
|
|
{
|
|
|
|
Evas_Native_Surface ns;
|
2012-05-15 06:13:05 -07:00
|
|
|
Pixmap pixmap;
|
|
|
|
Visual *visual;
|
|
|
|
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2012-05-15 06:13:05 -07:00
|
|
|
void *egl_surface;
|
|
|
|
#else
|
|
|
|
void *fbc;
|
|
|
|
XID glx_pixmap;
|
|
|
|
#endif
|
2010-01-21 00:44:11 -08:00
|
|
|
};
|
|
|
|
|
2010-01-23 21:11:54 -08:00
|
|
|
// FIXME: this is enabled so updates happen - but its SLOOOOOOOOOOOOOOOW
|
|
|
|
// (i am sure this is the reason) not to mention seemingly superfluous. but
|
|
|
|
// i need to enable it for it to work on fglrx at least. havent tried nvidia.
|
2011-06-17 00:47:28 -07:00
|
|
|
//
|
2010-01-23 21:11:54 -08:00
|
|
|
// why is this the case? does anyone know? has anyone tried it on other gfx
|
|
|
|
// drivers?
|
2011-06-17 00:47:28 -07:00
|
|
|
//
|
2010-01-30 18:50:01 -08:00
|
|
|
//#define GLX_TEX_PIXMAP_RECREATE 1
|
2010-01-23 21:11:54 -08:00
|
|
|
|
2010-01-21 00:44:11 -08:00
|
|
|
static void
|
2012-05-15 06:13:05 -07:00
|
|
|
_native_bind_cb(void *data, void *image)
|
2010-01-21 00:44:11 -08:00
|
|
|
{
|
2012-05-15 06:13:05 -07:00
|
|
|
Evas_GL_Image *im = image;
|
|
|
|
Native *n = im->native.data;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
if (n->ns.type == EVAS_NATIVE_SURFACE_X11)
|
|
|
|
{
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2011-12-17 21:03:24 -08:00
|
|
|
if (n->egl_surface)
|
|
|
|
{
|
|
|
|
if (glsym_glEGLImageTargetTexture2DOES)
|
|
|
|
{
|
|
|
|
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface);
|
|
|
|
if (eglGetError() != EGL_SUCCESS)
|
|
|
|
ERR("glEGLImageTargetTexture2DOES() failed.");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("Try glEGLImageTargetTexture2DOES on EGL with no support");
|
|
|
|
}
|
2012-05-15 06:13:05 -07:00
|
|
|
#else
|
|
|
|
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
|
|
|
Render_Engine *re = data;
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
if (glsym_glXBindTexImage)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_glXBindTexImage(eng_get_ob(re)->disp, n->glx_pixmap,
|
2012-05-15 06:13:05 -07:00
|
|
|
GLX_FRONT_LEFT_EXT, NULL);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("Try glXBindTexImage on GLX with no support");
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
|
|
|
|
{
|
|
|
|
glBindTexture(GL_TEXTURE_2D, n->ns.data.opengl.texture_id);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
return;
|
2014-05-07 15:14:10 -07:00
|
|
|
(void *) (data = NULL);
|
2010-01-21 00:44:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-15 06:13:05 -07:00
|
|
|
_native_unbind_cb(void *data, void *image)
|
2010-01-21 00:44:11 -08:00
|
|
|
{
|
2012-05-15 06:13:05 -07:00
|
|
|
Evas_GL_Image *im = image;
|
|
|
|
Native *n = im->native.data;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
if (n->ns.type == EVAS_NATIVE_SURFACE_X11)
|
|
|
|
{
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2012-05-15 06:13:05 -07:00
|
|
|
// nothing
|
|
|
|
#else
|
|
|
|
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
|
|
|
Render_Engine *re = data;
|
2011-12-17 21:03:24 -08:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
if (glsym_glXReleaseTexImage)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_glXReleaseTexImage(eng_get_ob(re)->disp, n->glx_pixmap,
|
2012-05-15 06:13:05 -07:00
|
|
|
GLX_FRONT_LEFT_EXT);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("Try glXReleaseTexImage on GLX with no support");
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
|
2011-12-17 21:03:24 -08:00
|
|
|
{
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2012-05-15 06:13:05 -07:00
|
|
|
return;
|
2014-05-07 15:14:10 -07:00
|
|
|
(void *) (data = NULL);
|
2010-01-21 00:44:11 -08:00
|
|
|
}
|
|
|
|
|
2006-12-17 07:48:52 -08:00
|
|
|
static void
|
2010-01-21 00:44:11 -08:00
|
|
|
_native_free_cb(void *data, void *image)
|
2006-12-17 07:48:52 -08:00
|
|
|
{
|
2012-05-15 06:13:05 -07:00
|
|
|
Render_Engine *re = data;
|
|
|
|
Evas_GL_Image *im = image;
|
|
|
|
Native *n = im->native.data;
|
|
|
|
uint32_t pmid, texid;
|
2010-12-05 23:09:51 -08:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
if (n->ns.type == EVAS_NATIVE_SURFACE_X11)
|
|
|
|
{
|
|
|
|
pmid = n->pixmap;
|
2014-07-11 06:16:03 -07:00
|
|
|
eina_hash_del(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2012-05-15 06:13:05 -07:00
|
|
|
if (n->egl_surface)
|
|
|
|
{
|
|
|
|
if (glsym_eglDestroyImage)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_eglDestroyImage(eng_get_ob(re)->egl_disp,
|
2012-05-15 06:13:05 -07:00
|
|
|
n->egl_surface);
|
|
|
|
if (eglGetError() != EGL_SUCCESS)
|
|
|
|
ERR("eglDestroyImage() failed.");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("Try eglDestroyImage on EGL with no support");
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
|
|
|
if (n->glx_pixmap)
|
|
|
|
{
|
|
|
|
if (im->native.loose)
|
|
|
|
{
|
|
|
|
if (glsym_glXReleaseTexImage)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_glXReleaseTexImage(eng_get_ob(re)->disp, n->glx_pixmap,
|
2012-05-15 06:13:05 -07:00
|
|
|
GLX_FRONT_LEFT_EXT);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("Try glXReleaseTexImage on GLX with no support");
|
|
|
|
}
|
|
|
|
if (glsym_glXDestroyPixmap)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_glXDestroyPixmap(eng_get_ob(re)->disp, n->glx_pixmap);
|
2012-05-15 06:13:05 -07:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("Try glXDestroyPixmap on GLX with no support");
|
|
|
|
n->glx_pixmap = 0;
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
|
|
|
|
{
|
|
|
|
texid = n->ns.data.opengl.texture_id;
|
2014-07-11 06:16:03 -07:00
|
|
|
eina_hash_del(eng_get_ob(re)->gl_context->shared->native_tex_hash, &texid, im);
|
2012-05-15 06:13:05 -07:00
|
|
|
}
|
|
|
|
im->native.data = NULL;
|
|
|
|
im->native.func.data = NULL;
|
|
|
|
im->native.func.bind = NULL;
|
|
|
|
im->native.func.unbind = NULL;
|
|
|
|
im->native.func.free = NULL;
|
|
|
|
free(n);
|
2010-01-21 00:44:11 -08:00
|
|
|
}
|
|
|
|
|
2010-08-02 23:09:53 -07:00
|
|
|
static void *
|
2010-01-21 00:44:11 -08:00
|
|
|
eng_image_native_set(void *data, void *image, void *native)
|
|
|
|
{
|
2012-05-15 06:13:05 -07:00
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
|
|
|
Evas_Native_Surface *ns = native;
|
|
|
|
Evas_GL_Image *im = image, *im2 = NULL;
|
|
|
|
Visual *vis = NULL;
|
|
|
|
Pixmap pm = 0;
|
|
|
|
Native *n = NULL;
|
|
|
|
uint32_t pmid, texid;
|
|
|
|
unsigned int tex = 0;
|
|
|
|
unsigned int fbo = 0;
|
|
|
|
|
|
|
|
if (!im)
|
|
|
|
{
|
2012-09-20 02:16:57 -07:00
|
|
|
if ((ns) && (ns->type == EVAS_NATIVE_SURFACE_OPENGL))
|
2012-05-15 06:13:05 -07:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
im = glsym_evas_gl_common_image_new_from_data(eng_get_ob(re)->gl_context,
|
2012-05-15 06:13:05 -07:00
|
|
|
ns->data.opengl.w,
|
|
|
|
ns->data.opengl.h,
|
|
|
|
NULL, 1,
|
|
|
|
EVAS_COLORSPACE_ARGB8888);
|
|
|
|
}
|
|
|
|
else
|
2012-09-20 02:16:57 -07:00
|
|
|
return NULL;
|
2012-05-15 06:13:05 -07:00
|
|
|
}
|
2011-12-17 21:03:24 -08:00
|
|
|
|
|
|
|
if (ns)
|
|
|
|
{
|
2012-05-15 06:13:05 -07:00
|
|
|
if (ns->type == EVAS_NATIVE_SURFACE_X11)
|
|
|
|
{
|
|
|
|
vis = ns->data.x11.visual;
|
|
|
|
pm = ns->data.x11.pixmap;
|
|
|
|
if (im->native.data)
|
|
|
|
{
|
|
|
|
Evas_Native_Surface *ens = im->native.data;
|
|
|
|
if ((ens->data.x11.visual == vis) &&
|
|
|
|
(ens->data.x11.pixmap == pm))
|
|
|
|
return im;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ns->type == EVAS_NATIVE_SURFACE_OPENGL)
|
2011-12-17 21:03:24 -08:00
|
|
|
{
|
|
|
|
tex = ns->data.opengl.texture_id;
|
|
|
|
fbo = ns->data.opengl.framebuffer_id;
|
|
|
|
if (im->native.data)
|
|
|
|
{
|
2012-05-15 06:13:05 -07:00
|
|
|
Evas_Native_Surface *ens = im->native.data;
|
|
|
|
if ((ens->data.opengl.texture_id == tex) &&
|
|
|
|
(ens->data.opengl.framebuffer_id == fbo))
|
|
|
|
return im;
|
2011-12-17 21:03:24 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((!ns) && (!im->native.data)) return im;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
eng_window_use(eng_get_ob(re));
|
2011-12-17 21:03:24 -08:00
|
|
|
|
|
|
|
if (im->native.data)
|
|
|
|
{
|
|
|
|
if (im->native.func.free)
|
|
|
|
im->native.func.free(im->native.func.data, im);
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_common_image_native_disable(im);
|
2011-12-17 21:03:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!ns) return im;
|
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
if (ns->type == EVAS_NATIVE_SURFACE_X11)
|
|
|
|
{
|
|
|
|
pmid = pm;
|
2014-07-11 06:16:03 -07:00
|
|
|
im2 = eina_hash_find(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid);
|
2012-05-15 06:13:05 -07:00
|
|
|
if (im2 == im) return im;
|
|
|
|
if (im2)
|
|
|
|
{
|
|
|
|
n = im2->native.data;
|
|
|
|
if (n)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_common_image_ref(im2);
|
|
|
|
glsym_evas_gl_common_image_free(im);
|
2012-05-15 06:13:05 -07:00
|
|
|
return im2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ns->type == EVAS_NATIVE_SURFACE_OPENGL)
|
2011-12-17 21:03:24 -08:00
|
|
|
{
|
|
|
|
texid = tex;
|
2014-07-11 06:16:03 -07:00
|
|
|
im2 = eina_hash_find(eng_get_ob(re)->gl_context->shared->native_tex_hash, &texid);
|
2011-12-17 21:03:24 -08:00
|
|
|
if (im2 == im) return im;
|
|
|
|
if (im2)
|
|
|
|
{
|
|
|
|
n = im2->native.data;
|
|
|
|
if (n)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_common_image_ref(im2);
|
|
|
|
glsym_evas_gl_common_image_free(im);
|
2011-12-17 21:03:24 -08:00
|
|
|
return im2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-07-11 06:16:03 -07:00
|
|
|
im2 = glsym_evas_gl_common_image_new_from_data(eng_get_ob(re)->gl_context,
|
2012-05-15 06:13:05 -07:00
|
|
|
im->w, im->h, NULL, im->alpha,
|
|
|
|
EVAS_COLORSPACE_ARGB8888);
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_common_image_free(im);
|
2012-05-15 06:13:05 -07:00
|
|
|
im = im2;
|
2012-08-07 23:25:59 -07:00
|
|
|
if (!im) return NULL;
|
2012-05-15 06:13:05 -07:00
|
|
|
if (ns->type == EVAS_NATIVE_SURFACE_X11)
|
|
|
|
{
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2012-05-15 06:13:05 -07:00
|
|
|
if (native)
|
|
|
|
{
|
|
|
|
n = calloc(1, sizeof(Native));
|
|
|
|
if (n)
|
|
|
|
{
|
|
|
|
EGLConfig egl_config;
|
|
|
|
int config_attrs[20];
|
|
|
|
int num_config, i = 0;
|
2013-11-28 01:18:16 -08:00
|
|
|
int yinvert = 1;
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
eina_hash_add(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
|
2012-05-15 06:13:05 -07:00
|
|
|
|
2012-08-07 23:25:59 -07:00
|
|
|
// assume 32bit pixmap! :)
|
2012-05-15 06:13:05 -07:00
|
|
|
config_attrs[i++] = EGL_RED_SIZE;
|
|
|
|
config_attrs[i++] = 8;
|
|
|
|
config_attrs[i++] = EGL_GREEN_SIZE;
|
|
|
|
config_attrs[i++] = 8;
|
|
|
|
config_attrs[i++] = EGL_BLUE_SIZE;
|
|
|
|
config_attrs[i++] = 8;
|
|
|
|
config_attrs[i++] = EGL_ALPHA_SIZE;
|
|
|
|
config_attrs[i++] = 8;
|
|
|
|
config_attrs[i++] = EGL_DEPTH_SIZE;
|
|
|
|
config_attrs[i++] = 0;
|
|
|
|
config_attrs[i++] = EGL_STENCIL_SIZE;
|
|
|
|
config_attrs[i++] = 0;
|
|
|
|
config_attrs[i++] = EGL_RENDERABLE_TYPE;
|
|
|
|
config_attrs[i++] = EGL_OPENGL_ES2_BIT;
|
|
|
|
config_attrs[i++] = EGL_SURFACE_TYPE;
|
|
|
|
config_attrs[i++] = EGL_PIXMAP_BIT;
|
|
|
|
config_attrs[i++] = EGL_NONE;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
if (!eglChooseConfig(eng_get_ob(re)->egl_disp, config_attrs,
|
2012-05-15 06:13:05 -07:00
|
|
|
&egl_config, 1, &num_config))
|
|
|
|
ERR("eglChooseConfig() failed for pixmap 0x%x, num_config = %i", (unsigned int)pm, num_config);
|
2013-11-28 01:18:16 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
if (extn_have_y_inverted &&
|
2014-07-11 06:16:03 -07:00
|
|
|
eglGetConfigAttrib(eng_get_ob(re)->egl_disp, egl_config,
|
2013-11-28 01:18:16 -08:00
|
|
|
EGL_Y_INVERTED_NOK, &val))
|
|
|
|
yinvert = val;
|
|
|
|
}
|
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
|
|
|
|
n->pixmap = pm;
|
|
|
|
n->visual = vis;
|
|
|
|
if (glsym_eglCreateImage)
|
2014-07-11 06:16:03 -07:00
|
|
|
n->egl_surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp,
|
2012-05-15 06:13:05 -07:00
|
|
|
EGL_NO_CONTEXT,
|
|
|
|
EGL_NATIVE_PIXMAP_KHR,
|
|
|
|
(void *)pm,
|
|
|
|
NULL);
|
|
|
|
else
|
|
|
|
ERR("Try eglCreateImage on EGL with no support");
|
|
|
|
if (!n->egl_surface)
|
|
|
|
ERR("eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm);
|
2013-11-28 01:18:16 -08:00
|
|
|
im->native.yinvert = yinvert;
|
2012-05-15 06:13:05 -07:00
|
|
|
im->native.loose = 0;
|
|
|
|
im->native.data = n;
|
|
|
|
im->native.func.data = re;
|
|
|
|
im->native.func.bind = _native_bind_cb;
|
|
|
|
im->native.func.unbind = _native_unbind_cb;
|
|
|
|
im->native.func.free = _native_free_cb;
|
|
|
|
im->native.target = GL_TEXTURE_2D;
|
|
|
|
im->native.mipmap = 0;
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_common_image_native_enable(im);
|
2012-05-15 06:13:05 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
2012-08-07 23:25:59 -07:00
|
|
|
if (native)
|
|
|
|
{
|
|
|
|
int dummy;
|
|
|
|
unsigned int w, h, depth = 32, border;
|
|
|
|
Window wdummy;
|
|
|
|
|
|
|
|
// fixme: round trip :(
|
2014-07-11 06:16:03 -07:00
|
|
|
XGetGeometry(eng_get_ob(re)->disp, pm, &wdummy, &dummy, &dummy,
|
2012-08-07 23:25:59 -07:00
|
|
|
&w, &h, &border, &depth);
|
|
|
|
if (depth <= 32)
|
|
|
|
{
|
|
|
|
n = calloc(1, sizeof(Native));
|
|
|
|
if (n)
|
|
|
|
{
|
2012-11-13 06:07:39 -08:00
|
|
|
int pixmap_att[20], i;
|
|
|
|
int config_attrs[40], num = 0;
|
|
|
|
int tex_format = 0, tex_target = 0, yinvert = 0, mipmap = 0;
|
2012-12-13 02:26:02 -08:00
|
|
|
unsigned int target = 0;
|
2012-11-13 06:07:39 -08:00
|
|
|
GLXFBConfig *configs;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
config_attrs[i++] = GLX_BUFFER_SIZE;
|
|
|
|
config_attrs[i++] = depth;
|
|
|
|
if (depth == 32)
|
|
|
|
{
|
|
|
|
config_attrs[i++] = GLX_BIND_TO_TEXTURE_RGBA_EXT;
|
|
|
|
config_attrs[i++] = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
config_attrs[i++] = GLX_BIND_TO_TEXTURE_RGB_EXT;
|
|
|
|
config_attrs[i++] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef GLX_VISUAL_ID
|
|
|
|
# define GLX_VISUAL_ID 0x800b
|
|
|
|
#endif
|
|
|
|
config_attrs[i++] = GLX_VISUAL_ID;
|
|
|
|
config_attrs[i++] = XVisualIDFromVisual(vis);
|
|
|
|
#ifndef GLX_SAMPLE_BUFFERS
|
|
|
|
# define GLX_SAMPLE_BUFFERS 0x186a0
|
|
|
|
#endif
|
|
|
|
config_attrs[i++] = GLX_SAMPLE_BUFFERS;
|
|
|
|
config_attrs[i++] = 0;
|
|
|
|
config_attrs[i++] = GLX_DEPTH_SIZE;
|
|
|
|
config_attrs[i++] = 0;
|
|
|
|
config_attrs[i++] = GLX_STENCIL_SIZE;
|
|
|
|
config_attrs[i++] = 0;
|
|
|
|
config_attrs[i++] = GLX_AUX_BUFFERS;
|
|
|
|
config_attrs[i++] = 0;
|
|
|
|
config_attrs[i++] = GLX_STEREO;
|
|
|
|
config_attrs[i++] = 0;
|
|
|
|
|
|
|
|
config_attrs[i++] = 0;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
configs = glXChooseFBConfig(eng_get_ob(re)->disp,
|
|
|
|
eng_get_ob(re)->screen,
|
2012-11-13 06:07:39 -08:00
|
|
|
config_attrs,
|
|
|
|
&num);
|
|
|
|
if (configs)
|
|
|
|
{
|
2013-04-18 04:29:55 -07:00
|
|
|
int j = 0, val = 0, found = 0;
|
2012-11-13 06:07:39 -08:00
|
|
|
|
2013-04-18 04:29:55 -07:00
|
|
|
try_again:
|
2013-04-18 01:16:41 -07:00
|
|
|
for (j = 0; j < num; j++)
|
2012-11-13 06:07:39 -08:00
|
|
|
{
|
2013-04-18 04:29:55 -07:00
|
|
|
if (found == 0)
|
|
|
|
{
|
2013-11-08 17:40:17 -08:00
|
|
|
XVisualInfo *vi;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
vi = glXGetVisualFromFBConfig(eng_get_ob(re)->disp, configs[j]);
|
2013-11-08 17:40:17 -08:00
|
|
|
if (!vi) continue;
|
2013-11-08 17:42:49 -08:00
|
|
|
if (vi->depth != (int)depth) continue;
|
2013-11-08 17:40:17 -08:00
|
|
|
XFree(vi);
|
2013-04-19 17:13:38 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
|
2013-04-18 04:29:55 -07:00
|
|
|
GLX_BUFFER_SIZE, &val);
|
2013-04-18 04:42:06 -07:00
|
|
|
if (val != (int) depth) continue;
|
2013-04-18 04:29:55 -07:00
|
|
|
}
|
2014-07-11 06:16:03 -07:00
|
|
|
glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
|
2013-04-18 01:16:41 -07:00
|
|
|
GLX_DRAWABLE_TYPE, &val);
|
|
|
|
if (!(val & GLX_PIXMAP_BIT)) continue;
|
|
|
|
tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
|
2014-07-11 06:16:03 -07:00
|
|
|
glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
|
2013-04-18 01:16:41 -07:00
|
|
|
GLX_ALPHA_SIZE, &val);
|
|
|
|
if ((depth == 32) && (!val)) continue;
|
|
|
|
if (val > 0)
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
|
2013-04-18 01:16:41 -07:00
|
|
|
GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
|
|
|
|
if (val) tex_format = GLX_TEXTURE_FORMAT_RGBA_EXT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
|
2013-04-18 01:16:41 -07:00
|
|
|
GLX_BIND_TO_TEXTURE_RGB_EXT, &val);
|
|
|
|
if (val) tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
|
|
|
|
}
|
2014-07-11 06:16:03 -07:00
|
|
|
glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
|
2013-04-18 01:16:41 -07:00
|
|
|
GLX_Y_INVERTED_EXT, &val);
|
|
|
|
yinvert = val;
|
2014-07-11 06:16:03 -07:00
|
|
|
glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
|
2013-04-18 01:16:41 -07:00
|
|
|
GLX_BIND_TO_TEXTURE_TARGETS_EXT,
|
|
|
|
&val);
|
|
|
|
tex_target = val;
|
2014-07-11 06:16:03 -07:00
|
|
|
glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
|
2013-04-18 01:16:41 -07:00
|
|
|
GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
|
|
|
|
mipmap = val;
|
|
|
|
n->fbc = configs[j];
|
2013-04-18 04:29:55 -07:00
|
|
|
found = 1;
|
2013-04-18 01:16:41 -07:00
|
|
|
break;
|
2012-11-13 06:07:39 -08:00
|
|
|
}
|
2013-04-18 04:29:55 -07:00
|
|
|
if (found == 0)
|
|
|
|
{
|
|
|
|
found = -1;
|
|
|
|
goto try_again;
|
|
|
|
}
|
2012-11-13 06:07:39 -08:00
|
|
|
XFree(configs);
|
|
|
|
}
|
2012-08-07 23:25:59 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
eina_hash_add(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
|
2012-11-13 06:07:39 -08:00
|
|
|
if ((tex_target & GLX_TEXTURE_2D_BIT_EXT))
|
2012-08-07 23:25:59 -07:00
|
|
|
target = GLX_TEXTURE_2D_EXT;
|
2014-02-13 02:35:17 -08:00
|
|
|
else if ((tex_target & GLX_TEXTURE_RECTANGLE_BIT_EXT))
|
2012-08-07 23:25:59 -07:00
|
|
|
{
|
|
|
|
ERR("rect!!! (not handled)");
|
|
|
|
target = GLX_TEXTURE_RECTANGLE_EXT;
|
|
|
|
}
|
|
|
|
if (!target)
|
|
|
|
{
|
|
|
|
ERR("broken tex-from-pixmap");
|
2012-11-13 06:07:39 -08:00
|
|
|
if (!(tex_target & GLX_TEXTURE_2D_BIT_EXT))
|
2012-08-07 23:25:59 -07:00
|
|
|
target = GLX_TEXTURE_RECTANGLE_EXT;
|
2012-11-13 06:07:39 -08:00
|
|
|
else if (!(tex_target & GLX_TEXTURE_RECTANGLE_BIT_EXT))
|
2012-08-07 23:25:59 -07:00
|
|
|
target = GLX_TEXTURE_2D_EXT;
|
|
|
|
}
|
|
|
|
|
2012-11-13 06:07:39 -08:00
|
|
|
i = 0;
|
2012-08-07 23:25:59 -07:00
|
|
|
pixmap_att[i++] = GLX_TEXTURE_FORMAT_EXT;
|
2012-11-13 06:07:39 -08:00
|
|
|
pixmap_att[i++] = tex_format;
|
2012-08-07 23:25:59 -07:00
|
|
|
pixmap_att[i++] = GLX_MIPMAP_TEXTURE_EXT;
|
2012-11-13 06:07:39 -08:00
|
|
|
pixmap_att[i++] = mipmap;
|
2012-08-07 23:25:59 -07:00
|
|
|
if (target)
|
|
|
|
{
|
|
|
|
pixmap_att[i++] = GLX_TEXTURE_TARGET_EXT;
|
|
|
|
pixmap_att[i++] = target;
|
|
|
|
}
|
|
|
|
pixmap_att[i++] = 0;
|
|
|
|
|
|
|
|
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
|
|
|
|
n->pixmap = pm;
|
|
|
|
n->visual = vis;
|
|
|
|
if (glsym_glXCreatePixmap)
|
2014-07-11 06:16:03 -07:00
|
|
|
n->glx_pixmap = glsym_glXCreatePixmap(eng_get_ob(re)->disp,
|
2012-08-07 23:25:59 -07:00
|
|
|
n->fbc,
|
|
|
|
n->pixmap,
|
|
|
|
pixmap_att);
|
|
|
|
else
|
|
|
|
ERR("Try glXCreatePixmap on GLX with no support");
|
|
|
|
if (n->glx_pixmap)
|
|
|
|
{
|
2012-11-12 06:45:07 -08:00
|
|
|
// printf("%p: new native texture for %x | %4i x %4i @ %2i = %p\n",
|
2012-08-07 23:25:59 -07:00
|
|
|
// n, pm, w, h, depth, n->glx_pixmap);
|
|
|
|
if (!target)
|
|
|
|
{
|
|
|
|
ERR("no target :(");
|
|
|
|
if (glsym_glXQueryDrawable)
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_glXQueryDrawable(eng_get_ob(re)->disp,
|
2012-08-07 23:25:59 -07:00
|
|
|
n->pixmap,
|
|
|
|
GLX_TEXTURE_TARGET_EXT,
|
|
|
|
&target);
|
|
|
|
}
|
|
|
|
if (target == GLX_TEXTURE_2D_EXT)
|
|
|
|
{
|
|
|
|
im->native.target = GL_TEXTURE_2D;
|
2012-11-13 06:07:39 -08:00
|
|
|
im->native.mipmap = mipmap;
|
2012-08-07 23:25:59 -07:00
|
|
|
}
|
2012-05-15 06:13:05 -07:00
|
|
|
# ifdef GL_TEXTURE_RECTANGLE_ARB
|
2012-08-07 23:25:59 -07:00
|
|
|
else if (target == GLX_TEXTURE_RECTANGLE_EXT)
|
|
|
|
{
|
|
|
|
im->native.target = GL_TEXTURE_RECTANGLE_ARB;
|
|
|
|
im->native.mipmap = 0;
|
|
|
|
}
|
2012-05-15 06:13:05 -07:00
|
|
|
# endif
|
2012-08-07 23:25:59 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
im->native.target = GL_TEXTURE_2D;
|
|
|
|
im->native.mipmap = 0;
|
|
|
|
ERR("still unknown target");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("GLX Pixmap create fail");
|
2012-11-13 06:07:39 -08:00
|
|
|
im->native.yinvert = yinvert;
|
2014-07-11 06:16:03 -07:00
|
|
|
im->native.loose = eng_get_ob(re)->detected.loose_binding;
|
2012-08-07 23:25:59 -07:00
|
|
|
im->native.data = n;
|
|
|
|
im->native.func.data = re;
|
|
|
|
im->native.func.bind = _native_bind_cb;
|
|
|
|
im->native.func.unbind = _native_unbind_cb;
|
|
|
|
im->native.func.free = _native_free_cb;
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_common_image_native_enable(im);
|
2012-08-07 23:25:59 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-05-15 06:13:05 -07:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (ns->type == EVAS_NATIVE_SURFACE_OPENGL)
|
2011-12-17 21:03:24 -08:00
|
|
|
{
|
|
|
|
if (native)
|
|
|
|
{
|
|
|
|
n = calloc(1, sizeof(Native));
|
|
|
|
if (n)
|
|
|
|
{
|
|
|
|
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
eina_hash_add(eng_get_ob(re)->gl_context->shared->native_tex_hash, &texid, im);
|
2011-12-17 21:03:24 -08:00
|
|
|
|
|
|
|
n->pixmap = 0;
|
2012-05-15 06:13:05 -07:00
|
|
|
n->visual = 0;
|
2012-09-23 20:33:43 -07:00
|
|
|
#ifdef GL_GLES
|
2011-12-17 21:03:24 -08:00
|
|
|
n->egl_surface = 0;
|
2012-05-15 06:13:05 -07:00
|
|
|
#else
|
|
|
|
n->fbc = 0;
|
|
|
|
n->glx_pixmap = 0;
|
|
|
|
#endif
|
2011-04-04 03:23:12 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
im->native.yinvert = 0;
|
|
|
|
im->native.loose = 0;
|
|
|
|
im->native.data = n;
|
|
|
|
im->native.func.data = re;
|
|
|
|
im->native.func.bind = _native_bind_cb;
|
2011-12-17 21:03:24 -08:00
|
|
|
im->native.func.unbind = _native_unbind_cb;
|
2012-05-15 06:13:05 -07:00
|
|
|
im->native.func.free = _native_free_cb;
|
|
|
|
im->native.target = GL_TEXTURE_2D;
|
|
|
|
im->native.mipmap = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-12-17 21:03:24 -08:00
|
|
|
// FIXME: need to implement mapping sub texture regions
|
|
|
|
// x, y, w, h for possible texture atlasing
|
2011-04-04 03:23:12 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
glsym_evas_gl_common_image_native_enable(im);
|
2011-12-17 21:03:24 -08:00
|
|
|
}
|
|
|
|
}
|
2012-05-15 05:03:01 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
}
|
2010-08-02 23:09:53 -07:00
|
|
|
return im;
|
2006-12-17 07:48:52 -08:00
|
|
|
}
|
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
static int
|
|
|
|
module_open(Evas_Module *em)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
static Eina_Bool xrm_inited = EINA_FALSE;
|
|
|
|
if (!xrm_inited)
|
2011-08-29 13:56:48 -07:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
xrm_inited = EINA_TRUE;
|
|
|
|
XrmInitialize();
|
2011-08-29 13:56:48 -07:00
|
|
|
}
|
2014-07-11 06:16:03 -07:00
|
|
|
if (!em) return 0;
|
|
|
|
/* get whatever engine module we inherit from */
|
|
|
|
if (!_evas_module_engine_inherit(&pfunc, "gl_generic")) return 0;
|
|
|
|
if (_evas_engine_GL_X11_log_dom < 0)
|
|
|
|
_evas_engine_GL_X11_log_dom = eina_log_domain_register
|
|
|
|
("evas-gl_x11", EVAS_DEFAULT_LOG_COLOR);
|
|
|
|
if (_evas_engine_GL_X11_log_dom < 0)
|
2003-09-04 00:40:34 -07:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
EINA_LOG_ERR("Can not create a module log domain.");
|
|
|
|
return 0;
|
2003-09-04 00:40:34 -07:00
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
if (partial_render_debug == -1)
|
2010-01-21 01:42:26 -08:00
|
|
|
{
|
2014-07-11 06:16:03 -07:00
|
|
|
if (getenv("EVAS_GL_PARTIAL_DEBUG")) partial_render_debug = 1;
|
|
|
|
else partial_render_debug = 0;
|
2010-01-21 01:42:26 -08:00
|
|
|
}
|
2011-08-16 00:06:36 -07:00
|
|
|
|
2014-07-11 06:16:03 -07:00
|
|
|
/* store it for later use */
|
|
|
|
func = pfunc;
|
|
|
|
/* now to override methods */
|
|
|
|
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
|
|
|
|
ORD(info);
|
|
|
|
ORD(info_free);
|
|
|
|
ORD(setup);
|
|
|
|
ORD(canvas_alpha_get);
|
|
|
|
ORD(output_free);
|
|
|
|
ORD(output_dump);
|
2011-08-16 00:06:36 -07:00
|
|
|
|
2006-12-09 00:52:08 -08:00
|
|
|
ORD(image_native_set);
|
2013-12-26 23:56:30 -08:00
|
|
|
|
2014-07-25 11:05:37 -07:00
|
|
|
gl_symbols();
|
|
|
|
|
2006-12-09 00:52:08 -08:00
|
|
|
/* now advertise out own api */
|
|
|
|
em->functions = (void *)(&func);
|
2006-01-14 04:13:38 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static void
|
2012-11-04 03:51:42 -08:00
|
|
|
module_close(Evas_Module *em EINA_UNUSED)
|
2006-01-14 04:13:38 -08:00
|
|
|
{
|
2012-05-15 06:13:05 -07:00
|
|
|
eina_log_domain_unregister(_evas_engine_GL_X11_log_dom);
|
2006-01-14 04:13:38 -08:00
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static Evas_Module_Api evas_modapi =
|
2006-01-14 04:13:38 -08:00
|
|
|
{
|
2012-05-15 06:13:05 -07:00
|
|
|
EVAS_MODULE_API_VERSION,
|
|
|
|
"gl_x11",
|
|
|
|
"none",
|
|
|
|
{
|
|
|
|
module_open,
|
|
|
|
module_close
|
|
|
|
}
|
2006-01-14 04:13:38 -08:00
|
|
|
};
|
2009-06-16 06:01:36 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, gl_x11);
|
2009-06-16 06:01:36 -07:00
|
|
|
|
2012-05-15 06:13:05 -07:00
|
|
|
#ifndef EVAS_STATIC_BUILD_GL_XLIB
|
|
|
|
EVAS_EINA_MODULE_DEFINE(engine, gl_x11);
|
2009-06-16 06:01:36 -07:00
|
|
|
#endif
|
2012-05-15 06:13:05 -07:00
|
|
|
|
|
|
|
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
|