forked from enlightenment/efl
parent
cbad6075d7
commit
30f906aac9
|
@ -36,7 +36,6 @@ evas-directfb.pc.in \
|
|||
evas-fb.pc.in \
|
||||
evas-opengl-x11.pc.in \
|
||||
evas-opengl-sdl.pc.in \
|
||||
evas-opengl-glew.pc.in \
|
||||
evas-software-buffer.pc.in \
|
||||
evas-software-qtopia.pc.in \
|
||||
evas-software-x11.pc.in \
|
||||
|
@ -92,10 +91,6 @@ if BUILD_ENGINE_GL_SDL
|
|||
pkgconfig_DATA += evas-opengl-sdl.pc
|
||||
endif
|
||||
|
||||
if BUILD_ENGINE_GL_GLEW
|
||||
pkgconfig_DATA += evas-opengl-glew.pc
|
||||
endif
|
||||
|
||||
if BUILD_ENGINE_XRENDER_X11
|
||||
pkgconfig_DATA += evas-xrender-x11.pc
|
||||
endif
|
||||
|
|
|
@ -352,11 +352,6 @@ windows direct-draw engine for evas
|
|||
evas direct3d engine (experimental)
|
||||
|
||||
|
||||
--enable-gl-glew[=static]
|
||||
|
||||
opengl glew based gl engine for evas (experimental)
|
||||
|
||||
|
||||
--enable-software-sdl[=static]
|
||||
|
||||
this is the sdl engine that uses sdl library (http://www.libsdl.org). This
|
||||
|
@ -871,5 +866,3 @@ found here:
|
|||
http://www.koders.com/c/fid2B518462CB1EED3D4E31E271DB83CD1582F6EEBE.aspx
|
||||
It should be installed in the mingw include directory.
|
||||
|
||||
For the OpenGL engine on Windows, the glew library is needed:
|
||||
http://glew.sourceforge.net/
|
||||
|
|
|
@ -102,7 +102,6 @@ want_evas_engine_xrender_xcb="no"
|
|||
want_evas_engine_software_gdi="no"
|
||||
want_evas_engine_software_ddraw="no"
|
||||
want_evas_engine_direct3d="no"
|
||||
want_evas_engine_gl_glew="no"
|
||||
want_evas_engine_software_sdl="no"
|
||||
want_evas_engine_fb="no"
|
||||
want_evas_engine_directfb="no"
|
||||
|
@ -594,8 +593,6 @@ EVAS_CHECK_ENGINE([software-ddraw], [${want_evas_engine_software_ddraw}], [no],
|
|||
|
||||
EVAS_CHECK_ENGINE([direct3d], [${want_evas_engine_direct3d}], [no], [Direct3D])
|
||||
|
||||
EVAS_CHECK_ENGINE([gl-glew], [${want_evas_engine_gl_glew}], [no], [OpenGL Glew])
|
||||
|
||||
EVAS_CHECK_ENGINE([software-sdl], [${want_evas_engine_software_sdl}], [no], [Software SDL])
|
||||
|
||||
EVAS_CHECK_ENGINE([gl-sdl], [${want_evas_engine_gl_sdl}], [yes], [OpenGL SDL])
|
||||
|
@ -619,12 +616,10 @@ EVAS_CHECK_ENGINE([software-16-wince], [${want_evas_engine_software_16_wince}],
|
|||
have_evas_engine_gl_common="no"
|
||||
have_static_evas_engine_gl_common="no"
|
||||
if test "x$have_evas_engine_gl_x11" = "xyes" \
|
||||
|| test "x$have_evas_engine_gl_glew" = "xyes" \
|
||||
|| test "x$have_evas_engine_gl_sdl" = "xyes"; then
|
||||
have_evas_engine_gl_common="yes"
|
||||
fi
|
||||
if test "x$have_evas_engine_gl_x11" = "xstatic" \
|
||||
|| test "x$have_evas_engine_gl_glew" = "xstatic" \
|
||||
|| test "x$have_evas_engine_gl_sdl" = "xstatic"; then
|
||||
have_evas_engine_gl_common="yes"
|
||||
have_static_evas_engine_gl_common="yes"
|
||||
|
@ -1526,7 +1521,6 @@ AC_OUTPUT([
|
|||
Makefile
|
||||
evas-directfb.pc
|
||||
evas-fb.pc
|
||||
evas-opengl-glew.pc
|
||||
evas-opengl-x11.pc
|
||||
evas-opengl-sdl.pc
|
||||
evas-software-buffer.pc
|
||||
|
@ -1573,7 +1567,6 @@ src/modules/engines/fb/Makefile
|
|||
src/modules/engines/buffer/Makefile
|
||||
src/modules/engines/directfb/Makefile
|
||||
src/modules/engines/gl_common/Makefile
|
||||
src/modules/engines/gl_glew/Makefile
|
||||
src/modules/engines/gl_x11/Makefile
|
||||
src/modules/engines/gl_sdl/Makefile
|
||||
src/modules/engines/xrender_x11/Makefile
|
||||
|
@ -1664,7 +1657,6 @@ fi
|
|||
echo " Software GDI...............: $have_evas_engine_software_gdi"
|
||||
echo " Software DirectDraw........: $have_evas_engine_software_ddraw"
|
||||
echo " Direct3d...................: $have_evas_engine_direct3d"
|
||||
echo " OpenGL Glew................: $have_evas_engine_gl_glew"
|
||||
echo " Software SDL...............: $have_evas_engine_software_sdl (primitive: $sdl_primitive)"
|
||||
echo $ECHO_N " OpenGL SDL.................: $have_evas_engine_gl_sdl $ECHO_C"
|
||||
if test "x$have_evas_engine_gl_sdl" = "xyes"; then
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
Name: evas-opengl-glew
|
||||
Description: Evas OpenGL Glew engine
|
||||
Version: @VERSION@
|
|
@ -375,33 +375,6 @@ fi
|
|||
|
||||
])
|
||||
|
||||
dnl use: EVAS_CHECK_ENGINE_DEP_GL_GLEW(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
|
||||
AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_GLEW],
|
||||
[
|
||||
|
||||
evas_engine_[]$1[]_cflags=""
|
||||
evas_engine_[]$1[]_libs=""
|
||||
|
||||
AC_CHECK_HEADERS([GL/gl.h GL/glew.h],
|
||||
[
|
||||
have_dep="yes"
|
||||
evas_engine_[]$1[]_libs="-lglew32 -lopengl32 -lgdi32"
|
||||
],
|
||||
[have_dep="no"; break;]
|
||||
)
|
||||
|
||||
AC_SUBST([evas_engine_$1_cflags])
|
||||
AC_SUBST([evas_engine_$1_libs])
|
||||
|
||||
if test "x${have_dep}" = "xyes" ; then
|
||||
m4_default([$4], [:])
|
||||
else
|
||||
m4_default([$5], [:])
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_SDL(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
|
||||
AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_SDL],
|
||||
|
|
|
@ -27,14 +27,6 @@ SUBDIRS += ../modules/engines/fb/
|
|||
EVAS_STATIC_MODULE += ../modules/engines/fb/libevas_engine_fb.la
|
||||
EVAS_STATIC_LIBADD += @evas_engine_fb_libs@
|
||||
endif
|
||||
if EVAS_STATIC_BUILD_GL_GLEW
|
||||
SUBDIRS += \
|
||||
../modules/engines/gl_common \
|
||||
../modules/engines/gl_glew
|
||||
EVAS_STATIC_MODULE += \
|
||||
../modules/engines/gl_glew/libevas_engine_gl_glew.la
|
||||
EVAS_STATIC_LIBADD += @evas_engine_gl_common_libs@ @evas_engine_gl_glew_libs@
|
||||
endif
|
||||
if EVAS_STATIC_BUILD_GL_X11
|
||||
SUBDIRS += \
|
||||
../modules/engines/gl_common \
|
||||
|
|
|
@ -837,9 +837,6 @@ evas_render_method_list(void)
|
|||
#ifdef BUILD_ENGINE_GL_X11
|
||||
methods = eina_list_append(methods, "gl_x11");
|
||||
#endif
|
||||
#ifdef BUILD_ENGINE_GL_GLEW
|
||||
methods = eina_list_append(methods, "gl_glew");
|
||||
#endif
|
||||
#ifdef BUILD_ENGINE_DIRECTFB
|
||||
methods = eina_list_append(methods, "directfb");
|
||||
#endif
|
||||
|
|
|
@ -94,7 +94,6 @@ EVAS_EINA_STATIC_MODULE_DEFINE(engine, buffer);
|
|||
EVAS_EINA_STATIC_MODULE_DEFINE(engine, direct3d);
|
||||
EVAS_EINA_STATIC_MODULE_DEFINE(engine, directfb);
|
||||
EVAS_EINA_STATIC_MODULE_DEFINE(engine, fb);
|
||||
EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_glew);
|
||||
EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_x11);
|
||||
EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_sdl);
|
||||
EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_16);
|
||||
|
@ -146,9 +145,6 @@ static const struct {
|
|||
#ifdef EVAS_STATIC_BUILD_FB
|
||||
EVAS_EINA_STATIC_MODULE_USE(engine, fb),
|
||||
#endif
|
||||
#ifdef EVAS_STATIC_BUILD_GL_GLEW
|
||||
EVAS_EINA_STATIC_MODULE_USE(engine, gl_glew),
|
||||
#endif
|
||||
#ifdef EVAS_STATIC_BUILD_GL_X11
|
||||
EVAS_EINA_STATIC_MODULE_USE(engine, gl_x11),
|
||||
#endif
|
||||
|
|
|
@ -21,9 +21,6 @@ endif
|
|||
if !EVAS_STATIC_BUILD_GL_COMMON
|
||||
SUBDIRS += gl_common
|
||||
endif
|
||||
if !EVAS_STATIC_BUILD_GL_GLEW
|
||||
SUBDIRS += gl_glew
|
||||
endif
|
||||
if !EVAS_STATIC_BUILD_GL_X11
|
||||
SUBDIRS += gl_x11
|
||||
endif
|
||||
|
|
|
@ -13,11 +13,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef BUILD_ENGINE_GL_GLEW
|
||||
# include <GL/glew.h>
|
||||
#else
|
||||
# define GL_GLEXT_PROTOTYPES
|
||||
#endif
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#ifdef BUILD_ENGINE_GL_QUARTZ
|
||||
# include <OpenGL/gl.h>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.lo
|
||||
*.la
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef __EVAS_ENGINE_GL_GLEW_H__
|
||||
#define __EVAS_ENGINE_GL_GLEW_H__
|
||||
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
|
||||
typedef struct _Evas_Engine_Info_GL_Glew Evas_Engine_Info_GL_Glew;
|
||||
|
||||
struct _Evas_Engine_Info_GL_Glew
|
||||
{
|
||||
/* 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 {
|
||||
HWND window;
|
||||
int depth;
|
||||
} info;
|
||||
|
||||
/* non-blocking or blocking mode */
|
||||
Evas_Engine_Render_Mode render_mode;
|
||||
};
|
||||
|
||||
|
||||
#endif /* __EVAS_ENGINE_GL_GLEW_H__ */
|
|
@ -1,45 +0,0 @@
|
|||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/src/lib \
|
||||
-I$(top_srcdir)/src/lib/include \
|
||||
-I$(top_srcdir)/src/modules/engines/gl_common \
|
||||
@EINA_CFLAGS@ \
|
||||
@FREETYPE_CFLAGS@ \
|
||||
@evas_engine_gl_glew_cflags@
|
||||
|
||||
if BUILD_ENGINE_GL_GLEW
|
||||
|
||||
GL_GLEW_SOURCES = \
|
||||
evas_engine.c \
|
||||
evas_glew_win32_main.c
|
||||
|
||||
GL_GLEW_LIBADD = @evas_engine_gl_glew_libs@ $(top_builddir)/src/modules/engines/gl_common/libevas_engine_gl_common.la
|
||||
|
||||
|
||||
includes_HEADERS = Evas_Engine_GL_Glew.h
|
||||
includesdir = $(includedir)/evas-@VMAJ@
|
||||
|
||||
if !EVAS_STATIC_BUILD_GL_GLEW
|
||||
|
||||
pkgdir = $(libdir)/evas/modules/engines/gl_glew/$(MODULE_ARCH)
|
||||
pkg_LTLIBRARIES = module.la
|
||||
|
||||
module_la_SOURCES = $(GL_GLEW_SOURCES)
|
||||
module_la_LIBADD = $(GL_GLEW_LIBADD) $(top_builddir)/src/lib/libevas.la
|
||||
module_la_LDFLAGS = @lt_enable_auto_import@ -no-undefined -module -avoid-version
|
||||
module_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
||||
else
|
||||
|
||||
noinst_LTLIBRARIES = libevas_engine_gl_glew.la
|
||||
|
||||
libevas_engine_gl_glew_la_SOURCES = $(GL_GLEW_SOURCES)
|
||||
libevas_engine_gl_glew_la_LIBADD = $(GL_GLEW_LIBADD)
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
EXTRA_DIST = evas_engine.h
|
|
@ -1,887 +0,0 @@
|
|||
#include "evas_common.h" /* Also includes international specific stuff */
|
||||
#include "evas_engine.h"
|
||||
|
||||
int _evas_engine_GL_glew_log_dom = -1;
|
||||
|
||||
/* function tables - filled in later (func and parent func) */
|
||||
static Evas_Func func, pfunc;
|
||||
|
||||
typedef struct _Render_Engine Render_Engine;
|
||||
|
||||
struct _Render_Engine
|
||||
{
|
||||
Evas_GL_Glew_Window *window;
|
||||
int end;
|
||||
};
|
||||
|
||||
static void *
|
||||
eng_info(Evas *e __UNUSED__)
|
||||
{
|
||||
Evas_Engine_Info_GL_Glew *info;
|
||||
info = calloc(1, sizeof(Evas_Engine_Info_GL_Glew));
|
||||
if (!info) return NULL;
|
||||
info->magic.magic = rand();
|
||||
info->render_mode = EVAS_RENDER_MODE_BLOCKING;
|
||||
return info;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_info_free(Evas *e __UNUSED__, void *info)
|
||||
{
|
||||
Evas_Engine_Info_GL_Glew *in;
|
||||
|
||||
eina_log_domain_unregister(_evas_engine_GL_glew_log_dom);
|
||||
in = (Evas_Engine_Info_GL_Glew *)info;
|
||||
free(in);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *e, void *in)
|
||||
{
|
||||
Render_Engine *re;
|
||||
Evas_Engine_Info_GL_Glew *info;
|
||||
|
||||
info = (Evas_Engine_Info_GL_Glew *)in;
|
||||
if (!e->engine.data.output)
|
||||
{
|
||||
re = calloc(1, sizeof(Render_Engine));
|
||||
if (!re) return 0;
|
||||
|
||||
e->engine.data.output = re;
|
||||
re->window = eng_window_new(info->info.window,
|
||||
info->info.depth,
|
||||
e->output.w,
|
||||
e->output.h);
|
||||
if (!re->window)
|
||||
{
|
||||
free(re);
|
||||
e->engine.data.output = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
else
|
||||
{
|
||||
re = e->engine.data.output;
|
||||
eng_window_free(re->window);
|
||||
re->window = eng_window_new(info->info.window,
|
||||
info->info.depth,
|
||||
e->output.w,
|
||||
e->output.h);
|
||||
}
|
||||
if (!e->engine.data.output) return 0;
|
||||
|
||||
if (!e->engine.data.context)
|
||||
e->engine.data.context =
|
||||
e->engine.func->context_new(e->engine.data.output);
|
||||
eng_window_use(re->window);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_free(void *data)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
eng_window_free(re->window);
|
||||
free(re);
|
||||
|
||||
evas_common_font_shutdown();
|
||||
evas_common_image_shutdown();
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_resize(void *data, int w, int h)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
re->window->width = w;
|
||||
re->window->height = h;
|
||||
evas_gl_common_context_resize(re->window->gl_context, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_tile_size_set(void *data __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_redraws_rect_add(void *data, int x, int y, int w, int h)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
evas_gl_common_context_resize(re->window->gl_context, re->window->width, re->window->height);
|
||||
/* simple bounding box */
|
||||
if (!re->window->draw.redraw)
|
||||
{
|
||||
#if 0
|
||||
re->window->draw.x1 = x;
|
||||
re->window->draw.y1 = y;
|
||||
re->window->draw.x2 = x + w - 1;
|
||||
re->window->draw.y2 = y + h - 1;
|
||||
#else
|
||||
re->window->draw.x1 = 0;
|
||||
re->window->draw.y1 = 0;
|
||||
re->window->draw.x2 = re->window->width - 1;
|
||||
re->window->draw.y2 = re->window->height - 1;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x < re->window->draw.x1) re->window->draw.x1 = x;
|
||||
if (y < re->window->draw.y1) re->window->draw.y1 = y;
|
||||
if ((x + w - 1) > re->window->draw.x2) re->window->draw.x2 = x + w - 1;
|
||||
if ((y + h - 1) > re->window->draw.y2) re->window->draw.y2 = y + h - 1;
|
||||
}
|
||||
re->window->draw.redraw = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_redraws_rect_del(void *data __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_redraws_clear(void *data)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
re->window->draw.redraw = 0;
|
||||
}
|
||||
|
||||
#define SLOW_GL_COPY_RECT 1
|
||||
/* 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;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
evas_gl_common_context_flush(re->window->gl_context);
|
||||
/* get the upate rect surface - return engine data as dummy */
|
||||
if (!re->window->draw.redraw)
|
||||
{
|
||||
// printf("GL: NO updates!\n");
|
||||
return NULL;
|
||||
}
|
||||
// printf("GL: update....!\n");
|
||||
#ifdef SLOW_GL_COPY_RECT
|
||||
/* if any update - just return the whole canvas - works with swap
|
||||
* buffers then */
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
if (w) *w = re->window->width;
|
||||
if (h) *h = re->window->height;
|
||||
if (cx) *cx = 0;
|
||||
if (cy) *cy = 0;
|
||||
if (cw) *cw = re->window->width;
|
||||
if (ch) *ch = re->window->height;
|
||||
#else
|
||||
/* 1 update - INCREDIBLY SLOW if combined with swap_rect in flush. a gl
|
||||
* problem where there just is no hardware path for somethnig that
|
||||
* obviously SHOULD be there */
|
||||
/* only 1 update to minimise gl context games and rendering multiple update
|
||||
* regions as evas does with other engines
|
||||
*/
|
||||
if (x) *x = re->window->draw.x1;
|
||||
if (y) *y = re->window->draw.y1;
|
||||
if (w) *w = re->window->draw.x2 - re->window->draw.x1 + 1;
|
||||
if (h) *h = re->window->draw.y2 - re->window->draw.y1 + 1;
|
||||
if (cx) *cx = re->window->draw.x1;
|
||||
if (cy) *cy = re->window->draw.y1;
|
||||
if (cw) *cw = re->window->draw.x2 - re->window->draw.x1 + 1;
|
||||
if (ch) *ch = re->window->draw.y2 - re->window->draw.y1 + 1;
|
||||
#endif
|
||||
// clear buffer. only needed for dest alpha
|
||||
// glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
// glClear(GL_COLOR_BUFFER_BIT);
|
||||
return re;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
/* put back update surface.. in this case just unflag redraw */
|
||||
re->window->draw.redraw = 0;
|
||||
re->window->draw.drew = 1;
|
||||
evas_gl_common_context_flush(re->window->gl_context);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_flush(void *data)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
if (!re->window->draw.drew) return;
|
||||
|
||||
re->window->draw.drew = 0;
|
||||
eng_window_use(re->window);
|
||||
|
||||
#ifdef VSYNC_TO_SCREEN
|
||||
eng_window_vsync_set(1);
|
||||
#endif
|
||||
#ifdef SLOW_GL_COPY_RECT
|
||||
eng_window_swap_buffers(re->window);
|
||||
#else
|
||||
/* SLOW AS ALL HELL */
|
||||
evas_gl_common_swap_rect(re->window->gl_context,
|
||||
re->window->draw.x1, re->window->draw.y1,
|
||||
re->window->draw.x2 - re->window->draw.x1 + 1,
|
||||
re->window->draw.y2 - re->window->draw.y1 + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_idle_flush(void *data __UNUSED__)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
eng_output_dump(void *data __UNUSED__)
|
||||
{
|
||||
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->window->gl_context);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_context_cutout_add(void *data __UNUSED__, void *context, int x, int y, int w, int h)
|
||||
{
|
||||
evas_common_draw_context_add_cutout(context, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_context_cutout_clear(void *data __UNUSED__, void *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)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
eng_window_use(re->window);
|
||||
re->window->gl_context->dc = context;
|
||||
evas_gl_common_rect_draw(re->window->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)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
eng_window_use(re->window);
|
||||
re->window->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, void *context, void *polygon, int x, int y)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
//--// return evas_gl_common_poly_point_add(polygon, x, y);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_polygon_points_clear(void *data, void *context, void *polygon)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
//--// return evas_gl_common_poly_points_clear(polygon);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_polygon_draw(void *data, void *context, void *surface, void *polygon, int x, int y)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
re->window->gl_context->dc = context;
|
||||
//--// evas_gl_common_poly_draw(re->window->gl_context, polygon, x, y);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_image_alpha_get(void *data, void *image)
|
||||
{
|
||||
Evas_GL_Image *im;
|
||||
|
||||
if (!image) return 1;
|
||||
im = image;
|
||||
/* FIXME: can move to gl_common */
|
||||
switch (im->cs.space)
|
||||
{
|
||||
case EVAS_COLORSPACE_ARGB8888:
|
||||
if (im->im->cache_entry.flags.alpha) return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_image_colorspace_get(void *data, void *image)
|
||||
{
|
||||
Evas_GL_Image *im;
|
||||
|
||||
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;
|
||||
eng_window_use(re->window);
|
||||
im = 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;
|
||||
|
||||
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);
|
||||
im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
|
||||
return image;
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_image_border_set(void *data __UNUSED__, void *image, int l __UNUSED__, int r __UNUSED__, int t __UNUSED__, int b __UNUSED__)
|
||||
{
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_border_get(void *data __UNUSED__, void *image __UNUSED__, int *l __UNUSED__, int *r __UNUSED__, int *t __UNUSED__, int *b __UNUSED__)
|
||||
{
|
||||
}
|
||||
|
||||
static char *
|
||||
eng_image_comment_get(void *data __UNUSED__, void *image, char *key __UNUSED__)
|
||||
{
|
||||
Evas_GL_Image *im;
|
||||
|
||||
if (!image) return NULL;
|
||||
im = (Evas_GL_Image *)image;
|
||||
return im->im->info.comment;
|
||||
}
|
||||
|
||||
static char *
|
||||
eng_image_format_get(void *data __UNUSED__, void *image)
|
||||
{
|
||||
Evas_GL_Image *im;
|
||||
|
||||
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;
|
||||
/* FIXME: can move to gl_common */
|
||||
if (im->cs.space == cspace) return;
|
||||
eng_window_use(re->window);
|
||||
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:
|
||||
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);
|
||||
}
|
||||
im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2);
|
||||
im->cs.no_free = 0;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
im->cs.space = cspace;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_native_set(void *data __UNUSED__, void *image __UNUSED__, void *native __UNUSED__)
|
||||
{
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_image_native_get(void *data __UNUSED__, void *image __UNUSED__)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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->window);
|
||||
return evas_gl_common_image_load(re->window->gl_context, file, 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->window);
|
||||
return evas_gl_common_image_new_from_data(re->window->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->window);
|
||||
return evas_gl_common_image_new_from_copied_data(re->window->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->window);
|
||||
evas_gl_common_image_free(image);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_size_get(void *data __UNUSED__, void *image, int *w, int *h)
|
||||
{
|
||||
if (!image)
|
||||
{
|
||||
*w = 0;
|
||||
*h = 0;
|
||||
return;
|
||||
}
|
||||
if (w) *w = ((Evas_GL_Image *)image)->im->cache_entry.w;
|
||||
if (h) *h = ((Evas_GL_Image *)image)->im->cache_entry.h;
|
||||
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_image_size_set(void *data, void *image, int w, int h)
|
||||
{
|
||||
Render_Engine *re;
|
||||
Evas_GL_Image *im, *im_old;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
if (!image) return NULL;
|
||||
eng_window_use(re->window);
|
||||
im_old = image;
|
||||
if ((eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P601_PL) ||
|
||||
(eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P709_PL))
|
||||
w &= ~0x1;
|
||||
if ((im_old) && (im_old->im->cache_entry.w == w) && (im_old->im->cache_entry.h == h))
|
||||
|
||||
return image;
|
||||
if (im_old)
|
||||
{
|
||||
im = evas_gl_common_image_new(re->window->gl_context, w, h,
|
||||
eng_image_alpha_get(data, image),
|
||||
eng_image_colorspace_get(data, image));
|
||||
/*
|
||||
evas_common_load_image_data_from_file(im_old->im);
|
||||
if (im_old->im->image->data)
|
||||
{
|
||||
evas_common_blit_rectangle(im_old->im, im->im, 0, 0, w, h, 0, 0);
|
||||
evas_common_cpu_end_opt();
|
||||
}
|
||||
*/
|
||||
evas_gl_common_image_free(im_old);
|
||||
}
|
||||
else
|
||||
im = evas_gl_common_image_new(re->window->gl_context, w, h, 1, EVAS_COLORSPACE_ARGB8888);
|
||||
return im;
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_image_dirty_region(void *data, void *image, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
if (!image) return NULL;
|
||||
eng_window_use(re->window);
|
||||
evas_gl_common_image_dirty(image);
|
||||
return image;
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
|
||||
{
|
||||
Render_Engine *re;
|
||||
Evas_GL_Image *im;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
if (!image)
|
||||
{
|
||||
*image_data = NULL;
|
||||
return NULL;
|
||||
}
|
||||
im = image;
|
||||
eng_window_use(re->window);
|
||||
evas_cache_image_load_data(&im->im->cache_entry);
|
||||
switch (im->cs.space)
|
||||
{
|
||||
case EVAS_COLORSPACE_ARGB8888:
|
||||
if (to_write)
|
||||
{
|
||||
if (im->references > 1)
|
||||
{
|
||||
Evas_GL_Image *im_new;
|
||||
|
||||
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)
|
||||
{
|
||||
*image_data = NULL;
|
||||
return im;
|
||||
}
|
||||
evas_gl_common_image_free(im);
|
||||
im = im_new;
|
||||
}
|
||||
else
|
||||
evas_gl_common_image_dirty(im);
|
||||
}
|
||||
*image_data = im->im->image.data;
|
||||
break;
|
||||
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||
*image_data = im->cs.data;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
return im;
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
||||
{
|
||||
Render_Engine *re;
|
||||
Evas_GL_Image *im, *im2;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
if (!image) return NULL;
|
||||
im = image;
|
||||
eng_window_use(re->window);
|
||||
switch (im->cs.space)
|
||||
{
|
||||
case EVAS_COLORSPACE_ARGB8888:
|
||||
if (image_data != im->im->image.data)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
w = im->im->cache_entry.w;
|
||||
h = im->im->cache_entry.h;
|
||||
im2 = eng_image_new_from_data(data, w, h, image_data,
|
||||
eng_image_alpha_get(data, image),
|
||||
eng_image_colorspace_get(data, image));
|
||||
if (!im2) return im;
|
||||
evas_gl_common_image_free(im);
|
||||
im = im2;
|
||||
}
|
||||
break;
|
||||
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||
if (image_data != im->cs.data)
|
||||
{
|
||||
if (im->cs.data)
|
||||
{
|
||||
if (!im->cs.no_free) free(im->cs.data);
|
||||
}
|
||||
im->cs.data = image_data;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
/* hmmm - but if we wrote... why bother? */
|
||||
evas_gl_common_image_dirty(im);
|
||||
return im;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_request(void *data __UNUSED__, void *image, const void *target)
|
||||
{
|
||||
Evas_GL_Image *gim = image;
|
||||
RGBA_Image *im;
|
||||
|
||||
if (!gim) return ;
|
||||
im = (RGBA_Image*) gim->im;
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_data(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_cancel(void *data __UNUSED__, void *image, const void *target)
|
||||
{
|
||||
Evas_GL_Image *gim = image;
|
||||
RGBA_Image *im;
|
||||
|
||||
if (!gim) return ;
|
||||
im = (RGBA_Image*) gim->im;
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_draw(void *data, void *context, void *surface __UNUSED__, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
if (!image) return;
|
||||
eng_window_use(re->window);
|
||||
re->window->gl_context->dc = context;
|
||||
evas_gl_common_image_draw(re->window->gl_context, image,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h,
|
||||
smooth);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_scale_hint_set(void *data __UNUSED__, void *image __UNUSED__, int hint __UNUSED__)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
eng_image_scale_hint_get(void *data __UNUSED__, void *image __UNUSED__)
|
||||
{
|
||||
return EVAS_IMAGE_SCALE_HINT_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_map_draw(void *data __UNUSED__, void *context, void *surface, void *image, int npoints, RGBA_Map_Point *p, int smooth, int level)
|
||||
{
|
||||
// XXX
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_image_map_surface_new(void *data __UNUSED__, int w, int h, int alpha)
|
||||
{
|
||||
// XXX
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_map_surface_free(void *data __UNUSED__, void *surface)
|
||||
{
|
||||
// XXX
|
||||
}
|
||||
|
||||
static void
|
||||
eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w, int h, int ow, int oh, const Eina_Unicode *text, const Evas_Text_Props *intl_props)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
eng_window_use(re->window);
|
||||
{
|
||||
// FIXME: put im into context so we can free it
|
||||
static RGBA_Image *im = NULL;
|
||||
|
||||
if (!im)
|
||||
im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
|
||||
if (!im) return;
|
||||
im->cache_entry.w = re->window->width;
|
||||
im->cache_entry.h = re->window->height;
|
||||
evas_common_draw_context_font_ext_set(context,
|
||||
re->window->gl_context,
|
||||
evas_gl_font_texture_new,
|
||||
evas_gl_font_texture_free,
|
||||
evas_gl_font_texture_draw);
|
||||
evas_common_font_draw(im, context, font, x, y, text, intl_props);
|
||||
evas_common_draw_context_font_ext_set(context,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_canvas_alpha_get(void *data __UNUSED__, void *info __UNUSED__)
|
||||
{
|
||||
// FIXME: support ARGB gl targets!!!
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
module_open(Evas_Module *em)
|
||||
{
|
||||
if (!em) return 0;
|
||||
if (!evas_gl_common_module_open()) return 0;
|
||||
/* get whatever engine module we inherit from */
|
||||
if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
|
||||
_evas_engine_GL_glew_log_dom = eina_log_domain_register
|
||||
("evas-gl_glew", EVAS_DEFAULT_LOG_COLOR);
|
||||
if (_evas_engine_GL_glew_log_dom < 0)
|
||||
{
|
||||
EINA_LOG_ERR("Can not create a module log domain.");
|
||||
return 0;
|
||||
}
|
||||
/* 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_resize);
|
||||
ORD(output_tile_size_set);
|
||||
ORD(output_redraws_rect_add);
|
||||
ORD(output_redraws_rect_del);
|
||||
ORD(output_redraws_clear);
|
||||
ORD(output_redraws_next_update_get);
|
||||
ORD(output_redraws_next_update_push);
|
||||
ORD(context_cutout_add);
|
||||
ORD(context_cutout_clear);
|
||||
ORD(output_flush);
|
||||
ORD(output_idle_flush);
|
||||
ORD(output_dump);
|
||||
ORD(rectangle_draw);
|
||||
ORD(line_draw);
|
||||
ORD(polygon_point_add);
|
||||
ORD(polygon_points_clear);
|
||||
ORD(polygon_draw);
|
||||
|
||||
ORD(image_load);
|
||||
ORD(image_new_from_data);
|
||||
ORD(image_new_from_copied_data);
|
||||
ORD(image_free);
|
||||
ORD(image_size_get);
|
||||
ORD(image_size_set);
|
||||
ORD(image_dirty_region);
|
||||
ORD(image_data_get);
|
||||
ORD(image_data_put);
|
||||
ORD(image_data_preload_request);
|
||||
ORD(image_data_preload_cancel);
|
||||
ORD(image_alpha_set);
|
||||
ORD(image_alpha_get);
|
||||
ORD(image_border_set);
|
||||
ORD(image_border_get);
|
||||
ORD(image_draw);
|
||||
ORD(image_comment_get);
|
||||
ORD(image_format_get);
|
||||
ORD(image_colorspace_set);
|
||||
ORD(image_colorspace_get);
|
||||
ORD(image_native_set);
|
||||
ORD(image_native_get);
|
||||
|
||||
ORD(font_draw);
|
||||
|
||||
ORD(image_scale_hint_set);
|
||||
ORD(image_scale_hint_get);
|
||||
|
||||
ORD(image_map_draw);
|
||||
ORD(image_map_surface_new);
|
||||
ORD(image_map_surface_free);
|
||||
|
||||
/* now advertise out own api */
|
||||
em->functions = (void *)(&func);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
module_close(Evas_Module *em)
|
||||
{
|
||||
eina_log_domain_unregister(_evas_engine_GL_glew_log_dom);
|
||||
evas_gl_common_module_close();
|
||||
}
|
||||
|
||||
static Evas_Module_Api evas_modapi =
|
||||
{
|
||||
EVAS_MODULE_API_VERSION,
|
||||
"gl_glew",
|
||||
"none",
|
||||
{
|
||||
module_open,
|
||||
module_close
|
||||
}
|
||||
};
|
||||
|
||||
EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, gl_glew);
|
||||
|
||||
#ifndef EVAS_STATIC_BUILD_GL_GLEW
|
||||
EVAS_EINA_MODULE_DEFINE(engine, gl_glew);
|
||||
#endif
|
|
@ -1,75 +0,0 @@
|
|||
#ifndef __EVAS_ENGINE_H__
|
||||
#define __EVAS_ENGINE_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "evas_gl_common.h"
|
||||
#include "Evas_Engine_GL_Glew.h"
|
||||
|
||||
extern int _evas_engine_GL_glew_log_dom ;
|
||||
#ifdef ERR
|
||||
# undef ERR
|
||||
#endif
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_GL_glew_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef DBG
|
||||
# undef DBG
|
||||
#endif
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_GL_glew_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef INF
|
||||
# undef INF
|
||||
#endif
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_evas_engine_GL_glew_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef WRN
|
||||
# undef WRN
|
||||
#endif
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_GL_glew_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef CRIT
|
||||
# undef CRIT
|
||||
#endif
|
||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_evas_engine_GL_glew_log_dom, __VA_ARGS__)
|
||||
|
||||
typedef struct _Evas_GL_Glew_Window Evas_GL_Glew_Window;
|
||||
|
||||
struct _Evas_GL_Glew_Window
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HWND window;
|
||||
HDC dc;
|
||||
HGLRC context;
|
||||
#endif
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
Evas_Engine_GL_Context *gl_context;
|
||||
struct {
|
||||
int x1;
|
||||
int y1;
|
||||
int x2;
|
||||
int y2;
|
||||
int redraw : 1;
|
||||
int drew : 1;
|
||||
} draw;
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
Evas_GL_Glew_Window *eng_window_new(HWND window,
|
||||
int depth,
|
||||
int width,
|
||||
int height);
|
||||
#endif
|
||||
|
||||
void eng_window_free(Evas_GL_Glew_Window *gw);
|
||||
void eng_window_use(Evas_GL_Glew_Window *gw);
|
||||
void eng_window_swap_buffers(Evas_GL_Glew_Window *gw);
|
||||
void eng_window_vsync_set(int on);
|
||||
|
||||
|
||||
#endif /* __EVAS_ENGINE_H__ */
|
|
@ -1,133 +0,0 @@
|
|||
#include "evas_engine.h"
|
||||
|
||||
#ifdef HAVE_GL_GLEW_H
|
||||
# include <GL/wglew.h>
|
||||
#endif
|
||||
|
||||
static Evas_GL_Glew_Window *_evas_gl_glew_window = NULL;
|
||||
|
||||
Evas_GL_Glew_Window *
|
||||
eng_window_new(HWND window,
|
||||
int depth,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
Evas_GL_Glew_Window *gw;
|
||||
int format;
|
||||
|
||||
gw = calloc(1, sizeof(Evas_GL_Glew_Window));
|
||||
if (!gw) return NULL;
|
||||
|
||||
gw->window = window;
|
||||
gw->depth = depth;
|
||||
|
||||
gw->dc = GetDC(window);
|
||||
if (!gw->dc)
|
||||
goto free_window;
|
||||
|
||||
ZeroMemory(&pfd, sizeof (pfd));
|
||||
pfd.nSize = sizeof (pfd);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 24;
|
||||
pfd.cDepthBits = 32;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
format = ChoosePixelFormat(gw->dc, &pfd);
|
||||
if (!format)
|
||||
goto release_dc;
|
||||
|
||||
SetPixelFormat(gw->dc, format, &pfd);
|
||||
|
||||
if (pfd.iPixelType != PFD_TYPE_RGBA)
|
||||
goto release_dc;
|
||||
|
||||
gw->context = wglCreateContext(gw->dc);
|
||||
if (!gw->context)
|
||||
goto release_dc;
|
||||
|
||||
wglMakeCurrent(gw->dc, gw->context);
|
||||
|
||||
if (glewInit() != GLEW_OK)
|
||||
goto delete_context;
|
||||
|
||||
if (!GLEW_VERSION_2_0)
|
||||
{
|
||||
ERR("OpenGL 2.0 not supported. Exiting...");
|
||||
goto delete_context;
|
||||
}
|
||||
|
||||
_evas_gl_glew_window = gw;
|
||||
|
||||
gw->gl_context = evas_gl_common_context_new();
|
||||
if (!gw->gl_context)
|
||||
goto delete_context;
|
||||
evas_gl_common_context_resize(gw->gl_context, width, height);
|
||||
|
||||
return gw;
|
||||
|
||||
delete_context:
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglDeleteContext(gw->context);
|
||||
release_dc:
|
||||
ReleaseDC(window, gw->dc);
|
||||
free_window:
|
||||
free(gw);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
eng_window_free(Evas_GL_Glew_Window *gw)
|
||||
{
|
||||
if (!gw)
|
||||
return;
|
||||
if (gw == _evas_gl_glew_window) _evas_gl_glew_window = NULL;
|
||||
evas_gl_common_context_free(gw->gl_context);
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglDeleteContext(gw->context);
|
||||
ReleaseDC(gw->window, gw->dc);
|
||||
free(gw);
|
||||
}
|
||||
|
||||
void
|
||||
eng_window_use(Evas_GL_Glew_Window *gw)
|
||||
{
|
||||
if (_evas_gl_glew_window != gw)
|
||||
{
|
||||
if (_evas_gl_glew_window)
|
||||
evas_gl_common_context_flush(_evas_gl_glew_window->gl_context);
|
||||
_evas_gl_glew_window = gw;
|
||||
wglMakeCurrent(gw->dc, gw->context);
|
||||
}
|
||||
evas_gl_common_context_use(gw->gl_context);
|
||||
}
|
||||
|
||||
void
|
||||
eng_window_swap_buffers(Evas_GL_Glew_Window *gw)
|
||||
{
|
||||
SwapBuffers(gw->dc);
|
||||
}
|
||||
|
||||
void
|
||||
eng_window_vsync_set(int on)
|
||||
{
|
||||
#if 1 /* Using Glew */
|
||||
wglSwapIntervalEXT(on);
|
||||
#else /* Using plain OpenGL */
|
||||
const char *extensions = glGetString(GL_EXTENSIONS);
|
||||
|
||||
/* check if WGL_EXT_swap_control extension is supported */
|
||||
if (strstr(extensions, "WGL_EXT_swap_control") == 0)
|
||||
return;
|
||||
else
|
||||
{
|
||||
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress("wglSwapIntervalEXT");
|
||||
|
||||
if (wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(on);
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -8,40 +8,37 @@
|
|||
#include "Evas.h"
|
||||
#include "Evas_Engine_GL_X11.h"
|
||||
|
||||
#ifdef HAVE_GL_GLEW_H
|
||||
# include <GL/glxew.h>
|
||||
#else
|
||||
# define GL_GLEXT_PROTOTYPES
|
||||
# if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
||||
# if defined(GLES_VARIETY_S3C6410)
|
||||
# include <EGL/egl.h>
|
||||
# include <GLES2/gl2.h>
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xatom.h>
|
||||
# include <X11/Xutil.h>
|
||||
# include <X11/extensions/Xrender.h>
|
||||
# include <X11/Xresource.h> // xres - dpi
|
||||
# elif defined(GLES_VARIETY_SGX)
|
||||
# define SUPPORT_X11 1
|
||||
# include <EGL/egl.h>
|
||||
# include <GLES2/gl2.h>
|
||||
# include <GLES2/gl2ext.h>
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xatom.h>
|
||||
# include <X11/Xutil.h>
|
||||
# include <X11/extensions/Xrender.h>
|
||||
# include <X11/Xresource.h> // xres - dpi
|
||||
#endif
|
||||
# else
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
||||
# if defined(GLES_VARIETY_S3C6410)
|
||||
# include <EGL/egl.h>
|
||||
# include <GLES2/gl2.h>
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xatom.h>
|
||||
# include <X11/Xutil.h>
|
||||
# include <X11/extensions/Xrender.h>
|
||||
# include <X11/Xresource.h> // xres - dpi
|
||||
# elif defined(GLES_VARIETY_SGX)
|
||||
# define SUPPORT_X11 1
|
||||
# include <EGL/egl.h>
|
||||
# include <GLES2/gl2.h>
|
||||
# include <GLES2/gl2ext.h>
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xatom.h>
|
||||
# include <X11/Xutil.h>
|
||||
# include <X11/extensions/Xrender.h>
|
||||
# include <X11/Xresource.h> // xres - dpi
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glext.h>
|
||||
# include <GL/glx.h>
|
||||
# endif
|
||||
#else
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xatom.h>
|
||||
# include <X11/Xutil.h>
|
||||
# include <X11/extensions/Xrender.h>
|
||||
# include <X11/Xresource.h> // xres - dpi
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glext.h>
|
||||
# include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
extern int _evas_engine_GL_X11_log_dom ;
|
||||
|
|
Loading…
Reference in New Issue