gsdx-gui-linux: add debug option in the gui

* Only for debug/dev build
* look awful (expand/fill) but otherwise it is nice for the debug ;)
This commit is contained in:
Gregory Hainaut 2015-05-07 23:06:43 +02:00
parent d20501739f
commit 7518b2ef21
2 changed files with 54 additions and 26 deletions

View File

@ -1148,28 +1148,30 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto
void GSDeviceOGL::CheckDebugLog() void GSDeviceOGL::CheckDebugLog()
{ {
unsigned int count = 16; // max. num. of messages that will be read from the log if (!theApp.GetConfig("debug_opengl", 0)) return;
int bufsize = 2048;
unsigned int sources[16] = {};
unsigned int types[16] = {};
unsigned int ids[16] = {};
unsigned int severities[16] = {};
int lengths[16] = {};
char* messageLog = new char[bufsize];
unsigned int retVal = gl_GetDebugMessageLogARB(count, bufsize, sources, types, ids, severities, lengths, messageLog); unsigned int count = 16; // max. num. of messages that will be read from the log
int bufsize = 2048;
unsigned int sources[16] = {};
unsigned int types[16] = {};
unsigned int ids[16] = {};
unsigned int severities[16] = {};
int lengths[16] = {};
char* messageLog = new char[bufsize];
if(retVal > 0) unsigned int retVal = gl_GetDebugMessageLogARB(count, bufsize, sources, types, ids, severities, lengths, messageLog);
{
unsigned int pos = 0;
for(unsigned int i=0; i<retVal; i++)
{
DebugOutputToFile(sources[i], types[i], ids[i], severities[i], lengths[i], &messageLog[pos], NULL);
pos += lengths[i];
}
}
delete[] messageLog; if(retVal > 0)
{
unsigned int pos = 0;
for(unsigned int i=0; i<retVal; i++)
{
DebugOutputToFile(sources[i], types[i], ids[i], severities[i], lengths[i], &messageLog[pos], NULL);
pos += lengths[i];
}
}
delete[] messageLog;
} }
// Note: used as a callback of DebugMessageCallback. Don't change the signature // Note: used as a callback of DebugMessageCallback. Don't change the signature

View File

@ -433,6 +433,28 @@ void populate_main_table(GtkWidget* main_table)
InsertWidgetInTable(main_table, interlace_label, interlace_combo_box); InsertWidgetInTable(main_table, interlace_label, interlace_combo_box);
} }
void populate_debug_table(GtkWidget* debug_table)
{
GtkWidget* glsl_debug_check = CreateCheckBox("GLSL compilation", "debug_glsl_shader");
GtkWidget* gl_debug_check = CreateCheckBox("Print GL error", "debug_opengl");
GtkWidget* gs_dump_check = CreateCheckBox("Dump GS data", "dump");
GtkWidget* gs_save_check = CreateCheckBox("Save RT", "save");
GtkWidget* gs_savet_check = CreateCheckBox("Save Texture", "savet");
GtkWidget* gs_savez_check = CreateCheckBox("Save Depth", "savez");
GtkWidget* gs_saven_label = gtk_label_new("Start of Dump");
GtkWidget* gs_saven_spin = CreateSpinButton(0, pow(10, 9), "saven");
GtkWidget* gs_savel_label = gtk_label_new("Lengh of Dump");
GtkWidget* gs_savel_spin = CreateSpinButton(0, pow(10, 5), "savel");
s_table_line = 0;
InsertWidgetInTable(debug_table, gl_debug_check, glsl_debug_check);
InsertWidgetInTable(debug_table, gs_dump_check);
InsertWidgetInTable(debug_table, gs_save_check, gs_savet_check, gs_savez_check);
InsertWidgetInTable(debug_table, gs_saven_label, gs_saven_spin);
InsertWidgetInTable(debug_table, gs_savel_label, gs_savel_spin);
}
bool RunLinuxDialog() bool RunLinuxDialog()
{ {
GtkWidget *dialog; GtkWidget *dialog;
@ -451,6 +473,7 @@ bool RunLinuxDialog()
GtkWidget* main_box = gtk_vbox_new(false, 5); GtkWidget* main_box = gtk_vbox_new(false, 5);
GtkWidget* central_box = gtk_vbox_new(false, 5); GtkWidget* central_box = gtk_vbox_new(false, 5);
GtkWidget* advance_box = gtk_vbox_new(false, 5); GtkWidget* advance_box = gtk_vbox_new(false, 5);
GtkWidget* debug_box = gtk_vbox_new(false, 5);
// Grab a logo, to make things look nice. // Grab a logo, to make things look nice.
GdkPixbuf* logo_pixmap = gdk_pixbuf_from_pixdata(&gsdx_ogl_logo, false, NULL); GdkPixbuf* logo_pixmap = gdk_pixbuf_from_pixdata(&gsdx_ogl_logo, false, NULL);
@ -464,9 +487,11 @@ bool RunLinuxDialog()
GtkWidget* hw_table = CreateTableInBox(central_box , "Hardware Mode Settings" , 5 , 2); GtkWidget* hw_table = CreateTableInBox(central_box , "Hardware Mode Settings" , 5 , 2);
GtkWidget* sw_table = CreateTableInBox(central_box , "Software Mode Settings" , 5 , 2); GtkWidget* sw_table = CreateTableInBox(central_box , "Software Mode Settings" , 5 , 2);
GtkWidget* hack_table = CreateTableInBox(advance_box , "Hacks" , 7 , 2); GtkWidget* hack_table = CreateTableInBox(advance_box , "Hacks" , 10 , 2);
GtkWidget* gl_table = CreateTableInBox(advance_box , "OpenGL Very Advanced Custom Settings" , 10 , 2); GtkWidget* gl_table = CreateTableInBox(advance_box , "OpenGL Very Advanced Custom Settings" , 10 , 2);
GtkWidget* debug_table = CreateTableInBox(debug_box , "OpenGL / GSdx Debug Settings" , 5 , 3);
// Populate all the tables // Populate all the tables
populate_main_table(main_table); populate_main_table(main_table);
@ -478,14 +503,15 @@ bool RunLinuxDialog()
populate_hack_table(hack_table); populate_hack_table(hack_table);
populate_gl_table(gl_table); populate_gl_table(gl_table);
populate_debug_table(debug_table);
// Handle some nice tab // Handle some nice tab
GtkWidget* notebook = gtk_notebook_new(); GtkWidget* notebook = gtk_notebook_new();
GtkWidget* page_label[2]; gtk_notebook_append_page(GTK_NOTEBOOK(notebook), central_box, gtk_label_new("Global Setting"));
page_label[0] = gtk_label_new("Global Setting"); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advance_box, gtk_label_new("Advance Setting"));
page_label[1] = gtk_label_new("Advance Setting"); #ifdef ENABLE_OGL_DEBUG
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), debug_box , gtk_label_new("Debug Setting"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), central_box, page_label[0]); #endif
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advance_box, page_label[1]);
// Put everything in the big box. // Put everything in the big box.
gtk_container_add(GTK_CONTAINER(main_box), notebook); gtk_container_add(GTK_CONTAINER(main_box), notebook);