gtk-port: add software rasterizer

gtk-port changes:
adding software rasterizer to the gtk port
adding option to select 3d renderer (null by default)

configure.ac: make osmesa enabling macro a bit more explicit
This commit is contained in:
matusz 2009-03-27 12:50:47 +00:00
parent 8910583330
commit a6c84b7078
3 changed files with 71 additions and 58 deletions

View File

@ -53,17 +53,18 @@ AC_CHECK_HEADERS([GL/gl.h])
AC_CHECK_HEADERS([GL/glu.h]) AC_CHECK_HEADERS([GL/glu.h])
dnl - if --enable-osmesa is used, check for it dnl - if --enable-osmesa is used, check for it
AC_ARG_ENABLE(osmesa, AC_ARG_ENABLE([osmesa],
[AC_HELP_STRING(--enable-osmesa, use off-screen mesa)], [AC_HELP_STRING([--enable-osmesa], [use off-screen mesa])],
[ [osmesa=$enableval],
if test "x$enableval" = "xyes" ; then [osmesa=no])
if test "x$osmesa" = "xyes" ; then
AC_CHECK_LIB(OSMesa, main,[ AC_CHECK_LIB(OSMesa, main,[
useosmesa=yes useosmesa=yes
AC_DEFINE(HAVE_LIBOSMESA) AC_DEFINE(HAVE_LIBOSMESA)
LIBS="-lOSMesa $LIBS" LIBS="-lOSMesa $LIBS"
]) ])
fi fi
])
dnl - Check for GTK and/or libglade dnl - Check for GTK and/or libglade
GLIB_VER=2.8 GLIB_VER=2.8

View File

@ -169,7 +169,7 @@ fill_config( struct my_config *config,
printf( " --load-slot=NUM Loads savegame from slot NUM\n"); printf( " --load-slot=NUM Loads savegame from slot NUM\n");
printf( " --disable-sound Disables the sound emulation\n"); printf( " --disable-sound Disables the sound emulation\n");
printf( " --disable-limiter Disables the 60 fps limiter\n"); printf( " --disable-limiter Disables the 60 fps limiter\n");
printf( " --3d-engine=ENGINE Enables software 3d rasterizer, available ENGINES:\n"); printf( " --3d-engine=ENGINE Select 3d rendering engine, available ENGINES:\n");
printf( " 0 = 3d disabled - default\n"); printf( " 0 = 3d disabled - default\n");
printf( " 1 = internal desmume software rasterizer\n"); printf( " 1 = internal desmume software rasterizer\n");
#ifdef INCLUDE_OPENGL_2D #ifdef INCLUDE_OPENGL_2D

View File

@ -38,6 +38,7 @@
#include "render3D.h" #include "render3D.h"
#include "desmume.h" #include "desmume.h"
#include "debug.h" #include "debug.h"
#include "rasterize.h"
#ifdef GDB_STUB #ifdef GDB_STUB
#include "gdbstub.h" #include "gdbstub.h"
@ -118,7 +119,8 @@ NULL
}; };
GPU3DInterface *core3DList[] = { GPU3DInterface *core3DList[] = {
&gpu3DNull &gpu3DNull,
&gpu3DRasterize
#if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA) #if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA)
, ,
&gpu3Dgl &gpu3Dgl
@ -131,7 +133,7 @@ struct configured_features {
int soft_colour; int soft_colour;
int disable_sound; int disable_sound;
int disable_3d; int engine_3d;
int disable_limiter; int disable_limiter;
int arm9_gdb_port; int arm9_gdb_port;
@ -154,7 +156,7 @@ init_configured_features( struct configured_features *config)
config->opengl = 0; config->opengl = 0;
config->soft_colour = 0; config->soft_colour = 0;
config->disable_3d = 0; config->engine_3d = 0;
config->disable_limiter = 0; config->disable_limiter = 0;
@ -173,19 +175,30 @@ fill_configured_features( struct configured_features *config,
GOptionEntry options[] = { GOptionEntry options[] = {
#ifdef GTKGLEXT_AVAILABLE #ifdef GTKGLEXT_AVAILABLE
{ "opengl-2d", 0, 0, G_OPTION_ARG_NONE, &config->opengl, "Enables using OpenGL for screen rendering", NULL}, { "opengl-2d", 0, 0, G_OPTION_ARG_NONE, &config->opengl, "Enables using OpenGL for screen rendering", NULL},
{ "soft-convert", 0, 0, G_OPTION_ARG_NONE, &config->soft_colour, "Use software colour conversion during OpenGL screen rendering." { "soft-convert", 0, 0, G_OPTION_ARG_NONE, &config->soft_colour,
" May produce better or worse frame rates depending on hardware", NULL}, "Use software colour conversion during OpenGL screen rendering.\n"
{ "disable-3d", 0, 0, G_OPTION_ARG_NONE, &config->disable_3d, "Disables the 3D emulation", NULL}, "\t\t\t\t May produce better or worse frame rates depending on hardware", NULL},
#endif #endif
{ "3d-engine", 0, 0, G_OPTION_ARG_INT, &config->engine_3d, "Select 3d rendering engine. Available engines:\n"
"\t\t\t\t 0 = 3d disabled\n"
"\t\t\t\t 1 = internal rasterizer\n"
// GTKGLEXT and LIBOSMESA are currently exclusive, so, no conflict below
#ifdef GTKGLEXT_AVAILABLE
"\t\t\t\t 2 = gtkglext off-screen opengl\n"
#endif
#ifdef HAVE_LIBOSMESA
"\t\t\t\t 2 = osmesa opengl\n"
#endif
,"ENGINE"},
{ "disable-sound", 0, 0, G_OPTION_ARG_NONE, &config->disable_sound, "Disables the sound emulation", NULL}, { "disable-sound", 0, 0, G_OPTION_ARG_NONE, &config->disable_sound, "Disables the sound emulation", NULL},
{ "disable-limiter", 0, 0, G_OPTION_ARG_NONE, &config->disable_limiter, "Disables the 60fps limiter", NULL}, { "disable-limiter", 0, 0, G_OPTION_ARG_NONE, &config->disable_limiter, "Disables the 60fps limiter", NULL},
{ "fwlang", 0, 0, G_OPTION_ARG_INT, &config->firmware_language, "Set the language in the firmware, LANG as follows:\n" { "fwlang", 0, 0, G_OPTION_ARG_INT, &config->firmware_language, "Set the language in the firmware, LANG as follows:\n"
" \t\t\t\t 0 = Japanese\n" "\t\t\t\t 0 = Japanese\n"
" \t\t\t\t 1 = English\n" "\t\t\t\t 1 = English\n"
" \t\t\t\t 2 = French\n" "\t\t\t\t 2 = French\n"
" \t\t\t\t 3 = German\n" "\t\t\t\t 3 = German\n"
" \t\t\t\t 4 = Italian\n" "\t\t\t\t 4 = Italian\n"
" \t\t\t\t 5 = Spanish\n" "\t\t\t\t 5 = Spanish\n",
"LANG"}, "LANG"},
#ifdef GDB_STUB #ifdef GDB_STUB
{ "arm9gdb", 0, 0, G_OPTION_ARG_INT, &config->arm9_gdb_port, "Enable the ARM9 GDB stub on the given port", "PORT_NUM"}, { "arm9gdb", 0, 0, G_OPTION_ARG_INT, &config->arm9_gdb_port, "Enable the ARM9 GDB stub on the given port", "PORT_NUM"},
@ -219,6 +232,19 @@ fill_configured_features( struct configured_features *config,
goto error; goto error;
} }
if (config->engine_3d != 0 && config->engine_3d != 1
#if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA)
&& config->engine_3d != 2
#endif
) {
g_printerr("Currently available ENGINES: 0, 1"
#if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA)
", 2"
#endif
"\n");
goto error;
}
#ifdef GDB_STUB #ifdef GDB_STUB
if (config->arm9_gdb_port != 0 && (config->arm9_gdb_port < 1 || config->arm9_gdb_port > 65535)) { if (config->arm9_gdb_port != 0 && (config->arm9_gdb_port < 1 || config->arm9_gdb_port > 65535)) {
g_printerr("ARM9 GDB stub port must be in the range 1 to 65535\n"); g_printerr("ARM9 GDB stub port must be in the range 1 to 65535\n");
@ -1984,39 +2010,25 @@ common_gtk_main( struct configured_features *my_config)
/* /*
* Set the 3D emulation to use * Set the 3D emulation to use
*/ */
{ printf("3d engine: %d\n", my_config->engine_3d);
int use_null_3d = my_config->disable_3d; unsigned core = my_config->engine_3d;
/* setup the gdk 3D emulation; GTKGLEXT and LIBOSMESA are exclusive currently */
#if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA) #if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA)
if ( !use_null_3d) { if(my_config->engine_3d == 2){
/* setup the gdk 3D emulation */ #if defined(GTKGLEXT_AVAILABLE)
#ifdef GTKGLEXT_AVAILABLE core = init_opengl_gdk_3Demu(GDK_DRAWABLE(pWindow->window)) ? 2 : GPU3D_NULL;
if ( init_opengl_gdk_3Demu(GDK_DRAWABLE(pWindow->window))) {
#else #else
if ( init_osmesa_3Demu()) { core = init_osmesa_3Demu() ? 2 : GPU3D_NULL;
#endif #endif
NDS_3D_SetDriver ( 1); }
#endif
printf("changing 3d core to %u\n", core);
NDS_3D_ChangeCore(core);
if (!gpu3D->NDS_3D_Init ()) { if(my_config->engine_3d != 0 && gpu3D == &gpu3DNull){
g_printerr("Failed to initialise openGL 3D emulation; " g_printerr("Failed to initialise openGL 3D emulation; "
"removing 3D support\n"); "removing 3D support\n");
use_null_3d = 1;
} }
}
else {
g_printerr("Failed to setup openGL 3D emulation; "
"removing 3D support\n");
use_null_3d = 1;
}
}
#endif
if ( use_null_3d) {
NDS_3D_SetDriver ( 0);
gpu3D->NDS_3D_Init();
}
}
/* Vérifie la ligne de commandes */ /* Vérifie la ligne de commandes */
if( my_config->nds_file != NULL) { if( my_config->nds_file != NULL) {