|
From: Chris M. - E. G. <no-...@en...> - 2013-05-31 08:42:52
|
devilhorns pushed a commit to branch master.
commit a0ed1b5b5d0e01019e04547b9387b9c7a4a75bcb
Author: Chris Michael <cp....@sa...>
Date: Wed May 29 13:43:10 2013 +0100
Remove old wayland_egl engine code in prep for rewrite to use gl_common.
Signed-off-by: Chris Michael <cp....@sa...>
---
.../engines/wayland_egl/Evas_Engine_Wayland_Egl.h | 49 -
src/modules/evas/engines/wayland_egl/evas_engine.c | 3847 --------------------
src/modules/evas/engines/wayland_egl/evas_engine.h | 87 -
.../evas/engines/wayland_egl/evas_wl_main.c | 297 --
4 files changed, 4280 deletions(-)
diff --git a/src/modules/evas/engines/wayland_egl/Evas_Engine_Wayland_Egl.h b/src/modules/evas/engines/wayland_egl/Evas_Engine_Wayland_Egl.h
deleted file mode 100644
index ff5fcd8..0000000
--- a/src/modules/evas/engines/wayland_egl/Evas_Engine_Wayland_Egl.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef _EVAS_ENGINE_WAYLAND_EGL_H
-#define _EVAS_ENGINE_WAYLAND_EGL_H
-
-/*
- * Wayland supoprt is considered experimental as wayland itself is still
- * unstable and liable to change core protocol. If you use this api, it is
- * possible it will break in future, until this notice is removed.
- */
-
-#include <wayland-client.h>
-
-typedef struct _Evas_Engine_Info_Wayland_Egl Evas_Engine_Info_Wayland_Egl;
-
-struct _Evas_Engine_Info_Wayland_Egl
-{
- /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
- /* at you and make nasty noises */
- Evas_Engine_Info magic;
-
- /* engine specific data & parameters it needs to set up */
- struct {
- struct wl_display *display;
- struct wl_surface *surface;
- int depth;
- int screen;
- int rotation;
- int edges;
- unsigned int destination_alpha : 1;
- } info;
- /* engine specific function calls to query stuff about the destination */
- /* engine (what visual & colormap & depth to use, performance info etc. */
- struct {
- int (*best_depth_get) (Evas_Engine_Info_Wayland_Egl *einfo);
- } func;
-
- struct {
- void (*pre_swap) (void *data, Evas *e);
- void (*post_swap) (void *data, Evas *e);
-
- void *data; // data for callback calls
- } callback;
-
- /* non-blocking or blocking mode */
- Evas_Engine_Render_Mode render_mode;
-
- unsigned char vsync : 1; // does nothing right now
- unsigned char indirect : 1; // use indirect rendering
-};
-#endif
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c
deleted file mode 100644
index aa73bf4..0000000
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ /dev/null
@@ -1,3847 +0,0 @@
-#include "evas_common.h" /* Also includes international specific stuff */
-#include "evas_private.h"
-#include "evas_engine.h"
-
-#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
-
-#define EVAS_GL_NO_GL_H_CHECK 1
-#include "Evas_GL.h"
-
-typedef struct _Render_Engine Render_Engine;
-typedef struct _Render_Engine_GL_Surface Render_Engine_GL_Surface;
-typedef struct _Render_Engine_GL_Context Render_Engine_GL_Context;
-typedef struct _Render_Engine_GL_Resource Render_Engine_GL_Resource;
-typedef struct _Extension_Entry Extension_Entry;
-
-struct _Render_Engine
-{
- Evas_GL_Wl_Window *win;
- Evas_Engine_Info_Wayland_Egl *info;
- Evas *evas;
- Tilebuf *tb;
- int end;
- int w, h;
- int vsync;
- struct
- {
- int max_rb_size;
- int msaa_support;
- int msaa_samples[4];
-
- //---------//
- int rgb_888[4];
- int rgba_8888[4];
-
- int depth_8[4];
- int depth_16[4];
- int depth_24[4];
- int depth_32[4];
-
- int stencil_1[4];
- int stencil_2[4];
- int stencil_4[4];
- int stencil_8[4];
- int stencil_16[4];
-
- int depth_24_stencil_8[4];
- } gl_cap;
-
- int gl_cap_initted;
-};
-
-struct _Render_Engine_GL_Surface
-{
- int initialized;
- int fbo_attached;
- int w, h;
- int depth_bits;
- int stencil_bits;
-
- int direct_fb_opt;
-
- GLint rt_msaa_samples;
-
- // Render target texture/buffers
- GLuint rt_tex;
- GLint rt_internal_fmt;
- GLenum rt_fmt;
- GLuint rb_depth;
- GLenum rb_depth_fmt;
- GLuint rb_stencil;
- GLenum rb_stencil_fmt;
- GLuint rb_depth_stencil;
- GLenum rb_depth_stencil_fmt;
-
- EGLSurface direct_sfc;
-
- Render_Engine_GL_Context *current_ctx;
-};
-
-struct _Render_Engine_GL_Context
-{
- int initialized;
- EGLContext context;
- GLuint context_fbo;
- GLuint current_fbo;
-
- int scissor_enabled;
- int scissor_updated;
-
- Render_Engine_GL_Surface *current_sfc;
-};
-
-// Resources used per thread
-struct _Render_Engine_GL_Resource
-{
- // Resource context/surface per Thread in TLS for evasgl use
- EGLContext context;
- EGLSurface surface;
-};
-
-// Extension Handling
-struct _Extension_Entry
-{
- const char *name;
- const char *real_name;
- int supported;
-};
-
-static int initted = 0;
-static int gl_wins = 0;
-static int gl_direct_override = 0;
-static int gl_direct_enabled = 0;
-static Render_Engine_GL_Context *current_evgl_ctx;
-static Render_Engine *current_engine;
-static Evas_Object *gl_direct_img_obj = NULL; /* NEW */
-
-static int _ext_initted = 0; /* NEW */
-static char _gl_ext_string[1024];
-static char _evasgl_ext_string[1024];
-
-// Resource context/surface per Thread in TLS for evasgl use
-static Eina_TLS resource_key;
-static Eina_List *resource_list;
-LK(resource_lock);
-
-typedef void (*_eng_fn) (void);
-typedef _eng_fn (*glsym_func_eng_fn) ();
-typedef void (*glsym_func_void) ();
-typedef void *(*glsym_func_void_ptr) ();
-typedef int (*glsym_func_int) ();
-typedef unsigned int (*glsym_func_uint) ();
-typedef unsigned char (*glsym_func_uchar) ();
-typedef unsigned char *(*glsym_func_uchar_ptr) ();
-typedef const char *(*glsym_func_const_char_ptr) ();
-
-#ifndef EGL_NATIVE_PIXMAP_KHR
-# define EGL_NATIVE_PIXMAP_KHR 0x30b0
-#endif
-_eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
-void (*glsym_eglBindTexImage) (EGLDisplay a, EGLSurface b, int c) = NULL;
-void (*glsym_eglReleaseTexImage) (EGLDisplay a, EGLSurface b, int c) = 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;
-void (*glsym_glEGLImageTargetRenderbufferStorageOES) (int a, void *b) = NULL;
-void *(*glsym_eglMapImageSEC) (void *a, void *b, int c, int d) = NULL;
-unsigned int (*glsym_eglUnmapImageSEC) (void *a, void *b, int c) = NULL;
-const char *(*glsym_eglQueryString) (EGLDisplay a, int name) = NULL;
-
-unsigned int (*glsym_eglLockSurface) (EGLDisplay a, EGLSurface b, const int *attrib_list) = NULL;
-unsigned int (*glsym_eglUnlockSurface) (EGLDisplay a, EGLSurface b) = NULL;
-
-// GLES2 Extensions
-void (*glsym_glGetProgramBinaryOES) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary) = NULL;
-void (*glsym_glProgramBinaryOES) (GLuint program, GLenum binaryFormat, const void *binary, GLint length) = NULL;
-void* (*glsym_glMapBufferOES) (GLenum target, GLenum access) = NULL;
-unsigned char (*glsym_glUnmapBufferOES) (GLenum target) = NULL;
-void (*glsym_glGetBufferPointervOES) (GLenum target, GLenum pname, void** params) = NULL;
-void (*glsym_glTexImage3DOES) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels) = NULL;
-void (*glsym_glTexSubImage3DOES) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels) = NULL;
-void (*glsym_glCopyTexSubImage3DOES) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) = NULL;
-void (*glsym_glCompressedTexImage3DOES) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data) = NULL;
-void (*glsym_glCompressedTexSubImage3DOES) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data) = NULL;
-void (*glsym_glFramebufferTexture3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) = NULL;
-void (*glsym_glGetPerfMonitorGroupsAMD) (GLint* numGroups, GLsizei groupsSize, GLuint* groups) = NULL;
-void (*glsym_glGetPerfMonitorCountersAMD) (GLuint group, GLint* numCounters, GLint* maxActiveCounters, GLsizei counterSize, GLuint* counters) = NULL;
-void (*glsym_glGetPerfMonitorGroupStringAMD) (GLuint group, GLsizei bufSize, GLsizei* length, char* groupString) = NULL;
-void (*glsym_glGetPerfMonitorCounterStringAMD) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, char* counterString) = NULL;
-void (*glsym_glGetPerfMonitorCounterInfoAMD) (GLuint group, GLuint counter, GLenum pname, void* data) = NULL;
-void (*glsym_glGenPerfMonitorsAMD) (GLsizei n, GLuint* monitors) = NULL;
-void (*glsym_glDeletePerfMonitorsAMD) (GLsizei n, GLuint* monitors) = NULL;
-void (*glsym_glSelectPerfMonitorCountersAMD) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* countersList) = NULL;
-void (*glsym_glBeginPerfMonitorAMD) (GLuint monitor) = NULL;
-void (*glsym_glEndPerfMonitorAMD) (GLuint monitor) = NULL;
-void (*glsym_glGetPerfMonitorCounterDataAMD) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint* bytesWritten) = NULL;
-void (*glsym_glDiscardFramebufferEXT) (GLenum target, GLsizei numAttachments, const GLenum* attachments) = NULL;
-void (*glsym_glMultiDrawArraysEXT) (GLenum mode, GLint* first, GLsizei* count, GLsizei primcount) = NULL;
-void (*glsym_glMultiDrawElementsEXT) (GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount) = NULL;
-void (*glsym_glDeleteFencesNV) (GLsizei n, const GLuint* fences) = NULL;
-void (*glsym_glGenFencesNV) (GLsizei n, GLuint* fences) = NULL;
-unsigned char (*glsym_glIsFenceNV) (GLuint fence) = NULL;
-unsigned char (*glsym_glTestFenceNV) (GLuint fence) = NULL;
-void (*glsym_glGetFenceivNV) (GLuint fence, GLenum pname, GLint* params) = NULL;
-void (*glsym_glFinishFenceNV) (GLuint fence) = NULL;
-void (*glsym_glSetFenceNV) (GLuint, GLenum) = NULL;
-void (*glsym_glRenderbufferStorageMultisample) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) = NULL;
-void (*glsym_glFramebufferTexture2DMultisample) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) = NULL;
-void (*glsym_glGetDriverControlsQCOM) (GLint* num, GLsizei size, GLuint* driverControls) = NULL;
-void (*glsym_glGetDriverControlStringQCOM) (GLuint driverControl, GLsizei bufSize, GLsizei* length, char* driverControlString) = NULL;
-void (*glsym_glEnableDriverControlQCOM) (GLuint driverControl) = NULL;
-void (*glsym_glDisableDriverControlQCOM) (GLuint driverControl) = NULL;
-void (*glsym_glExtGetTexturesQCOM) (GLuint* textures, GLint maxTextures, GLint* numTextures) = NULL;
-void (*glsym_glExtGetBuffersQCOM) (GLuint* buffers, GLint maxBuffers, GLint* numBuffers) = NULL;
-void (*glsym_glExtGetRenderbuffersQCOM) (GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers) = NULL;
-void (*glsym_glExtGetFramebuffersQCOM) (GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers) = NULL;
-void (*glsym_glExtGetTexLevelParameterivQCOM) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params) = NULL;
-void (*glsym_glExtTexObjectStateOverrideiQCOM) (GLenum target, GLenum pname, GLint param) = NULL;
-void (*glsym_glExtGetTexSubImageQCOM) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void* texels) = NULL;
-void (*glsym_glExtGetBufferPointervQCOM) (GLenum target, void** params) = NULL;
-void (*glsym_glExtGetShadersQCOM) (GLuint* shaders, GLint maxShaders, GLint* numShaders) = NULL;
-void (*glsym_glExtGetProgramsQCOM) (GLuint* programs, GLint maxPrograms, GLint* numPrograms) = NULL;
-unsigned char (*glsym_glExtIsProgramBinaryQCOM) (GLuint program) = NULL;
-void (*glsym_glExtGetProgramBinarySourceQCOM) (GLuint program, GLenum shadertype, char* source, GLint* length) = NULL;
-
-
-//------ GLES 2.0 Extensions supported in EvasGL -----//
-static Extension_Entry _gl_ext_entries[] = {
- //--- Function Extensions ---//
- { "GL_OES_get_program_binary", "get_program_binary", 0 },
- { "GL_OES_mapbuffer", "mapbuffer", 0 },
- { "GL_OES_texture_3D", "texture_3D", 0 },
- { "AMD_performance_monitor", "AMD_performance_monitor", 0 },
- { "GL_EXT_discard_framebuffer", "discard_framebuffer", 0 },
- { "GL_EXT_multi_draw_arrays", "multi_draw_arrays", 0 },
- { "GL_NV_fence", "NV_fence", 0 },
- { "GL_QCOM_driver_control", "QCOM_driver_control", 0 },
- { "GL_QCOM_extended_get", "QCOM_extended_get", 0 },
- { "GL_QCOM_extended_get2", "QCOM_extended_get2", 0 },
-
- //--- Define Extensions ---//
- { "GL_OES_compressed_ETC1_RGB8_texture", "compressed_ETC1_RGB8_texture", 0 },
- { "GL_OES_compressed_paletted_texture", "compressed_paletted_texture", 0 },
- { "GL_OES_depth24", "depth24", 0 },
- { "GL_OES_depth32", "depth32", 0 },
- { "GL_OES_EvasGL_image", "EGL_image", 0 },
- { "GL_OES_packed_depth_stencil", "packed_depth_stencil", 0 },
- { "GL_OES_rgb8_rgba8", "rgb8_rgba8", 0 },
- { "GL_OES_standard_derivatives", "standard_derivatives", 0 },
- { "GL_OES_stencil1", "stencil1", 0 },
- { "GL_OES_stencil4", "stencil4", 0 },
- { "GL_OES_texture_float", "texture_float", 0 },
- { "GL_OES_texture_half_float", "texture_half_float", 0 },
- { "GL_OES_texture_half_float_linear", "texture_half_float_linear", 0 },
- { "GL_OES_texture_npot", "texture_npot", 0 },
- { "GL_OES_vertex_half_float", "vertex_half_float", 0 },
- { "GL_OES_vertex_type_10_10_10_2", "vertex_type_10_10_10_2", 0 },
- { "GL_AMD_compressed_3DC_texture", "compressed_3DC_texture", 0 },
- { "GL_AMD_compressed_ATC_texture", "compressed_ATC_texture", 0 },
- { "GL_AMD_program_binary_Z400", "program_binary_Z400", 0 },
- { "GL_EXT_blend_minmax", "blend_minmax", 0 },
- { "GL_EXT_read_format_bgra", "read_format_bgra", 0 },
- { "GL_EXT_texture_filter_anisotropic", "texture_filter_anisotrophic", 0 },
- { "GL_EXT_texture_format_BGRA8888", "texture_format_BGRA8888", 0 },
- { "GL_EXT_texture_type_2_10_10_10_REV", "texture_type_2_10_10_10_rev", 0 },
- { "GL_IMG_program_binary", "IMG_program_binary", 0 },
- { "GL_IMG_read_format", "IMG_read_format", 0 },
- { "GL_IMG_shader_binary", "IMG_shader_binary", 0 },
- { "GL_IMG_texture_compression_pvrtc", "IMG_texture_compression_pvrtc", 0 },
- { "GL_QCOM_perfmon_global_mode", "QCOM_perfmon_global_mode", 0 },
- { "GL_QCOM_writeonly_rendering", "QCOM_writeonly_rendering", 0 },
- { NULL, NULL, 0}
-};
-
-//------ Extensions supported in EvasGL -----//
-static Extension_Entry _evasgl_ext_entries[] = {
- { "EvasGL_KHR_image", "EGL_KHR_image", 0 },
- { "EvasGL_KHR_vg_parent_image", "EGL_KHR_vg_parent_image", 0 },
- { "EvasGL_KHR_gl_texture_2D_image", "EGL_KHR_gl_texture_2D_image", 0 },
- { "EvasGL_KHR_gl_texture_cubemap_image", "EGL_KHR_gl_texture_cubemap_image", 0 },
- { "EvasGL_KHR_gl_texture_3D_image", "EGL_KHR_gl_texture_3D_image", 0 },
- { "EvasGL_KHR_gl_renderbuffer_image", "EGL_KHR_gl_renderbuffer_image", 0 },
- { NULL, NULL, 0 }
-};
-
-static void
-_sym_init(void)
-{
- static int done = 0;
-
- if (done) return;
-
-#define FINDSYM(dst, sym, typ) \
- if (glsym_eglGetProcAddress) { \
- if (!dst) dst = (typ)glsym_eglGetProcAddress(sym); \
- } \
- if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym);
-
- FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
- FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn);
- FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressARB", glsym_func_eng_fn);
- FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressKHR", glsym_func_eng_fn);
-
- FINDSYM(glsym_eglBindTexImage, "eglBindTexImage", glsym_func_void);
- FINDSYM(glsym_eglBindTexImage, "eglBindTexImageEXT", glsym_func_void);
- FINDSYM(glsym_eglBindTexImage, "eglBindTexImageARB", glsym_func_void);
- FINDSYM(glsym_eglBindTexImage, "eglBindTexImageKHR", glsym_func_void);
-
- FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImage", glsym_func_void);
- FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageEXT", glsym_func_void);
- FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageARB", glsym_func_void);
- FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageKHR", glsym_func_void);
-
- FINDSYM(glsym_eglCreateImage, "eglCreateImage", glsym_func_void_ptr);
- FINDSYM(glsym_eglCreateImage, "eglCreateImageEXT", glsym_func_void_ptr);
- FINDSYM(glsym_eglCreateImage, "eglCreateImageARB", glsym_func_void_ptr);
- FINDSYM(glsym_eglCreateImage, "eglCreateImageKHR", glsym_func_void_ptr);
-
- FINDSYM(glsym_eglDestroyImage, "eglDestroyImage", glsym_func_void);
- FINDSYM(glsym_eglDestroyImage, "eglDestroyImageEXT", glsym_func_void);
- FINDSYM(glsym_eglDestroyImage, "eglDestroyImageARB", glsym_func_void);
- FINDSYM(glsym_eglDestroyImage, "eglDestroyImageKHR", glsym_func_void);
-
- FINDSYM(glsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES", glsym_func_void);
-
- FINDSYM(glsym_glEGLImageTargetRenderbufferStorageOES, "glEGLImageTargetRenderbufferStorageOES", glsym_func_void);
-
- FINDSYM(glsym_eglMapImageSEC, "eglMapImageSEC", glsym_func_void_ptr);
- FINDSYM(glsym_eglUnmapImageSEC, "eglUnmapImageSEC", glsym_func_uint);
-
- FINDSYM(glsym_eglQueryString, "eglQueryString", glsym_func_const_char_ptr);
-
- FINDSYM(glsym_eglLockSurface, "eglLockSurface", glsym_func_uint);
- FINDSYM(glsym_eglLockSurface, "eglLockSurfaceEXT", glsym_func_uint);
- FINDSYM(glsym_eglLockSurface, "eglLockSurfaceARB", glsym_func_uint);
- FINDSYM(glsym_eglLockSurface, "eglLockSurfaceKHR", glsym_func_uint);
-
- FINDSYM(glsym_eglUnlockSurface, "eglUnlockSurface", glsym_func_uint);
- FINDSYM(glsym_eglUnlockSurface, "eglUnlockSurfaceEXT", glsym_func_uint);
- FINDSYM(glsym_eglUnlockSurface, "eglUnlockSurfaceARB", glsym_func_uint);
- FINDSYM(glsym_eglUnlockSurface, "eglUnlockSurfaceKHR", glsym_func_uint);
-
- //----------- GLES 2.0 Extensions ------------//
- // If the symbol's not found, they get set to NULL
- // If one of the functions in the extension exists, the extension in supported
- /* GL_OES_get_program_binary */
- FINDSYM(glsym_glGetProgramBinaryOES, "glGetProgramBinary", glsym_func_void);
- FINDSYM(glsym_glGetProgramBinaryOES, "glGetProgramBinaryEXT", glsym_func_void);
- FINDSYM(glsym_glGetProgramBinaryOES, "glGetProgramBinaryARB", glsym_func_void);
- FINDSYM(glsym_glGetProgramBinaryOES, "glGetProgramBinaryOES", glsym_func_void);
-
- FINDSYM(glsym_glProgramBinaryOES, "glProgramBinary", glsym_func_void);
- FINDSYM(glsym_glProgramBinaryOES, "glProgramBinaryEXT", glsym_func_void);
- FINDSYM(glsym_glProgramBinaryOES, "glProgramBinaryARB", glsym_func_void);
- FINDSYM(glsym_glProgramBinaryOES, "glProgramBinaryOES", glsym_func_void);
-
- // Check the first function to see if the extension is supported...
- if (glsym_glGetProgramBinaryOES) _gl_ext_entries[0].supported = 1;
-
- /* GL_OES_mapbuffer */
- FINDSYM(glsym_glMapBufferOES, "glMapBuffer", glsym_func_void_ptr);
- FINDSYM(glsym_glMapBufferOES, "glMapBufferEXT", glsym_func_void_ptr);
- FINDSYM(glsym_glMapBufferOES, "glMapBufferARB", glsym_func_void_ptr);
- FINDSYM(glsym_glMapBufferOES, "glMapBufferOES", glsym_func_void_ptr);
-
- FINDSYM(glsym_glUnmapBufferOES, "glUnmapBuffer", glsym_func_uchar);
- FINDSYM(glsym_glUnmapBufferOES, "glUnmapBufferEXT", glsym_func_uchar);
- FINDSYM(glsym_glUnmapBufferOES, "glUnmapBufferARB", glsym_func_uchar);
- FINDSYM(glsym_glUnmapBufferOES, "glUnmapBufferOES", glsym_func_uchar);
-
- FINDSYM(glsym_glGetBufferPointervOES, "glGetBufferPointerv", glsym_func_void);
- FINDSYM(glsym_glGetBufferPointervOES, "glGetBufferPointervEXT", glsym_func_void);
- FINDSYM(glsym_glGetBufferPointervOES, "glGetBufferPointervARB", glsym_func_void);
- FINDSYM(glsym_glGetBufferPointervOES, "glGetBufferPointervOES", glsym_func_void);
-
- if (glsym_glMapBufferOES) _gl_ext_entries[1].supported = 1;
-
- /* GL_OES_texture_3D */
- FINDSYM(glsym_glTexImage3DOES, "glTexImage3D", glsym_func_void);
- FINDSYM(glsym_glTexImage3DOES, "glTexImage3DEXT", glsym_func_void);
- FINDSYM(glsym_glTexImage3DOES, "glTexImage3DARB", glsym_func_void);
- FINDSYM(glsym_glTexImage3DOES, "glTexImage3DOES", glsym_func_void);
-
- FINDSYM(glsym_glTexSubImage3DOES, "glTexSubImage3D", glsym_func_void);
- FINDSYM(glsym_glTexSubImage3DOES, "glTexSubImage3DEXT", glsym_func_void);
- FINDSYM(glsym_glTexSubImage3DOES, "glTexSubImage3DARB", glsym_func_void);
- FINDSYM(glsym_glTexSubImage3DOES, "glTexSubImage3DOES", glsym_func_void);
-
- FINDSYM(glsym_glCopyTexSubImage3DOES, "glCopyTexSubImage3D", glsym_func_void);
- FINDSYM(glsym_glCopyTexSubImage3DOES, "glCopyTexSubImage3DARB", glsym_func_void);
- FINDSYM(glsym_glCopyTexSubImage3DOES, "glCopyTexSubImage3DEXT", glsym_func_void);
- FINDSYM(glsym_glCopyTexSubImage3DOES, "glCopyTexSubImage3DOES", glsym_func_void);
-
- FINDSYM(glsym_glCompressedTexImage3DOES, "glCompressedTexImage3D", glsym_func_void);
- FINDSYM(glsym_glCompressedTexImage3DOES, "glCompressedTexImage3DARB", glsym_func_void);
- FINDSYM(glsym_glCompressedTexImage3DOES, "glCompressedTexImage3DEXT", glsym_func_void);
- FINDSYM(glsym_glCompressedTexImage3DOES, "glCompressedTexImage3DOES", glsym_func_void);
-
- FINDSYM(glsym_glCompressedTexSubImage3DOES, "glCompressedTexSubImage3D", glsym_func_void);
- FINDSYM(glsym_glCompressedTexSubImage3DOES, "glCompressedTexSubImage3DARB", glsym_func_void);
- FINDSYM(glsym_glCompressedTexSubImage3DOES, "glCompressedTexSubImage3DEXT", glsym_func_void);
- FINDSYM(glsym_glCompressedTexSubImage3DOES, "glCompressedTexSubImage3DOES", glsym_func_void);
-
- FINDSYM(glsym_glFramebufferTexture3DOES, "glFramebufferTexture3D", glsym_func_void);
- FINDSYM(glsym_glFramebufferTexture3DOES, "glFramebufferTexture3DARB", glsym_func_void);
- FINDSYM(glsym_glFramebufferTexture3DOES, "glFramebufferTexture3DEXT", glsym_func_void);
- FINDSYM(glsym_glFramebufferTexture3DOES, "glFramebufferTexture3DOES", glsym_func_void);
-
- if (glsym_glTexSubImage3DOES) _gl_ext_entries[2].supported = 1;
-
- /* AMD_performance_monitor */
- FINDSYM(glsym_glGetPerfMonitorGroupsAMD, "glGetPerfMonitorGroupsAMD", glsym_func_void);
- FINDSYM(glsym_glGetPerfMonitorCountersAMD, "glGetPerfMonitorCountersAMD", glsym_func_void);
- FINDSYM(glsym_glGetPerfMonitorGroupStringAMD, "glGetPerfMonitorGroupStringAMD", glsym_func_void);
- FINDSYM(glsym_glGetPerfMonitorCounterStringAMD, "glGetPerfMonitorCounterStringAMD", glsym_func_void);
- FINDSYM(glsym_glGetPerfMonitorCounterInfoAMD, "glGetPerfMonitorCounterInfoAMD", glsym_func_void);
- FINDSYM(glsym_glGenPerfMonitorsAMD, "glGenPerfMonitorsAMD", glsym_func_void);
- FINDSYM(glsym_glDeletePerfMonitorsAMD, "glDeletePerfMonitorsAMD", glsym_func_void);
- FINDSYM(glsym_glSelectPerfMonitorCountersAMD, "glSelectPerfMonitorCountersAMD", glsym_func_void);
- FINDSYM(glsym_glBeginPerfMonitorAMD, "glBeginPerfMonitorAMD", glsym_func_void);
- FINDSYM(glsym_glEndPerfMonitorAMD, "glEndPerfMonitorAMD", glsym_func_void);
- FINDSYM(glsym_glGetPerfMonitorCounterDataAMD, "glGetPerfMonitorCounterDataAMD", glsym_func_void);
-
- if (glsym_glGetPerfMonitorGroupsAMD) _gl_ext_entries[3].supported = 1;
-
- /* GL_EXT_discard_framebuffer */
- FINDSYM(glsym_glDiscardFramebufferEXT, "glDiscardFramebuffer", glsym_func_void);
- FINDSYM(glsym_glDiscardFramebufferEXT, "glDiscardFramebufferARB", glsym_func_void);
- FINDSYM(glsym_glDiscardFramebufferEXT, "glDiscardFramebufferEXT", glsym_func_void);
-
- if (glsym_glDiscardFramebufferEXT) _gl_ext_entries[4].supported = 1;
-
- /* GL_EXT_multi_draw_arrays */
- FINDSYM(glsym_glMultiDrawArraysEXT, "glMultiDrawArrays", glsym_func_void);
- FINDSYM(glsym_glMultiDrawArraysEXT, "glMultiDrawArraysARB", glsym_func_void);
- FINDSYM(glsym_glMultiDrawArraysEXT, "glMultiDrawArraysEXT", glsym_func_void);
-
- FINDSYM(glsym_glMultiDrawElementsEXT, "glMultiDrawElements", glsym_func_void);
- FINDSYM(glsym_glMultiDrawElementsEXT, "glMultiDrawElementsARB", glsym_func_void);
- FINDSYM(glsym_glMultiDrawElementsEXT, "glMultiDrawElementsEXT", glsym_func_void);
-
- if (glsym_glMultiDrawArraysEXT) _gl_ext_entries[5].supported = 1;
-
- /* GL_NV_fence */
- FINDSYM(glsym_glDeleteFencesNV, "glDeleteFencesNV", glsym_func_void);
- FINDSYM(glsym_glGenFencesNV, "glGenFencesNV", glsym_func_void);
- FINDSYM(glsym_glIsFenceNV, "glIsFenceNV", glsym_func_uchar);
- FINDSYM(glsym_glTestFenceNV, "glTestFenceNV", glsym_func_uchar);
- FINDSYM(glsym_glGetFenceivNV, "glGetFenceivNV", glsym_func_void);
- FINDSYM(glsym_glFinishFenceNV, "glFinishFenceNV", glsym_func_void);
- FINDSYM(glsym_glSetFenceNV, "glSetFenceNV", glsym_func_void);
-
- if (glsym_glDeleteFencesNV) _gl_ext_entries[6].supported = 1;
-
- /* GL_QCOM_driver_control */
- FINDSYM(glsym_glGetDriverControlsQCOM, "glGetDriverControlsQCOM", glsym_func_void);
- FINDSYM(glsym_glGetDriverControlStringQCOM, "glGetDriverControlStringQCOM", glsym_func_void);
- FINDSYM(glsym_glEnableDriverControlQCOM, "glEnableDriverControlQCOM", glsym_func_void);
- FINDSYM(glsym_glDisableDriverControlQCOM, "glDisableDriverControlQCOM", glsym_func_void);
-
- if (glsym_glGetDriverControlsQCOM) _gl_ext_entries[7].supported = 1;
-
- /* GL_QCOM_extended_get */
- FINDSYM(glsym_glExtGetTexturesQCOM, "glExtGetTexturesQCOM", glsym_func_void);
- FINDSYM(glsym_glExtGetBuffersQCOM, "glExtGetBuffersQCOM", glsym_func_void);
- FINDSYM(glsym_glExtGetRenderbuffersQCOM, "glExtGetRenderbuffersQCOM", glsym_func_void);
- FINDSYM(glsym_glExtGetFramebuffersQCOM, "glExtGetFramebuffersQCOM", glsym_func_void);
- FINDSYM(glsym_glExtGetTexLevelParameterivQCOM, "glExtGetTexLevelParameterivQCOM", glsym_func_void);
- FINDSYM(glsym_glExtTexObjectStateOverrideiQCOM, "glExtTexObjectStateOverrideiQCOM", glsym_func_void);
- FINDSYM(glsym_glExtGetTexSubImageQCOM, "glExtGetTexSubImageQCOM", glsym_func_void);
- FINDSYM(glsym_glExtGetBufferPointervQCOM, "glExtGetBufferPointervQCOM", glsym_func_void);
-
- if (glsym_glExtGetTexturesQCOM) _gl_ext_entries[8].supported = 1;
-
- /* GL_QCOM_extended_get2 */
- FINDSYM(glsym_glExtGetShadersQCOM, "glExtGetShadersQCOM", glsym_func_void);
- FINDSYM(glsym_glExtGetProgramsQCOM, "glExtGetProgramsQCOM", glsym_func_void);
- FINDSYM(glsym_glExtIsProgramBinaryQCOM, "glExtIsProgramBinaryQCOM", glsym_func_uchar);
- FINDSYM(glsym_glExtGetProgramBinarySourceQCOM, "glExtGetProgramBinarySourceQCOM", glsym_func_void);
-
- if (glsym_glExtGetShadersQCOM) _gl_ext_entries[9].supported = 1;
-}
-
-static void
-_extensions_init(Render_Engine *re)
-{
- int i;
- const char *glexts, *evasglexts;
-
- memset(_gl_ext_string, 0, 1024);
- memset(_evasgl_ext_string, 0, 1024);
-
- // GLES 2.0 Extensions
- glexts = (const char*)glGetString(GL_EXTENSIONS);
-
- DBG("--------GLES 2.0 Extensions--------");
- for (i = 0; _gl_ext_entries[i].name != NULL; i++)
- {
- if ( (strstr(glexts, _gl_ext_entries[i].name) != NULL) ||
- (strstr(glexts, _gl_ext_entries[i].real_name) != NULL) )
- {
- _gl_ext_entries[i].supported = 1;
- strcat(_gl_ext_string, _gl_ext_entries[i].name);
- strcat(_gl_ext_string, " ");
- DBG("\t%s", _gl_ext_entries[i].name);
- }
-
- }
- DBG(" ");
-
- // EGL Extensions
- evasglexts = glsym_eglQueryString(re->win->egl_disp, EGL_EXTENSIONS);
-
- DBG("--------EvasGL Extensions----------");
- for (i = 0; _evasgl_ext_entries[i].name != NULL; i++)
- {
- if ( (strstr(evasglexts, _evasgl_ext_entries[i].name) != NULL) ||
- (strstr(evasglexts, _evasgl_ext_entries[i].real_name) != NULL) )
- {
- _evasgl_ext_entries[i].supported = 1;
- strcat(_evasgl_ext_string, _evasgl_ext_entries[i].name);
- strcat(_evasgl_ext_string, " ");
- DBG("\t%s", _evasgl_ext_entries[i].name);
- }
- }
- DBG(" ");
-}
-
-int _evas_engine_wl_egl_log_dom = -1;
-
-/* function tables - filled in later (func and parent func) */
-static Evas_Func func, pfunc;
-
-/* Function table for GL APIs */
-static Evas_GL_API gl_funcs;
-
-static void *
-eng_info(Evas *e EINA_UNUSED)
-{
- Evas_Engine_Info_Wayland_Egl *info;
-
- info = calloc(1, sizeof(Evas_Engine_Info_Wayland_Egl));
- info->magic.magic = rand();
- info->func.best_depth_get = eng_best_depth_get;
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
-
- return info;
-}
-
-static void
-eng_info_free(Evas *e EINA_UNUSED, void *info)
-{
- Evas_Engine_Info_Wayland_Egl *in;
-// dont free! why bother? its not worth it
-// eina_log_domain_unregister(_evas_engine_GL_X11_log_dom);
- in = (Evas_Engine_Info_Wayland_Egl *)info;
- free(in);
-}
-
-static int
-_re_wincheck(Render_Engine *re)
-{
- if (!re) return 0;
- if (!re->win) return 0;
- if (re->win->surf) return 1;
- eng_window_resurf(re->win);
- if (!re->win->surf)
- {
- ERR("GL engine can't re-create window surface!");
- }
- return 0;
-}
-
-static void
-_re_winfree(Render_Engine *re)
-{
- if (!re->win->surf) return;
- eng_window_unsurf(re->win);
-}
-
-static Render_Engine_GL_Resource *
-_create_internal_glue_resources(void *data)
-{
- Render_Engine *re;
- Render_Engine_GL_Resource *rsc;
-
- if (!(re = (Render_Engine *)data)) return NULL;
-
- rsc = calloc(1, sizeof(Render_Engine_GL_Resource));
- if (!rsc) return NULL;
-
- // EGL
- int context_attrs[3];
- context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
- context_attrs[1] = 2;
- context_attrs[2] = EGL_NONE;
-
- // Create resource surface for EGL
- if (re->win->egl_surface[0])
- rsc->surface = re->win->egl_surface[0];
- else
- {
- rsc->surface =
- eglCreateWindowSurface(re->win->egl_disp, re->win->egl_config,
- (EGLNativeWindowType)re->win->win, NULL);
- }
-
- if (!rsc->surface)
- {
- ERR("Creating internal resource surface failed.");
- free(rsc);
- return NULL;
- }
-
- // Create a resource context for EGL
- rsc->context =
- eglCreateContext(re->win->egl_disp, re->win->egl_config,
- re->win->egl_context[0], context_attrs);
- if (!rsc->context)
- {
- ERR("Internal Resource Context Creations Failed.");
- free(rsc);
- return NULL;
- }
-
- // Add to the resource resource list for cleanup
- LKL(resource_lock);
- resource_list = eina_list_prepend(resource_list, rsc);
- LKU(resource_lock);
-
- // Set the resource in TLS
- if (eina_tls_set(resource_key, (void*)rsc) == EINA_FALSE)
- {
- ERR("Failed setting TLS Resource");
- free(rsc);
- return NULL;
- }
-
- return rsc;
-}
-
-static int
-_destroy_internal_glue_resources(void *data)
-{
- Render_Engine *re = (Render_Engine *)data;
- Eina_List *l;
- Render_Engine_GL_Resource *rsc;
-
- // EGL
- // Delete the Resources
- LKL(resource_lock);
- EINA_LIST_FOREACH(resource_list, l, rsc)
- {
- if (rsc->surface) eglDestroySurface(re->win->egl_disp, rsc->surface);
- if (rsc->context) eglDestroyContext(re->win->egl_disp, rsc->context);
- free(rsc);
- }
- eina_list_free(resource_list);
- resource_list = NULL;
- LKU(resource_lock);
-
- // Destroy TLS
- eina_tls_free(resource_key);
-
- return 1;
-}
-
-static int
-eng_setup(Evas *eo_e, void *in)
-{
- Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CLASS);
- Render_Engine *re;
- Evas_Engine_Info_Wayland_Egl *info;
- Evas_GL_Wl_Window *new_win = NULL;
-
- info = (Evas_Engine_Info_Wayland_Egl *)in;
- if (!e->engine.data.output)
- {
- re = calloc(1, sizeof(Render_Engine));
- if (!re) return 0;
- re->info = info;
- re->evas = eo_e;
- e->engine.data.output = re;
- re->w = e->output.w;
- re->h = e->output.h;
-
- re->win = eng_window_new(re->info->info.display,
- re->info->info.surface,
- re->info->info.screen,
- re->info->info.depth, re->w, re->h,
- re->info->indirect,
- re->info->info.destination_alpha,
- re->info->info.rotation);
- if (!re->win)
- {
- free(re);
- e->engine.data.output = NULL;
- return 0;
- }
-
- gl_wins++;
- 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();
-
- // Initialize TLS
- if (eina_tls_new(&resource_key) == EINA_FALSE)
- ERR("Error creating tls key");
-
- DBG("TLS KEY create... %d", resource_key);
-
- initted = 1;
- }
- }
- else
- {
- if (!(re = e->engine.data.output)) return 0;
- if (_re_wincheck(re))
- {
- if ((re->info->info.display != re->win->disp) ||
- (re->info->info.surface != re->win->surface) ||
- (re->info->info.screen != re->win->screen) ||
- (re->info->info.depth != re->win->depth) ||
- (re->info->info.destination_alpha != re->win->alpha) ||
- (re->info->info.rotation != re->win->rot))
- {
- int inc = 0;
-
- /* if we already have a window surface, check for NULL input surface.
- * this will mean we are hiding the window and should destroy
- * things properly */
- if ((re->win->surface) && (re->info->info.surface == NULL))
- {
- if (re->win)
- {
- eng_window_free(re->win);
- gl_wins--;
- re->win = NULL;
- }
- return 1;
- }
-
- new_win = eng_window_new(re->info->info.display,
- re->info->info.surface,
- re->info->info.screen,
- re->info->info.depth,
- e->output.w, e->output.h,
- re->info->indirect,
- re->info->info.destination_alpha,
- re->info->info.rotation);
-
- if (new_win)
- {
- // free old win
- if (re->win)
- {
- re->win->gl_context->references++;
- eng_window_free(re->win);
- inc = 1;
- gl_wins--;
- }
-
- re->win = new_win;
- re->w = e->output.w;
- re->h = e->output.h;
-
- eng_window_use(re->win);
- if (re->win) gl_wins++;
- if ((re->win) && (inc))
- re->win->gl_context->references--;
- }
- }
- else if ((re->win->w != e->output.w) ||
- (re->win->h != e->output.h))
- {
- re->w = e->output.w;
- re->h = e->output.h;
- re->win->w = e->output.w;
- re->win->h = e->output.h;
- eng_window_use(re->win);
- evas_gl_common_context_resize(re->win->gl_context,
- re->win->w, re->win->h,
- re->win->rot);
- }
- }
- }
-
- if (!re->win)
- {
- free(re);
- e->engine.data.output = NULL;
- return 0;
- }
-
- if (!e->engine.data.output)
- {
- if (re->win)
- {
- eng_window_free(re->win);
- gl_wins--;
- }
- free(re);
- e->engine.data.output = NULL;
- return 0;
- }
- re->tb = evas_common_tilebuf_new(re->win->w, re->win->h);
- if (!re->tb)
- {
- if (re->win)
- {
- eng_window_free(re->win);
- gl_wins--;
- }
- free(re);
- e->engine.data.output = NULL;
- return 0;
- }
- evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
-
- if (!e->engine.data.context)
- {
- e->engine.data.context =
- e->engine.func->context_new(e->engine.data.output);
- }
-
- eng_window_use(re->win);
-
- re->vsync = 0;
- if (!_ext_initted)
- {
- _sym_init();
- _extensions_init(re);
- _ext_initted = 1;
- }
-
- // This is used in extensions. Not pretty but can't get display otherwise.
- current_engine = re;
-
- return 1;
-}
-
-static void
-eng_output_free(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
-
- if (re)
- {
-#if 0
- // Destroy the resource surface
- // Only required for EGL case
- if (re->surface)
- eglDestroySurface(re->win->egl_disp, re->surface);
-
- // Destroy the resource context
- _destroy_internal_context(re, context);
-#endif
- if (re->win)
- {
- if ((initted == 1) && (gl_wins == 1))
- _destroy_internal_glue_resources(re);
- eng_window_free(re->win);
- gl_wins--;
- }
- evas_common_tilebuf_free(re->tb);
- free(re);
- }
- if ((initted == 1) && (gl_wins == 0))
- {
- evas_common_image_shutdown();
- evas_common_font_shutdown();
- initted = 0;
- }
-}
-
-static void
-eng_output_resize(void *data, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- if ((!re) || (!re->win)) return;
-
- re->win->w = w;
- re->win->h = h;
- eng_window_use(re->win);
-
- if (re->win->win)
- {
- int aw, ah, dx = 0, dy = 0;
-
- if ((re->win->rot == 90) || (re->win->rot == 270))
- wl_egl_window_get_attached_size(re->win->win, &ah, &aw);
- else
- wl_egl_window_get_attached_size(re->win->win, &aw, &ah);
-
- if (re->info->info.edges & 4) // resize from left
- {
- if ((re->win->rot == 90) || (re->win->rot == 270))
- dx = ah - h;
- else
- dx = aw - w;
- }
- if (re->info->info.edges & 1) // resize from top
- {
- if ((re->win->rot == 90) || (re->win->rot == 270))
- dy = aw - w;
- else
- dy = ah - h;
- }
-
- if ((re->win->rot == 90) || (re->win->rot == 270))
- wl_egl_window_resize(re->win->win, h, w, dx, dy);
- else
- wl_egl_window_resize(re->win->win, w, h, dx, dy);
- }
-
- evas_gl_common_context_resize(re->win->gl_context, w, h, re->win->rot);
- evas_common_tilebuf_free(re->tb);
- re->tb = evas_common_tilebuf_new(w, h);
- if (re->tb)
- evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
-}
-
-static void
-eng_output_tile_size_set(void *data, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_tilebuf_set_tile_size(re->tb, w, h);
-}
-
-static void
-eng_output_redraws_rect_add(void *data, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- if ((!re) || (!re->win)) return;
-
- eng_window_use(re->win);
- evas_gl_common_context_resize(re->win->gl_context, re->win->w, re->win->h, re->win->rot);
- evas_common_tilebuf_add_redraw(re->tb, x, y, w, h);
-
- RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, re->win->w, re->win->h);
- if ((w <= 0) || (h <= 0)) return;
- if (!re->win->draw.redraw)
- {
-#if 1
- re->win->draw.x1 = x;
- re->win->draw.y1 = y;
- re->win->draw.x2 = x + w - 1;
- re->win->draw.y2 = y + h - 1;
-#else
- re->win->draw.x1 = 0;
- re->win->draw.y1 = 0;
- re->win->draw.x2 = re->win->w - 1;
- re->win->draw.y2 = re->win->h - 1;
-#endif
- }
- else
- {
- if (x < re->win->draw.x1) re->win->draw.x1 = x;
- if (y < re->win->draw.y1) re->win->draw.y1 = y;
- if ((x + w - 1) > re->win->draw.x2) re->win->draw.x2 = x + w - 1;
- if ((y + h - 1) > re->win->draw.y2) re->win->draw.y2 = y + h - 1;
- }
- re->win->draw.redraw = 1;
-}
-
-static void
-eng_output_redraws_rect_del(void *data, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_tilebuf_del_redraw(re->tb, x, y, w, h);
-}
-
-static void
-eng_output_redraws_clear(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_tilebuf_clear(re->tb);
-/* re->win->draw.redraw = 0;*/
-// INF("GL: finish update cycle!");
-}
-
-/* vsync games - not for now though */
-#define VSYNC_TO_SCREEN 1
-
-static void *
-eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch)
-{
- Render_Engine *re;
- Tilebuf_Rect *rects;
-
- re = (Render_Engine *)data;
- /* get the upate rect surface - return engine data as dummy */
- rects = evas_common_tilebuf_get_render_rects(re->tb);
- if (rects)
- {
- evas_common_tilebuf_free_render_rects(rects);
- evas_common_tilebuf_clear(re->tb);
- eng_window_use(re->win);
- if (!_re_wincheck(re)) return NULL;
- evas_gl_common_context_flush(re->win->gl_context);
- evas_gl_common_context_newframe(re->win->gl_context);
- if (x) *x = 0;
- if (y) *y = 0;
- if (w) *w = re->win->w;
- if (h) *h = re->win->h;
- if (cx) *cx = 0;
- if (cy) *cy = 0;
- if (cw) *cw = re->win->w;
- if (ch) *ch = re->win->h;
- return re->win->gl_context->def_surface;
- }
- return NULL;
-}
-
-//#define FRAMECOUNT 1
-
-#ifdef FRAMECOUNT
-static double
-get_time(void)
-{
- struct timeval timev;
-
- gettimeofday(&timev, NULL);
- return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
-}
-#endif
-
-static int safe_native = -1;
-
-static void
-eng_output_redraws_next_update_push(void *data, void *surface EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED, Evas_Render_Mode render_mode)
-{
- Render_Engine *re;
-#ifdef FRAMECOUNT
- static double pt = 0.0;
- double ta, tb;
-#endif
-
- if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return;
-
- re = (Render_Engine *)data;
- /* put back update surface.. in this case just unflag redraw */
- if (!_re_wincheck(re)) return;
- re->win->draw.redraw = 0;
- re->win->draw.drew = 1;
- evas_gl_common_context_flush(re->win->gl_context);
- if (safe_native == -1)
- {
- const char *s;
-
- 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;
- }
- }
- }
- // this is needed to make sure all previous rendering is flushed to
- // buffers/surfaces
-# ifdef FRAMECOUNT
- double t0 = get_time();
- ta = t0 - pt;
- pt = t0;
-# endif
- // previous rendering should be done and swapped
- if (!safe_native) eglWaitNative(EGL_CORE_NATIVE_ENGINE);
-# ifdef FRAMECOUNT
- double t1 = get_time();
- tb = t1 - t0;
- printf("... %1.5f -> %1.5f | ", ta, tb);
-# endif
- if (eglGetError() != EGL_SUCCESS)
- {
- printf("Error: eglWaitNative(EGL_CORE_NATIVE_ENGINE) fail.\n");
- }
-}
-
-static void
-eng_output_flush(void *data, Evas_Render_Mode render_mode)
-{
- Render_Engine *re;
-
- if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return;
-
- re = (Render_Engine *)data;
- if (!_re_wincheck(re)) return;
- if (!re->win->draw.drew) return;
-//x// printf("frame -> flush\n");
- re->win->draw.drew = 0;
- eng_window_use(re->win);
-
-# ifdef FRAMECOUNT
- double t0 = get_time();
-# endif
-
- if (!re->vsync)
- {
- if (re->info->vsync) eglSwapInterval(re->win->egl_disp, 1);
- else eglSwapInterval(re->win->egl_disp, 0);
- re->vsync = 1;
- }
-
- if (re->info->callback.pre_swap)
- re->info->callback.pre_swap(re->info->callback.data, re->evas);
-
- eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]);
- if (!safe_native) eglWaitGL();
-
- if (re->info->callback.post_swap)
- re->info->callback.post_swap(re->info->callback.data, re->evas);
-
- if (eglGetError() != EGL_SUCCESS)
- printf("Error: eglSwapBuffers() fail.\n");
-
-# ifdef FRAMECOUNT
- double t1 = get_time();
- printf("%1.5f\n", t1 - t0);
-# endif
-}
-
-static void
-eng_output_idle_flush(void *data EINA_UNUSED)
-{
- /* Render_Engine *re; */
-
- /* re = (Render_Engine *)data; */
-}
-
-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();
- evas_gl_common_image_all_unload(re->win->gl_context);
- _re_winfree(re);
-}
-
-static void
-eng_context_cutout_add(void *data EINA_UNUSED, void *context, int x, int y, int w, int h)
-{
-// Render_Engine *re;
-//
-// re = (Render_Engine *)data;
-// re->win->gl_context->dc = context;
- evas_common_draw_context_add_cutout(context, x, y, w, h);
-}
-
-static void
-eng_context_cutout_clear(void *data EINA_UNUSED, void *context)
-{
-// Render_Engine *re;
-//
-// re = (Render_Engine *)data;
-// re->win->gl_context->dc = context;
- evas_common_draw_context_clear_cutouts(context);
-}
-
-static void
-eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h, Eina_Bool do_async EINA_UNUSED)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- eng_window_use(re->win);
- evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
- re->win->gl_context->dc = context;
- evas_gl_common_rect_draw(re->win->gl_context, x, y, w, h);
-}
-
-static void
-eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2, Eina_Bool do_async EINA_UNUSED)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- eng_window_use(re->win);
- evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
- re->win->gl_context->dc = context;
- evas_gl_common_line_draw(re->win->gl_context, x1, y1, x2, y2);
-}
-
-static void *
-eng_polygon_point_add(void *data EINA_UNUSED, void *context EINA_UNUSED, void *polygon, int x, int y)
-{
- /* Render_Engine *re; */
-
- /* re = (Render_Engine *)data; */
- return evas_gl_common_poly_point_add(polygon, x, y);
-}
-
-static void *
-eng_polygon_points_clear(void *data EINA_UNUSED, void *context EINA_UNUSED, void *polygon)
-{
- /* Render_Engine *re; */
-
- /* re = (Render_Engine *)data; */
- return evas_gl_common_poly_points_clear(polygon);
-}
-
-static void
-eng_polygon_draw(void *data, void *context, void *surface EINA_UNUSED, void *polygon, int x, int y, Eina_Bool do_async EINA_UNUSED)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- eng_window_use(re->win);
- evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
- re->win->gl_context->dc = context;
- evas_gl_common_poly_draw(re->win->gl_context, polygon, x, y);
-}
-
-static int
-eng_image_alpha_get(void *data EINA_UNUSED, void *image)
-{
-// Render_Engine *re;
- Evas_GL_Image *im;
-
-// re = (Render_Engine *)data;
- if (!image) return 1;
- im = image;
- return im->alpha;
-}
-
-static int
-eng_image_colorspace_get(void *data EINA_UNUSED, void *image)
-{
-// Render_Engine *re;
- Evas_GL_Image *im;
-
-// re = (Render_Engine *)data;
- if (!image) return EVAS_COLORSPACE_ARGB8888;
- im = image;
- return im->cs.space;
-}
-
-static void *
-eng_image_alpha_set(void *data, void *image, int has_alpha)
-{
- Render_Engine *re;
- Evas_GL_Image *im;
-
- re = (Render_Engine *)data;
- if (!image) return NULL;
- im = image;
- if (im->alpha == has_alpha) return image;
- if (im->native.data)
- {
- im->alpha = has_alpha;
- return image;
- }
- eng_window_use(re->win);
- if ((im->tex) && (im->tex->pt->dyn.img))
- {
- im->alpha = has_alpha;
- im->tex->alpha = im->alpha;
- return image;
- }
- /* FIXME: can move to gl_common */
- if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im;
- if ((has_alpha) && (im->im->cache_entry.flags.alpha)) return image;
- else if ((!has_alpha) && (!im->im->cache_entry.flags.alpha)) return image;
- if (im->references > 1)
- {
- Evas_GL_Image *im_new;
-
- if (!im->im->image.data)
- evas_cache_image_load_data(&im->im->cache_entry);
- im_new = evas_gl_common_image_new_from_copied_data
- (im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
- im->im->image.data,
- eng_image_alpha_get(data, image),
- eng_image_colorspace_get(data, image));
- if (!im_new) return im;
- evas_gl_common_image_free(im);
- im = im_new;
- }
- else
- evas_gl_common_image_dirty(im, 0, 0, 0, 0);
- return evas_gl_common_image_alpha_set(im, has_alpha ? 1 : 0);
-// im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
-// return image;
-}
-
-static void *
-eng_image_border_set(void *data EINA_UNUSED, void *image, int l EINA_UNUSED, int r EINA_UNUSED, int t EINA_UNUSED, int b EINA_UNUSED)
-{
-// Render_Engine *re;
-//
-// re = (Render_Engine *)data;
- return image;
-}
-
-static void
-eng_image_border_get(void *data EINA_UNUSED, void *image EINA_UNUSED, int *l EINA_UNUSED, int *r EINA_UNUSED, int *t EINA_UNUSED, int *b EINA_UNUSED)
-{
-// Render_Engine *re;
-//
-// re = (Render_Engine *)data;
-}
-
-static char *
-eng_image_comment_get(void *data EINA_UNUSED, void *image, char *key EINA_UNUSED)
-{
-// Render_Engine *re;
- Evas_GL_Image *im;
-
-// re = (Render_Engine *)data;
- if (!image) return NULL;
- im = image;
- if (!im->im) return NULL;
- return im->im->info.comment;
-}
-
-static char *
-eng_image_format_get(void *data EINA_UNUSED, void *image EINA_UNUSED)
-{
-// Render_Engine *re;
- /* Evas_GL_Image *im; */
-
-// re = (Render_Engine *)data;
- /* im = image; */
- return NULL;
-}
-
-static void
-eng_image_colorspace_set(void *data, void *image, int cspace)
-{
- Render_Engine *re;
- Evas_GL_Image *im;
-
- re = (Render_Engine *)data;
- if (!image) return;
- im = image;
- if (im->native.data) return;
- /* FIXME: can move to gl_common */
- if (im->cs.space == cspace) return;
- eng_window_use(re->win);
- evas_cache_image_colorspace(&im->im->cache_entry, cspace);
- switch (cspace)
- {
- case EVAS_COLORSPACE_ARGB8888:
- if (im->cs.data)
- {
- if (!im->cs.no_free) free(im->cs.data);
- im->cs.data = NULL;
- im->cs.no_free = 0;
- }
- break;
- case EVAS_COLORSPACE_YCBCR422P601_PL:
- case EVAS_COLORSPACE_YCBCR422P709_PL:
- case EVAS_COLORSPACE_YCBCR422601_PL:
- case EVAS_COLORSPACE_YCBCR420NV12601_PL:
- case EVAS_COLORSPACE_YCBCR420TM12601_PL:
- if (im->tex) evas_gl_common_texture_free(im->tex);
- im->tex = NULL;
- if (im->cs.data)
- {
- if (!im->cs.no_free) free(im->cs.data);
- }
- if (im->im->cache_entry.h > 0)
- im->cs.data =
- calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2);
- else
- im->cs.data = NULL;
- im->cs.no_free = 0;
- break;
- default:
- abort();
- break;
- }
- im->cs.space = cspace;
-}
-
-/////////////////////////////////////////////////////////////////////////
-//
-//
-typedef struct _Native Native;
-
-struct _Native
-{
- Evas_Native_Surface ns;
- struct wl_egl_pixmap *pixmap;
-
- void *egl_surface;
-};
-
-// 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.
-//
-// why is this the case? does anyone know? has anyone tried it on other gfx
-// drivers?
-//
-//#define GLX_TEX_PIXMAP_RECREATE 1
-
-static void
-_native_bind_cb(void *data EINA_UNUSED, void *image)
-{
- Evas_GL_Image *im = image;
- Native *n = im->native.data;
-
- if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
- {
- glBindTexture(GL_TEXTURE_2D, n->ns.data.opengl.texture_id);
- GLERR(__FUNCTION__, __FILE__, __LINE__, "");
- }
-}
-
-static void
-_native_unbind_cb(void *data EINA_UNUSED, void *image)
-{
- Evas_GL_Image *im = image;
- Native *n = im->native.data;
-
- if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
- {
- glBindTexture(GL_TEXTURE_2D, 0);
- GLERR(__FUNCTION__, __FILE__, __LINE__, "");
- }
-}
-
-static void
-_native_free_cb(void *data, void *image)
-{
- Render_Engine *re = data;
- Evas_GL_Image *im = image;
- Native *n = im->native.data;
- uint32_t texid;
-
- if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
- {
- texid = n->ns.data.opengl.texture_id;
- eina_hash_del(re->win->gl_context->shared->native_tex_hash, &texid, im);
- }
- 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);
-}
-
-static void *
-eng_image_native_set(void *data, void *image, void *native)
-{
- Render_Engine *re = (Render_Engine *)data;
- Evas_Native_Surface *ns = native;
- Evas_GL_Image *im = image, *im2 = NULL;
- Native *n = NULL;
- uint32_t texid;
- unsigned int tex = 0;
- unsigned int fbo = 0;
-
- if (ns && ns->type != EVAS_NATIVE_SURFACE_OPENGL) return NULL;
-
- if (!im)
- {
- if ((ns) && (ns->type == EVAS_NATIVE_SURFACE_OPENGL))
- {
- im = evas_gl_common_image_new_from_data(re->win->gl_context,
- ns->data.opengl.w,
- ns->data.opengl.h,
- NULL, 1,
- EVAS_COLORSPACE_ARGB8888);
- }
- else
- return NULL;
- }
-
- if (ns)
- {
- tex = ns->data.opengl.texture_id;
- fbo = ns->data.opengl.framebuffer_id;
- if (im->native.data)
- {
- Evas_Native_Surface *ens = im->native.data;
- if ((ens->data.opengl.texture_id == tex) &&
- (ens->data.opengl.framebuffer_id == fbo))
- return im;
- }
- }
- if ((!ns) && (!im->native.data)) return im;
-
- eng_window_use(re->win);
-
- if (im->native.data)
- {
- if (im->native.func.free)
- im->native.func.free(im->native.func.data, im);
- evas_gl_common_image_native_disable(im);
- }
-
- if (!ns) return im;
-
- texid = tex;
- im2 = eina_hash_find(re->win->gl_context->shared->native_tex_hash, &texid);
- if (im2 == im) return im;
- if (im2)
- {
- n = im2->native.data;
- if (n)
- {
- evas_gl_common_image_ref(im2);
- evas_gl_common_image_free(im);
- return im2;
- }
- }
-
- im2 = evas_gl_common_image_new_from_data(re->win->gl_context,
- im->w, im->h, NULL, im->alpha,
- EVAS_COLORSPACE_ARGB8888);
- evas_gl_common_image_free(im);
- im = im2;
- if (native)
- {
- n = calloc(1, sizeof(Native));
- if (n)
- {
- memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
-
- eina_hash_add(re->win->gl_context->shared->native_tex_hash, &texid, im);
-
- n->egl_surface = 0;
- n->pixmap = 0;
-
- im->native.yinvert = 0;
- 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;
-
- // FIXME: need to implement mapping sub texture regions
- // x, y, w, h for possible texture atlasing
-
- evas_gl_common_image_native_enable(im);
- }
- }
- return im;
-}
-
-static void *
-eng_image_native_get(void *data EINA_UNUSED, void *image)
-{
- Evas_GL_Image *im;
- Native *n;
-
- if (!(im = image)) return NULL;
- if (!(n = im->native.data)) return NULL;
- return &(n->ns);
-}
-
-static void *
-eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *error = EVAS_LOAD_ERROR_NONE;
- eng_window_use(re->win);
- return evas_gl_common_image_load(re->win->gl_context, file, key, lo, error);
-}
-
-static void *
-eng_image_mmap(void *data, Eina_File *f, const char *key, int *error, Evas_Image_Load_Opts *lo)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *error = EVAS_LOAD_ERROR_NONE;
- eng_window_use(re->win);
- return evas_gl_common_image_mmap(re->win->gl_context, f, key, lo, error);
-}
-
-static void *
-eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- eng_window_use(re->win);
- return evas_gl_common_image_new_from_data(re->win->gl_context, w, h, image_data, alpha, cspace);
-}
-
-static void *
-eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- eng_window_use(re->win);
- return evas_gl_common_image_new_from_copied_data(re->win->gl_context, w, h, image_data, alpha, cspace);
-}
-
-static void
-eng_image_free(void *data, void *image)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- if (!image) return;
- eng_window_use(re->win);
-}
-
-static void
-eng_image_size_get(void *data EINA_UNUSED, void *image...
[truncated message content] |