diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 0fc30f12cf..69925f834e 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -1134,8 +1134,7 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto OMSetWriteBuffer(); OMAttachRt(static_cast(rt)->GetID()); } else { - // Note: NULL rt is only used in DATE so far. Color writing is disabled - // on the blend setup + // Note: NULL rt is only used in DATE so far. OMSetFBO(m_fbo); OMSetWriteBuffer(GL_NONE); } diff --git a/plugins/GSdx/GSLinuxDialog.cpp b/plugins/GSdx/GSLinuxDialog.cpp index f5e8239d1b..ad1667f17e 100644 --- a/plugins/GSdx/GSLinuxDialog.cpp +++ b/plugins/GSdx/GSLinuxDialog.cpp @@ -235,7 +235,7 @@ bool RunLinuxDialog() 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_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 *gl_box, *gl_frame, *gl_table; @@ -353,6 +353,7 @@ bool RunLinuxDialog() // Create our hack settings. 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_skipdraw_label = gtk_label_new("Skipdraw:"); 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_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_date_check, 1, 2, 2, 3); // 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_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_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_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), 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); 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_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("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_WildHack", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hack_wild_check))); diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 39aa26daf2..6d57891801 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -600,6 +600,7 @@ void GSRenderer::KeyEvent(GSKeyEventData* e) return; case XK_F7: 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); return; case XK_Delete: diff --git a/plugins/GSdx/GSTextureFXOGL.cpp b/plugins/GSdx/GSTextureFXOGL.cpp index feb45dd5e3..bb7a569190 100644 --- a/plugins/GSdx/GSTextureFXOGL.cpp +++ b/plugins/GSdx/GSTextureFXOGL.cpp @@ -60,7 +60,12 @@ void GSDeviceOGL::CreateTextureFX() // Help to debug FS in apitrace 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); } } diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 556cc89dba..40963ea7ee 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -152,7 +152,7 @@ namespace PboPool { void EndTransfer() { // 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); for (uint32 h = r.height(); h > 0; h--) { - GSVector4i::storent(map, src, line_size); - //memcpy(map, src, line_size); + // avoid a crash if map is not aligned + if ((uint32)map & 0x1F) + memcpy(map, src, line_size); + else + GSVector4i::storent(map, src, line_size); src += pitch; map += line_size; } diff --git a/plugins/GSdx/res/convert.glsl b/plugins/GSdx/res/convert.glsl index 381e9a42b0..82c90bd9d4 100644 --- a/plugins/GSdx/res/convert.glsl +++ b/plugins/GSdx/res/convert.glsl @@ -223,7 +223,7 @@ void ps_main9() #ifdef 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; #ifdef ENABLE_OGL_STENCIL_DEBUG @@ -237,7 +237,7 @@ void ps_main2() #ifdef 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; #ifdef ENABLE_OGL_STENCIL_DEBUG diff --git a/plugins/GSdx/res/glsl_source.h b/plugins/GSdx/res/glsl_source.h index 6d1cfba025..a685a67c76 100644 --- a/plugins/GSdx/res/glsl_source.h +++ b/plugins/GSdx/res/glsl_source.h @@ -248,7 +248,7 @@ static const char* convert_glsl = "#ifdef ps_main2\n" "void ps_main2()\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" "\n" "#ifdef ENABLE_OGL_STENCIL_DEBUG\n" @@ -262,7 +262,7 @@ static const char* convert_glsl = "#ifdef ps_main3\n" "void ps_main3()\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" "\n" "#ifdef ENABLE_OGL_STENCIL_DEBUG\n"