gsdx ogl:

* properly detect gl nv depth extension
* Always show the hack on the gui. Add a new hack option for DATE (gl4.2) only
* Save the scan mode on linux too (f7)
* hopefully fix some crash on some drivers... (ensure aligment 256 bits alignment, and if not use std memcpy)


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5888 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2014-02-07 19:53:01 +00:00
parent 749568f290
commit 384c0c12ea
7 changed files with 24 additions and 16 deletions

View File

@ -1134,8 +1134,7 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto
OMSetWriteBuffer(); OMSetWriteBuffer();
OMAttachRt(static_cast<GSTextureOGL*>(rt)->GetID()); OMAttachRt(static_cast<GSTextureOGL*>(rt)->GetID());
} else { } else {
// Note: NULL rt is only used in DATE so far. Color writing is disabled // Note: NULL rt is only used in DATE so far.
// on the blend setup
OMSetFBO(m_fbo); OMSetFBO(m_fbo);
OMSetWriteBuffer(GL_NONE); OMSetWriteBuffer(GL_NONE);
} }

View File

@ -235,7 +235,7 @@ bool RunLinuxDialog()
GtkWidget *interlace_label, *threads_label, *native_label, *fsaa_label, *rexy_label, *render_label, *filter_label; GtkWidget *interlace_label, *threads_label, *native_label, *fsaa_label, *rexy_label, *render_label, *filter_label;
GtkWidget *hack_table, *hack_skipdraw_label, *hack_box, *hack_frame; GtkWidget *hack_table, *hack_skipdraw_label, *hack_box, *hack_frame;
GtkWidget *hack_alpha_check, *hack_offset_check, *hack_skipdraw_spin, *hack_msaa_check, *hack_sprite_check, * hack_wild_check, *hack_enble_check, *hack_logz_check; GtkWidget *hack_alpha_check, *hack_date_check, *hack_offset_check, *hack_skipdraw_spin, *hack_msaa_check, *hack_sprite_check, * hack_wild_check, *hack_enble_check, *hack_logz_check;
GtkWidget *hack_tco_label, *hack_tco_entry; GtkWidget *hack_tco_label, *hack_tco_entry;
GtkWidget *gl_box, *gl_frame, *gl_table; GtkWidget *gl_box, *gl_frame, *gl_table;
@ -353,6 +353,7 @@ bool RunLinuxDialog()
// Create our hack settings. // Create our hack settings.
hack_alpha_check = gtk_check_button_new_with_label("Alpha Hack"); hack_alpha_check = gtk_check_button_new_with_label("Alpha Hack");
hack_date_check = gtk_check_button_new_with_label("Date Hack");
hack_offset_check = gtk_check_button_new_with_label("Offset Hack"); hack_offset_check = gtk_check_button_new_with_label("Offset Hack");
hack_skipdraw_label = gtk_label_new("Skipdraw:"); hack_skipdraw_label = gtk_label_new("Skipdraw:");
hack_skipdraw_spin = gtk_spin_button_new_with_range(0,1000,1); hack_skipdraw_spin = gtk_spin_button_new_with_range(0,1000,1);
@ -373,6 +374,7 @@ bool RunLinuxDialog()
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_sprite_check, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_sprite_check, 0, 1, 1, 2);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_wild_check, 1, 2, 1, 2); gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_wild_check, 1, 2, 1, 2);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_logz_check, 0, 1, 2, 3); gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_logz_check, 0, 1, 2, 3);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_date_check, 1, 2, 2, 3);
// Note: MSAA is not implemented yet. I disable it to make the table square // Note: MSAA is not implemented yet. I disable it to make the table square
//gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_msaa_check, 2, 3, 1, 2); //gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_msaa_check, 2, 3, 1, 2);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_skipdraw_label, 0, 1, 3, 4); gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_skipdraw_label, 0, 1, 3, 4);
@ -397,6 +399,7 @@ bool RunLinuxDialog()
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_alpha_check), theApp.GetConfig("UserHacks_AlphaHack", 0)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_alpha_check), theApp.GetConfig("UserHacks_AlphaHack", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_offset_check), theApp.GetConfig("UserHacks_HalfPixelOffset", 0)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_offset_check), theApp.GetConfig("UserHacks_HalfPixelOffset", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_date_check), theApp.GetConfig("UserHacks_DateGL4", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_enble_check), theApp.GetConfig("UserHacks", 0)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_enble_check), theApp.GetConfig("UserHacks", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_msaa_check), theApp.GetConfig("UserHacks_MSAA", 0)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_msaa_check), theApp.GetConfig("UserHacks_MSAA", 0));
@ -512,11 +515,7 @@ override_GL_ARB_shading_language_420pack = -1
gtk_container_add(GTK_CONTAINER(central_box), hw_frame); gtk_container_add(GTK_CONTAINER(central_box), hw_frame);
gtk_container_add(GTK_CONTAINER(central_box), sw_frame); gtk_container_add(GTK_CONTAINER(central_box), sw_frame);
if (!!theApp.GetConfig("UserHacks", 0))
{
gtk_container_add(GTK_CONTAINER(advance_box), hack_frame); gtk_container_add(GTK_CONTAINER(advance_box), hack_frame);
}
gtk_container_add(GTK_CONTAINER(advance_box), gl_frame); gtk_container_add(GTK_CONTAINER(advance_box), gl_frame);
g_signal_connect(render_combo_box, "changed", G_CALLBACK(toggle_widget_states), NULL); g_signal_connect(render_combo_box, "changed", G_CALLBACK(toggle_widget_states), NULL);
@ -577,6 +576,7 @@ override_GL_ARB_shading_language_420pack = -1
theApp.SetConfig("UserHacks_HalfPixelOffset", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_offset_check))); theApp.SetConfig("UserHacks_HalfPixelOffset", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_offset_check)));
theApp.SetConfig("UserHacks_AlphaHack", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_alpha_check))); theApp.SetConfig("UserHacks_AlphaHack", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_alpha_check)));
theApp.SetConfig("logz", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_logz_check))); theApp.SetConfig("logz", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_logz_check)));
theApp.SetConfig("UserHacks_DateGL4", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_date_check)));
theApp.SetConfig("UserHacks_MSAA", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_msaa_check))); theApp.SetConfig("UserHacks_MSAA", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_msaa_check)));
theApp.SetConfig("UserHacks_WildHack", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_wild_check))); theApp.SetConfig("UserHacks_WildHack", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_wild_check)));

View File

@ -600,6 +600,7 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
return; return;
case XK_F7: case XK_F7:
m_shader = (m_shader + post_shader_nb + step) % post_shader_nb; m_shader = (m_shader + post_shader_nb + step) % post_shader_nb;
theApp.SetConfig("TVShader", (int)m_shader);
fprintf(stderr,"GSdx: Set shader %d.\n", (int)m_shader); fprintf(stderr,"GSdx: Set shader %d.\n", (int)m_shader);
return; return;
case XK_Delete: case XK_Delete:

View File

@ -60,7 +60,12 @@ void GSDeviceOGL::CreateTextureFX()
// Help to debug FS in apitrace // Help to debug FS in apitrace
m_apitrace = CompilePS(PSSelector()); m_apitrace = CompilePS(PSSelector());
if (!!theApp.GetConfig("GL_NV_Depth", 0)) { // VS gl_position.z => [-1,-1]
// FS depth => [0, 1]
// because of -1 we loose lot of precision for small GS value
// This extension allow FS depth to range from -1 to 1. So
// gl_position.z could range from [0, 1]
if (GLLoader::found_GL_NV_depth_buffer_float) {
gl_DepthRangedNV(-1.0f, 1.0f); gl_DepthRangedNV(-1.0f, 1.0f);
} }
} }

View File

@ -152,7 +152,7 @@ namespace PboPool {
void EndTransfer() { void EndTransfer() {
// Note: keep offset aligned for SSE/AVX // Note: keep offset aligned for SSE/AVX
m_offset[m_current_pbo] += (m_size + 64) & ~0x3F; m_offset[m_current_pbo] = (m_offset[m_current_pbo] + m_size + 31) & ~0x1F;
} }
} }
@ -319,8 +319,11 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
char* map = PboPool::Map(r.height() * line_size); char* map = PboPool::Map(r.height() * line_size);
for (uint32 h = r.height(); h > 0; h--) { for (uint32 h = r.height(); h > 0; h--) {
// avoid a crash if map is not aligned
if ((uint32)map & 0x1F)
memcpy(map, src, line_size);
else
GSVector4i::storent(map, src, line_size); GSVector4i::storent(map, src, line_size);
//memcpy(map, src, line_size);
src += pitch; src += pitch;
map += line_size; map += line_size;
} }

View File

@ -223,7 +223,7 @@ void ps_main9()
#ifdef ps_main2 #ifdef ps_main2
void ps_main2() void ps_main2()
{ {
if(sample_c().a < 127.5f / 255.0f) // >= 0x80 pass if(sample_c().a < (127.5f / 255.0f)) // >= 0x80 pass
discard; discard;
#ifdef ENABLE_OGL_STENCIL_DEBUG #ifdef ENABLE_OGL_STENCIL_DEBUG
@ -237,7 +237,7 @@ void ps_main2()
#ifdef ps_main3 #ifdef ps_main3
void ps_main3() void ps_main3()
{ {
if(127.5f / 255.0f < sample_c().a) // < 0x80 pass (== 0x80 should not pass) if((127.5f / 255.0f) < sample_c().a) // < 0x80 pass (== 0x80 should not pass)
discard; discard;
#ifdef ENABLE_OGL_STENCIL_DEBUG #ifdef ENABLE_OGL_STENCIL_DEBUG

View File

@ -248,7 +248,7 @@ static const char* convert_glsl =
"#ifdef ps_main2\n" "#ifdef ps_main2\n"
"void ps_main2()\n" "void ps_main2()\n"
"{\n" "{\n"
" if(sample_c().a < 127.5f / 255.0f) // >= 0x80 pass\n" " if(sample_c().a < (127.5f / 255.0f)) // >= 0x80 pass\n"
" discard;\n" " discard;\n"
"\n" "\n"
"#ifdef ENABLE_OGL_STENCIL_DEBUG\n" "#ifdef ENABLE_OGL_STENCIL_DEBUG\n"
@ -262,7 +262,7 @@ static const char* convert_glsl =
"#ifdef ps_main3\n" "#ifdef ps_main3\n"
"void ps_main3()\n" "void ps_main3()\n"
"{\n" "{\n"
" if(127.5f / 255.0f < sample_c().a) // < 0x80 pass (== 0x80 should not pass)\n" " if((127.5f / 255.0f) < sample_c().a) // < 0x80 pass (== 0x80 should not pass)\n"
" discard;\n" " discard;\n"
"\n" "\n"
"#ifdef ENABLE_OGL_STENCIL_DEBUG\n" "#ifdef ENABLE_OGL_STENCIL_DEBUG\n"