Add OpenGL SDL engine

SVN revision: 45674
This commit is contained in:
xcomputerman 2010-01-29 02:31:37 +00:00 committed by xcomputerman
parent a5a6b927d0
commit cdcc000942
7 changed files with 1648 additions and 1 deletions

View File

@ -23,6 +23,7 @@ evas-cairo-x11.pc \
evas-directfb.pc \
evas-fb.pc \
evas-opengl-x11.pc \
evas-opengl-sdl.pc \
evas-opengl-glew.pc \
evas-quartz.pc \
evas-software-buffer.pc \
@ -62,6 +63,7 @@ evas-cairo-x11.pc.in \
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 \
@ -108,6 +110,10 @@ if BUILD_ENGINE_GL_X11
pkgconfig_DATA += evas-opengl-x11.pc
endif
if BUILD_ENGINE_GL_SDL
pkgconfig_DATA += evas-opengl-sdl.pc
endif
if BUILD_ENGINE_QUARTZ
pkgconfig_DATA += evas-quartz.pc
endif

View File

@ -55,6 +55,7 @@ want_evas_engine_buffer="yes"
want_evas_engine_software_xlib="no"
want_evas_engine_xrender_x11="no"
want_evas_engine_gl_x11="no"
want_evas_engine_gl_sdl="no"
want_evas_engine_cairo_x11="no"
want_evas_engine_software_xcb="no"
want_evas_engine_xrender_xcb="no"
@ -482,6 +483,8 @@ 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])
EVAS_CHECK_ENGINE([fb], [${want_evas_engine_fb}], [no], [Framebuffer])
EVAS_CHECK_ENGINE([directfb], [${want_evas_engine_directfb}], [no], [DirectFB])
@ -505,7 +508,8 @@ EVAS_CHECK_ENGINE([software-16-wince], [${want_evas_engine_software_16_wince}],
# common gl
have_evas_engine_gl_common="no"
if test "x$have_evas_engine_gl_x11" = "xyes" -o "x$have_evas_engine_gl_glew" = "xyes"; then
if test "x$have_evas_engine_gl_x11" = "xyes" -o "x$have_evas_engine_gl_glew" = "xyes" \
-o "x$have_evas_gl_sdl" ="xyes"; then
AC_DEFINE(BUILD_ENGINE_GL_COMMON, 1, [Generic OpenGL Rendering Support])
have_evas_engine_gl_common="yes"
evas_engine_gl_common_libs=""
@ -519,6 +523,19 @@ AC_SUBST([evas_engine_gl_common_libs])
AM_CONDITIONAL(BUILD_ENGINE_GL_COMMON, test "x$have_evas_engine_gl_common" = "xyes")
# gl_sdl
if test "x$have_evas_engine_gl_sdl" = "xyes"; then
AC_CHECK_DECL(SDL_GL_CONTEXT_MAJOR_VERSION,
[AC_DEFINE(HAVE_SDL_GL_CONTEXT_VERSION, [], [SDL_GL version attributes present])],,
[#include <SDL/SDL_video.h>])
fi
if test "x$gl_flavor_gles" = "xyes"; then
AC_CHECK_DECL(SDL_OPENGLES,
[AC_DEFINE(HAVE_SDL_FLAG_OPENGLES, [], [SDL_OPENGLES flag is present])],,
[#include <SDL/SDL_video.h>])
fi
# SDL primitive
sdl_primitive="no"
@ -1228,6 +1245,7 @@ evas-directfb.pc
evas-fb.pc
evas-opengl-glew.pc
evas-opengl-x11.pc
evas-opengl-sdl.pc
evas-quartz.pc
evas-software-buffer.pc
evas-software-x11.pc
@ -1274,6 +1292,7 @@ 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/quartz/Makefile
src/modules/engines/xrender_x11/Makefile
src/modules/engines/software_sdl/Makefile
@ -1334,6 +1353,7 @@ echo " Direct3d...................: $have_evas_engine_direct3d"
echo " Quartz.....................: $have_evas_engine_quartz"
echo " OpenGL Glew................: $have_evas_engine_gl_glew"
echo " Software SDL...............: $have_evas_engine_software_sdl (primitive: $sdl_primitive)"
echo " OpenGL SDL.................: $have_evas_engine_gl_sdl"
echo " Software Framebuffer.......: $have_evas_engine_fb"
echo " DirectFB...................: $have_evas_engine_directfb"
#echo " Software Qtopia............: $have_evas_engine_software_qtopia"

View File

@ -487,6 +487,85 @@ fi
])
dnl use: EVAS_CHECK_ENGINE_DEP_GL_SDL(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_SDL],
[
requirement=""
have_dep="no"
evas_engine_[]$1[]_cflags=""
evas_engine_[]$1[]_libs=""
PKG_CHECK_MODULES([SDL],
[sdl >= 1.2.0],
[
have_dep="yes"
requirement="sdl"
evas_engine_[]$1[]_cflags="${SDL_CFLAGS}"
evas_engine_[]$1[]_libs="${SDL_LIBS}"
]
)
AC_CHECK_HEADERS([GL/gl.h],
[have_dep="yes"],
[have_dep="no"])
if test "x$gl_flavor_gles" = "xyes" ; then
have_dep=no
fi
if test "x${have_dep}" = "xyes" ; then
evas_engine_[]$1[]_cflags="${SDL_CFLAGS}"
evas_engine_[]$1[]_libs="${SDL_LIBS} -lGL -lpthread"
evas_engine_gl_common_libs="-lGL -lpthread"
else
AC_CHECK_HEADERS([EGL/egl.h], [have_egl="yes"])
if test "x${have_egl}" = "xyes" ; then
AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL -lpthread -lm)
if test "x${have_glesv2}" = "xyes" ; then
evas_engine_[]$1[]_cflags="${SDL_CFLAGS}"
evas_engine_[]$1[]_libs="${SDL_LIBS} -lGLESv2 -lpthread -lm -lEGL"
evas_engine_gl_common_libs="-lGLESv2 -lpthread -lm"
have_dep="yes"
fi
dnl samsung s3c6410 libs changed to be like the sgx ones. need a variety option
dnl have_gles20="no"
dnl AC_CHECK_LIB(gles20, glTexImage2D, [have_gles20="yes"], , -lEGL)
dnl if test "x${have_gles20}" = "xyes" ; then
dnl evas_engine_[]$1[]_cflags="${SDL_CFLAGS}"
dnl evas_engine_[]$1[]_libs="${SDL_LIBS} -lgles20 -lEGL"
dnl AC_DEFINE(GLES_VARIETY_S3C6410, 1, [Samsung S3c6410 GLES2 support])
dnl evas_engine_gl_common_libs="-lgles20"
dnl have_dep="yes"
dnl fi
dnl have_glesv2="no"
dnl AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL ${x_libs} -lpthread -lm)
dnl if test "x${have_glesv2}" = "xyes" ; then
dnl evas_engine_[]$1[]_cflags="${SDL_CFLAGS}"
dnl evas_engine_[]$1[]_libs="${SDL_LIBS} -lGLESv2 -lpthread -lm -lEGL"
dnl AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support])
dnl evas_engine_gl_common_libs="-lGLESv2 -lpthread -lm"
dnl have_dep="yes"
dnl fi
fi
fi
AC_SUBST([evas_engine_$1_cflags])
AC_SUBST([evas_engine_$1_libs])
if test "x$3" = "xstatic" ; then
requirement_evas="${requirement} ${requirement_evas}"
fi
if test "x${have_dep}" = "xyes" ; then
m4_default([$4], [:])
else
m4_default([$5], [:])
fi
])
dnl use: EVAS_CHECK_ENGINE_DEP_FB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
AC_DEFUN([EVAS_CHECK_ENGINE_DEP_FB],

View File

@ -0,0 +1,24 @@
#ifndef _EVAS_ENGINE_GL_SDL_H
#define _EVAS_ENGINE_GL_SDL_H
#include <SDL/SDL.h>
typedef struct _Evas_Engine_Info_GL_SDL Evas_Engine_Info_GL_SDL;
struct _Evas_Engine_Info_GL_SDL
{
/* 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 {
int rotation;
int fullscreen : 1;
int noframe : 1;
} flags;
};
#endif

View File

@ -0,0 +1,43 @@
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 \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@ \
@evas_engine_gl_sdl_cflags@
if BUILD_ENGINE_GL_SDL
GL_SDL_SOURCES = \
evas_engine.c
GL_SDL_LIBADD = @evas_engine_gl_sdl_libs@ $(top_builddir)/src/modules/engines/gl_common/libevas_engine_gl_common.la
pkgdir = $(libdir)/evas/modules/engines/gl_sdl/$(MODULE_ARCH)
include_HEADERS = Evas_Engine_GL_SDL.h
if !EVAS_STATIC_BUILD_GL_SDL
pkg_LTLIBRARIES = module.la
module_la_SOURCES = $(GL_SDL_SOURCES)
module_la_LIBADD = @EINA_LIBS@ $(GL_SDL_LIBADD) $(top_builddir)/src/lib/libevas.la @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version
module_la_LIBTOOLFLAGS = --tag=disable-static
else
noinst_LTLIBRARIES = libevas_engine_gl_sdl.la
libevas_engine_gl_sdl_la_SOURCES = $(GL_SDL_SOURCES)
libevas_engine_gl_sdl_la_LIBADD = $(GL_SDL_LIBADD)
endif
endif
EXTRA_DIST = evas_engine.h

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,78 @@
#ifndef EVAS_ENGINE_H
#define EVAS_ENGINE_H
#include "config.h"
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
# if defined(GLES_VARIETY_S3C6410)
# include <EGL/egl.h>
# include <GLES2/gl2.h>
# elif defined(GLES_VARIETY_SGX)
# include <EGL/egl.h>
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
# endif
# ifdef HAVE_SDL_FLAG_OPENGLES
# define EVAS_SDL_GL_FLAG SDL_OPENGLES
# else
# define EVAS_SDL_GL_FLAG SDL_OPENGL /* This probably won't work? */
# endif
#else
# define EVAS_SDL_GL_FLAG SDL_OPENGL
#endif
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#include <GL/gl.h>
#include "evas_common.h"
#include "evas_private.h"
#include "evas_gl_common.h"
#include "Evas.h"
#include "Evas_Engine_GL_SDL.h"
extern int _evas_engine_GL_SDL_log_dom ;
#ifdef ERR
# undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_GL_SDL_log_dom, __VA_ARGS__)
#ifdef DBG
# undef DBG
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_GL_SDL_log_dom, __VA_ARGS__)
#ifdef INF
# undef INF
#endif
#define INF(...) EINA_LOG_DOM_INFO(_evas_engine_GL_SDL_log_dom, __VA_ARGS__)
#ifdef WRN
# undef WRN
#endif
#define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_GL_SDL_log_dom, __VA_ARGS__)
#ifdef CRIT
# undef CRIT
#endif
#define CRIT(...) EINA_LOG_DOM_CRIT(_evas_engine_GL_SDL_log_dom, __VA_ARGS__)
typedef struct _Render_Engine Render_Engine;
struct _Render_Engine
{
Evas_Engine_Info_GL_SDL *info;
int w, h;
Evas_GL_Context *gl_context;
struct {
int redraw : 1;
int drew : 1;
int x1, y1, x2, y2;
} draw;
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
EGLContext egl_context[1];
EGLSurface egl_surface[1];
EGLConfig egl_config;
EGLDisplay egl_disp;
#endif
};
#endif