<html>
<body>
  <div id="body" style="background-color:#ffffff;" >
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head" style="border-bottom-width:1px;border-bottom-style:solid;" ><td class="headtd" style="padding:0;padding-top:.2em;" colspan="4">Commit in <b><tt>lxdream/src</tt></b></td></tr>
<tr><td><tt><a href="#file1">display.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+6</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f3da7d810d5c -> f502f3d32f90</td></tr>
<tr class="alt" style=";" ><td><tt>drivers/<a href="#file2">video_glx.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+24</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f3da7d810d5c -> f502f3d32f90</td></tr>
<tr><td><tt>       /<a href="#file3">video_nsgl.m</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+1</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f3da7d810d5c -> f502f3d32f90</td></tr>
<tr class="alt" style=";" ><td><tt>       /<a href="#file4">video_null.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+2</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-1</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f3da7d810d5c -> f502f3d32f90</td></tr>
<tr><td><tt><a href="#file5">main.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+3</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f3da7d810d5c -> f502f3d32f90</td></tr>
<tr class="alt" style=";" ><td><tt>pvr2/<a href="#file6">gl_sl.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+15</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f3da7d810d5c -> f502f3d32f90</td></tr>
<tr><td><tt>    /<a href="#file7">glutil.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+58</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-9</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f3da7d810d5c -> f502f3d32f90</td></tr>
<tr class="alt" style=";" ><td><tt>    /<a href="#file8">glutil.h</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+5</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f3da7d810d5c -> f502f3d32f90</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+114</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-10</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >8 modified files</small><br />
<pre class="comment" style="white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd;" >
Dump more information with --gl-info, and print it a little more nicely
</pre>
<hr /><a name="file1" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>display.h</b></big> <small id="info" style="color: #888888;" >f3da7d810d5c -> f502f3d32f90</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/display.h
+++ lxdream/src/display.h
@@ -104,6 +104,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > };
 
 struct display_capabilities {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    gboolean has_gl;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     int stencil_bits; /* 0 = no stencil buffer */
 };
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -211,6 +212,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     gboolean (*read_render_buffer)( unsigned char *target, render_buffer_t buffer,
             int rowstride, int format );
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    /**
+     * Dump driver-specific information about the implementation to the given stream
+     */
+    void (*print_info)( FILE *out );
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     struct display_capabilities capabilities;
 } *display_driver_t;
 
</pre></div>
<hr /><a name="file2" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>video_glx.c</b></big> <small id="info" style="color: #888888;" >f3da7d810d5c -> f502f3d32f90</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/video_glx.c
+++ lxdream/src/drivers/video_glx.c
@@ -43,6 +43,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > static GLuint glx_pbuffer_texture = 0; 
 
 static void video_glx_swap_buffers( void );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static void video_glx_print_info( FILE *out );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /* Prototypes for pbuffer support methods */
 static void glx_pbuffer_init( display_driver_t driver );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -167,6 +168,27 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     return TRUE;
 }
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static void video_glx_print_info( FILE *out )
+{
+    XWindowAttributes attr;
+
+    if( !XGetWindowAttributes(video_x11_display, video_x11_window, &attr) )
+        return; /* Failed */
+    int screen = XScreenNumberOfScreen(attr.screen);
+
+    fprintf( out, "GLX Server: %s %s\n", glXQueryServerString(video_x11_display, screen, GLX_VENDOR),
+            glXQueryServerString(video_x11_display, screen, GLX_VERSION) );
+    fprintf( out, "GLX Client: %s %s\n", glXGetClientString(video_x11_display, GLX_VENDOR),
+            glXGetClientString(video_x11_display, GLX_VERSION) );
+    fprintf( out, "GLX Server Extensions:\n" );
+    fprint_extensions( out, glXQueryServerString(video_x11_display, screen, GLX_EXTENSIONS) );
+    fprintf( out, "GLX Client Extensions:\n" );
+    fprint_extensions( out, glXGetClientString(video_x11_display, GLX_EXTENSIONS) );
+    fprintf( out, "GLX Extensions:\n" );
+    fprint_extensions( out, glXQueryExtensionsString(video_x11_display, screen) );
+
+}
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > gboolean video_glx_init_context( Display *display, Window window )
 {
     if( glx_fbconfig_supported ) {
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -210,6 +232,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > gboolean video_glx_init_driver( display_driver_t driver )
 {
     driver->swap_buffers = video_glx_swap_buffers;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    driver->print_info = video_glx_print_info;
+    driver->capabilities.has_gl = TRUE;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( gl_fbo_is_supported() ) { // First preference
         gl_fbo_init(driver);
     } else if( glx_pbuffer_supported ) {
</pre></div>
<hr /><a name="file3" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>video_nsgl.m</b></big> <small id="info" style="color: #888888;" >f3da7d810d5c -> f502f3d32f90</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/video_nsgl.m
+++ lxdream/src/drivers/video_nsgl.m
@@ -41,6 +41,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     [nsgl_context makeCurrentContext];
     [pool release];
     driver->swap_buffers = video_nsgl_swap_buffers;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    driver->capabilities.has_gl = TRUE;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( gl_fbo_is_supported() ) {
         gl_fbo_init(driver);
     } else {
</pre></div>
<hr /><a name="file4" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>video_null.c</b></big> <small id="info" style="color: #888888;" >f3da7d810d5c -> f502f3d32f90</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/video_null.c
+++ lxdream/src/drivers/video_null.c
@@ -76,4 +76,5 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         video_null_display_render_buffer,
         video_null_display_blank,
         video_null_swap_buffers,
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        video_null_read_render_buffer<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" > };</span>
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        video_null_read_render_buffer<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >,</span>
+        NULL };
</pre></div>
<hr /><a name="file5" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>main.c</b></big> <small id="info" style="color: #888888;" >f3da7d810d5c -> f502f3d32f90</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/main.c
+++ lxdream/src/main.c
@@ -254,6 +254,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             ERROR( "Video driver '%s' failed to initialize (could not connect to display?)",
                     display_driver->name );
             exit(2);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        } else if( display_driver->capabilities.has_gl == FALSE ) {
+            ERROR( "Video driver '%s' has no GL capabilities.", display_driver_name );
+            exit(2);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         }
         glPrintInfo(stdout);
         exit(0);
</pre></div>
<hr /><a name="file6" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>gl_sl.c</b></big> <small id="info" style="color: #888888;" >f3da7d810d5c -> f502f3d32f90</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/gl_sl.c
+++ lxdream/src/pvr2/gl_sl.c
@@ -51,6 +51,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     isGLExtensionSupported("GL_ARB_shading_language_100");
 }
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+const char *glsl_get_version()
+{
+    return glGetString(GL_SHADING_LANGUAGE_VERSION_ARB);
+}
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > void glsl_print_error( char *msg, GLhandleARB obj )
 {
     char buf[MAX_ERROR_BUF];
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -156,6 +161,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     isGLExtensionSupported("GL_ARB_shading_language_100");
 }
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+const char *glsl_get_version()
+{
+    return glGetString(GL_SHADING_LANGUAGE_VERSION);
+}
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > gboolean glsl_check_shader_error( char *msg, GLuint shader )
 {
     GLint value;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -256,6 +266,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     return FALSE;
 }
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+int glsl_get_version()
+{
+    return 0;
+}
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > gl_shader_t glsl_create_vertex_shader( const char *source )
 {
     return 0;
</pre></div>
<hr /><a name="file7" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>glutil.c</b></big> <small id="info" style="color: #888888;" >f3da7d810d5c -> f502f3d32f90</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/glutil.c
+++ lxdream/src/pvr2/glutil.c
@@ -41,6 +41,12 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     return isGLExtensionSupported("GL_ARB_texture_mirrored_repeat");
 }
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+gboolean isGLVertexRangeSupported()
+{
+    return isGLExtensionSupported("GL_APPLE_vertex_array_range") ||
+            isGLExtensionSupported("GL_NV_vertex_array_range");
+}
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /**
  * Test if a specific extension is supported. From opengl.org
  * @param extension extension name to check for
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -86,23 +92,66 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     return strcmp(*ca, *cb);
 }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-void glPrintInfo( FILE *out )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define DEFAULT_TERMINAL_COLUMNS 80
+#define DEFAULT_COLUMN_WIDTH 34
+
+/**
+ * Format a GL extension list (or other space-separated string) nicely, and
+ * print to the given output stream.
+ */
+
+void fprint_extensions( FILE *out, const char *extensions )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    const gchar *extensions = (const gchar *)glGetString(GL_EXTENSIONS);
-    gchar **ext_split = g_strsplit(extensions, " ", 0);
-    unsigned int i, count;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    unsigned int i, j, count, maxlen = DEFAULT_COLUMN_WIDTH, columns, per_column, terminal_columns;
+    const char *terminal_columns_str = getenv("COLUMNS");
+    if( terminal_columns_str == NULL || (terminal_columns = strtol(terminal_columns_str,0,10)) == 0 )
+        terminal_columns = DEFAULT_TERMINAL_COLUMNS;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    for( count = 0; ext_split[count] != NULL; count++ );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    if( extensions == NULL || extensions[0] == '\0' )
+        return;
+
+    gchar *ext_dup = g_strdup(extensions);
+    gchar **ext_split = g_strsplit(g_strstrip(extensions), " ", 0);
+    for( count = 0; ext_split[count] != NULL; count++ ) {
+        unsigned len = strlen(ext_split[count]);
+        if( len > maxlen )
+            maxlen = len;
+    }
+
+    columns = terminal_columns / (maxlen+2);
+    if( columns == 0 )
+        columns = 1;
+    per_column = (count+columns-1) / columns;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
     qsort(ext_split, count, sizeof(gchar *), compare_charp);
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    for( i=0; i<per_column; i++ ) {
+        for( j=0; j<columns; j++ ) {
+            unsigned idx = i + (j*per_column);
+            if( idx < count )
+                fprintf( out, "  %-*s", maxlen, ext_split[idx] );
+        }
+        fprintf( out, "\n" );
+    }
+    g_strfreev(ext_split);
+    g_free(ext_dup);
+}
+
+void glPrintInfo( FILE *out )
+{
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     fprintf( out, "GL Vendor: %s\n", glGetString(GL_VENDOR) );
     fprintf( out, "GL Renderer: %s\n", glGetString(GL_RENDERER) );
     fprintf( out, "GL Version: %s\n", glGetString(GL_VERSION) );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    if( glsl_is_supported() ) {
+         const char * version = glsl_get_version();
+         fprintf( out, "SL Version: %s\n", version );
+    }
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    fprintf( out, "Supported GL Extensions:\n" );
-    for( i=0; ext_split[i] != NULL; i++ ) {
-        fprintf( out, "  %s\n", ext_split[i] );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    fprintf( out, "GL Extensions:\n" );
+
+    fprint_extensions( out, (const gchar *)glGetString(GL_EXTENSIONS) );
+    if( display_driver && display_driver->print_info ) {
+        fprintf( out, "\n");
+        display_driver->print_info(out);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    g_strfreev(ext_split);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
</pre></div>
<hr /><a name="file8" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>glutil.h</b></big> <small id="info" style="color: #888888;" >f3da7d810d5c -> f502f3d32f90</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/glutil.h
+++ lxdream/src/pvr2/glutil.h
@@ -45,16 +45,21 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > gboolean isGLSecondaryColorSupported();
 
 gboolean isGLVertexBufferSupported();
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+gboolean isGLVertexRangeSupported();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > gboolean isGLPixelBufferSupported();
 gboolean isGLMirroredTextureSupported();
 
 /****** Shader handling (gl_sl.c) *****/
 gboolean glsl_is_supported(void);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+const char *glsl_get_version(void);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > gboolean glsl_load_shaders( );
 void glsl_unload_shaders(void);
 gboolean glsl_set_shader( unsigned program_id );
 void glsl_clear_shader();
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/* Convenience formatting function for driver use */
+void fprint_extensions( FILE *out, const char *extensions );
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #ifdef __cplusplus
 }
 #endif
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>