Skip to content

Commit

Permalink
1.2.x: cherry pick r5888 from trunk
Browse files Browse the repository at this point in the history
git-svn-id: http://pcsx2.googlecode.com/svn/branches/1.2.x@5896 96395faa-99c1-11dd-bbfe-3dabce05a288
  • Loading branch information
gregory.hainaut committed Feb 10, 2014
1 parent e5f49d0 commit f9dd627
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
3 changes: 1 addition & 2 deletions plugins/GSdx/GSDeviceOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,7 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto
OMSetWriteBuffer();
OMAttachRt(static_cast<GSTextureOGL*>(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);
}
Expand Down
12 changes: 6 additions & 6 deletions plugins/GSdx/GSLinuxDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)));
Expand Down
1 change: 1 addition & 0 deletions plugins/GSdx/GSRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion plugins/GSdx/GSTextureFXOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
9 changes: 6 additions & 3 deletions plugins/GSdx/GSTextureOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/GSdx/res/convert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions plugins/GSdx/res/glsl_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit f9dd627

Please sign in to comment.