Search
lxdream.org :: lxdream :: r1129:7b16bbd6209c
lxdream 0.9.1
released Jun 29
Download Now
changeset1129:7b16bbd6209c
parent1128:180abbb2a1f3
child1130:5f56fc931112
authornkeynes
dateFri Sep 17 20:05:34 2010 +1000 (9 years ago)
Add undocumented option --gl-info to dump out the GL identification and extension list
src/main.c
src/pvr2/glutil.c
1.1 --- a/src/main.c Fri Sep 17 20:04:02 2010 +1000
1.2 +++ b/src/main.c Fri Sep 17 20:05:34 2010 +1000
1.3 @@ -24,23 +24,26 @@
1.4 #include "lxdream.h"
1.5 #include "lxpaths.h"
1.6 #include "gettext.h"
1.7 -#include "mem.h"
1.8 +#include "dream.h"
1.9 #include "dreamcast.h"
1.10 -#include "dream.h"
1.11 #include "display.h"
1.12 #include "gui.h"
1.13 #include "gdlist.h"
1.14 +#include "hotkeys.h"
1.15 +#include "loader.h"
1.16 +#include "mem.h"
1.17 +#include "plugin.h"
1.18 +#include "serial.h"
1.19 #include "syscall.h"
1.20 -#include "loader.h"
1.21 #include "aica/audio.h"
1.22 +#include "aica/armdasm.h"
1.23 #include "gdrom/gdrom.h"
1.24 #include "maple/maple.h"
1.25 +#include "pvr2/glutil.h"
1.26 #include "sh4/sh4.h"
1.27 -#include "aica/armdasm.h"
1.28 #include "vmu/vmulist.h"
1.29 -#include "serial.h"
1.30 -#include "hotkeys.h"
1.31 -#include "plugin.h"
1.32 +
1.33 +#define GL_INFO_OPT 1
1.34
1.35 char *option_list = "a:A:bc:e:dfg:G:hHl:m:npt:T:uvV:xX?";
1.36 struct option longopts[] = {
1.37 @@ -52,7 +55,8 @@
1.38 { "execute", required_argument, NULL, 'e' },
1.39 { "fullscreen", no_argument, NULL, 'f' },
1.40 { "gdb-sh4", required_argument, NULL, 'g' },
1.41 - { "gdb-arm", required_argument, NULL, 'G' },
1.42 + { "gdb-arm", required_argument, NULL, 'G' },
1.43 + { "gl-info", no_argument, NULL, GL_INFO_OPT },
1.44 { "help", no_argument, NULL, 'h' },
1.45 { "headless", no_argument, NULL, 'H' },
1.46 { "log", required_argument, NULL,'l' },
1.47 @@ -127,6 +131,7 @@
1.48 int opt;
1.49 double t;
1.50 gboolean display_ok, have_disc = FALSE, have_save = FALSE, have_exec = FALSE;
1.51 + gboolean print_glinfo = FALSE;
1.52 uint32_t time_secs, time_nanos;
1.53 const char *exec_name = NULL;
1.54
1.55 @@ -214,6 +219,9 @@
1.56 case 'X': /* Shadow translator */
1.57 sh4_core = SH4_SHADOW;
1.58 break;
1.59 + case GL_INFO_OPT:
1.60 + print_glinfo = TRUE;
1.61 + break;
1.62 }
1.63 }
1.64
1.65 @@ -236,6 +244,23 @@
1.66 exit(0);
1.67 }
1.68
1.69 + if( print_glinfo ) {
1.70 + gui_init(FALSE, FALSE);
1.71 + display_driver_t display_driver = get_display_driver_by_name(display_driver_name);
1.72 + if( display_driver == NULL ) {
1.73 + ERROR( "Video driver '%s' not found, aborting.", display_driver_name );
1.74 + exit(2);
1.75 + } else if( display_set_driver( display_driver ) == FALSE ) {
1.76 + ERROR( "Video driver '%s' failed to initialize (could not connect to display?)",
1.77 + display_driver->name );
1.78 + exit(2);
1.79 + }
1.80 + glPrintInfo(stdout);
1.81 + exit(0);
1.82 +
1.83 + }
1.84 +
1.85 +
1.86 iso_init();
1.87 gdrom_list_init();
1.88 vmulist_init();
2.1 --- a/src/pvr2/glutil.c Fri Sep 17 20:04:02 2010 +1000
2.2 +++ b/src/pvr2/glutil.c Fri Sep 17 20:05:34 2010 +1000
2.3 @@ -17,6 +17,7 @@
2.4 */
2.5
2.6 #include <string.h>
2.7 +#include <stdlib.h>
2.8 #include <glib/gstrfuncs.h>
2.9 #include "pvr2/glutil.h"
2.10
2.11 @@ -78,11 +79,22 @@
2.12 return FALSE;
2.13 }
2.14
2.15 +int compare_charp( const void *a, const void *b )
2.16 +{
2.17 + const char **ca = (const char **)a;
2.18 + const char **cb = (const char **)b;
2.19 + return strcmp(*ca, *cb);
2.20 +}
2.21 +
2.22 void glPrintInfo( FILE *out )
2.23 {
2.24 const gchar *extensions = (const gchar *)glGetString(GL_EXTENSIONS);
2.25 gchar **ext_split = g_strsplit(extensions, " ", 0);
2.26 - unsigned int i;
2.27 + unsigned int i, count;
2.28 +
2.29 + for( count = 0; ext_split[count] != NULL; count++ );
2.30 +
2.31 + qsort(ext_split, count, sizeof(gchar *), compare_charp);
2.32
2.33 fprintf( out, "GL Vendor: %s\n", glGetString(GL_VENDOR) );
2.34 fprintf( out, "GL Renderer: %s\n", glGetString(GL_RENDERER) );
.