Bug fix for enable/disabling of glx double buffering. Single buffering allows for faster emulation rates, double buffering is not allowing faster than 60hz due to vsync.

This commit is contained in:
Matthew Budd 2020-06-14 10:15:47 -04:00
parent a1c0e86026
commit f5e8b09200
3 changed files with 22 additions and 14 deletions

View File

@ -32,7 +32,7 @@ static Window win;
static GLXContext glc = NULL;
static XWindowAttributes gwa;
static XEvent xev;
static GLint double_buffer_ena = True;
static GLint double_buffer_ena = 1;
static GLuint gltexture = 0;
static int spawn_new_window = 0;
@ -91,8 +91,11 @@ static void getAttrbList( GLint *buf )
buf[i] = GLX_RGBA; i++;
buf[i] = GLX_DEPTH_SIZE; i++;
buf[i] = 24; i++;
buf[i] = GLX_DOUBLEBUFFER ; i++;
buf[i] = double_buffer_ena; i++;
if ( double_buffer_ena )
{
buf[i] = GLX_DOUBLEBUFFER ; i++;
}
buf[i] = None;
}
@ -280,9 +283,14 @@ static void render_image(void)
//glVertex2f( 1.0f, 1.0f); // Top right of target.
//glEnd();
glFlush();
glXSwapBuffers( dpy, win );
if ( double_buffer_ena )
{
glXSwapBuffers( dpy, win );
}
else
{
glFlush();
}
}
//************************************************************************
static int mainWindowLoop(void)

View File

@ -191,7 +191,7 @@ int configGamepadButton (GtkButton * button, gpointer p)
void resetVideo (void)
{
resizeGtkWindow ();
//resizeGtkWindow ();
KillVideo ();
InitVideo (GameInfo);
}
@ -3399,7 +3399,7 @@ static void cairo_handle_resize(void)
cairo_surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, w, h );
//cairo_surface = cairo_image_surface_create( CAIRO_FORMAT_RGB24, w, h );
printf("Cairo Surface: %p \n", cairo_surface );
//printf("Cairo Surface: %p \n", cairo_surface );
//cairo_format = cairo_image_surface_get_format( cairo_surface );
@ -3532,11 +3532,11 @@ gboolean handle_resize (GtkWindow * win, GdkEvent * event, gpointer data)
//gtk_widget_realize(evbox);
//flushGtkEvents ();
if ( winsize_changed && (GameInfo != 0) )
{
KillVideo ();
InitVideo (GameInfo);
}
//if ( winsize_changed && (GameInfo != 0) )
//{
// KillVideo ();
// InitVideo (GameInfo);
//}
gtk_widget_queue_draw( evbox );

View File

@ -100,7 +100,7 @@ KillVideo()
glx_shm->clear_pixbuf();
}
//destroy_gui_video();
destroy_gui_video();
// return failure if the video system was not initialized
if (s_inited == 0)