Commit a9ce9ef9 authored by Patrice Mandin's avatar Patrice Mandin

Final touches to OSMesa OpenGL support on Atari, using loadable libraries....

Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40992
parent 154c8f58
......@@ -1133,20 +1133,34 @@ dnl Check for Mesa offscreen rendering
CheckAtariOSMesa()
{
if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
# Static linking to -lOSMesa
AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
# -lOSMesa is really the static library
if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
CFLAGS="$CFLAGS -DHAVE_OPENGL"
SYSTEM_LIBS="$SYSTEM_LIBS -lOSMesa"
fi
else
# -lOSMesa is a loader for OSMesa.ldg
OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
OSMESA_LIBS=`$OSMESA_CONFIG --libs`
CFLAGS="$CFLAGS -DHAVE_OPENGL $OSMESA_CFLAGS"
SYSTEM_LIBS="$SYSTEM_LIBS $OSMESA_LIBS"
fi
AC_ARG_ENABLE(osmesa-shared,
[ --enable-osmesa-shared dynamically load OSMesa OpenGL support [default=yes]],
, enable_osmesa_shared=yes)
if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
# Dynamic linking
if test "x$have_osmesa_hdr" = "xyes"; then
CFLAGS="$CFLAGS -DENABLE_OSMESA_SHARED"
fi
fi
fi
}
......
This diff is collapsed.
......@@ -33,25 +33,49 @@
#define _THIS SDL_VideoDevice *this
struct SDL_PrivateGLData {
/* to stop switching drivers while we have a valid context */
int gl_active;
int gl_active; /* to stop switching drivers while we have a valid context */
int gl_oldmesa; /* Old OpenGL support ? */
int gl_pixelsize; /* for CopyShadow functions */
Uint8 *gl_shadow; /* Shadow buffer for old implementations */
/* for unsupported OSMesa buffer formats */
void (*ConvertSurface)(SDL_Surface *surface);
void (*ConvertSurface)(_THIS, SDL_Surface *surface);
/* to convert the shadow buffer to the screen format */
void (*CopyShadow)(_THIS, SDL_Surface *surface);
#ifdef HAVE_OPENGL
OSMesaContext ctx;
#endif
/* osmesa.ldg */
OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist);
void (*OSMesaDestroyContext)( OSMesaContext ctx );
GLboolean (*OSMesaMakeCurrent)( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height );
void (*OSMesaPixelStore)( GLint pname, GLint value );
void * (*OSMesaGetProcAddress)( const char *funcName );
void (*glGetIntegerv)( GLenum pname, GLint *value );
/* mesa_gl.ldg, tiny_gl.ldg */
void *(*OSMesaCreateLDG)( long format, long type, long width, long height );
void (*OSMesaDestroyLDG)(void);
};
/* Old variable names */
/* Variable names */
#define gl_active (this->gl_data->gl_active)
#define gl_ctx (this->gl_data->ctx)
#define gl_oldmesa (this->gl_data->gl_oldmesa)
#define gl_pixelsize (this->gl_data->gl_pixelsize)
#define gl_shadow (this->gl_data->gl_shadow)
#define gl_convert (this->gl_data->ConvertSurface)
#define gl_copyshadow (this->gl_data->CopyShadow)
/* OpenGL functions */
extern int SDL_AtariGL_Init(_THIS, SDL_Surface *current);
extern void SDL_AtariGL_Quit(_THIS);
extern void SDL_AtariGL_InitPointers(_THIS);
extern int SDL_AtariGL_LoadLibrary(_THIS, const char *path);
extern void *SDL_AtariGL_GetProcAddress(_THIS, const char *proc);
......
......@@ -313,27 +313,11 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
if (GEM_version >= 0x0410) {
short ap_gout[4], errorcode;
#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: AES %02x.%02x\n", (GEM_version>>8) & 0xff, GEM_version & 0xff);
#endif
GEM_wfeatures=0;
errorcode=appl_getinfo(AES_WINDOW, &ap_gout[0], &ap_gout[1], &ap_gout[2], &ap_gout[3]);
#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: appl_getinfo() returned 0x%04x\n", errorcode);
#endif
if (errorcode==0) {
GEM_wfeatures=ap_gout[0];
#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: AES wind_*() modes: 0x%04x\n", GEM_wfeatures);
printf("sdl:video:gem: AES window behaviours: 0x%04x\n", ap_gout[3]);
} else {
printf("sdl:video:gem: apgout[]={0x%04x,0x%04x,0x%04x,0x%04x}\n",
ap_gout[0], ap_gout[1], ap_gout[1], ap_gout[3]
);
#endif
}
}
......@@ -468,8 +452,8 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
SDL_modelist[1] = NULL;
#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: VideoInit(): done\n");
#ifdef HAVE_OPENGL
SDL_AtariGL_InitPointers(this);
#endif
/* We're done! */
......@@ -492,7 +476,9 @@ SDL_Rect **GEM_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
static void GEM_FreeBuffers(_THIS)
{
#ifdef HAVE_OPENGL
if (gl_active) {
SDL_AtariGL_Quit(this);
}
#endif
/* Release buffer */
......@@ -1290,12 +1276,11 @@ static void refresh_window(_THIS, int winhandle, short *rect)
static void GEM_GL_SwapBuffers(_THIS)
{
if (gl_ctx == NULL) {
return;
}
gl_convert(this->screen);
if (gl_active) {
gl_copyshadow(this, this->screen);
gl_convert(this, this->screen);
GEM_FlipHWSurface(this, this->screen);
}
}
#endif
......@@ -411,6 +411,10 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
/* Init chunky to planar routine */
SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8;
#ifdef HAVE_OPENGL
SDL_AtariGL_InitPointers(this);
#endif
/* We're done! */
return(0);
}
......@@ -431,7 +435,9 @@ static void XBIOS_FreeBuffers(_THIS)
int i;
#ifdef HAVE_OPENGL
if (gl_active) {
SDL_AtariGL_Quit(this);
}
#endif
for (i=0;i<2;i++) {
......@@ -876,12 +882,12 @@ static void XBIOS_VideoQuit(_THIS)
static void XBIOS_GL_SwapBuffers(_THIS)
{
if (gl_ctx == NULL) {
return;
}
if (gl_active) {
gl_copyshadow(this, this->screen);
gl_convert(this, this->screen);
XBIOS_FlipHWSurface(this, this->screen);
SDL_AtariGL_MakeCurrent(this);
}
}
#endif
......@@ -28,7 +28,7 @@ case "$target" in
MATHLIB=""
SYS_GL_LIBS="-lGL"
;;
*-*-darwin* | *-*-mint* )
*-*-darwin* )
MATHLIB=""
SYS_GL_LIBS=""
;;
......@@ -38,6 +38,18 @@ case "$target" in
fi
SYS_GL_LIBS=""
;;
*-*-mint*)
MATHLIB=""
AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
if test "x$OSMESA_CONFIG" = "xyes"; then
OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
OSMESA_LIBS=`$OSMESA_CONFIG --libs`
CFLAGS="$CFLAGS $OSMESA_CFLAGS"
SYS_GL_LIBS="$OSMESA_LIBS"
else
SYS_GL_LIBS="-lOSMesa"
fi
;;
*)
MATHLIB="-lm"
AC_PATH_X
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment