From c86ca9c56e646c918b31e24394fb5fa7165e43a9 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut" Date: Tue, 27 Nov 2012 07:50:51 +0000 Subject: [PATCH] gsdx ogl: don't check dual source support on SW mode to avoid a crash on SW mode. (note HW is still crashing but better than nothing) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5464 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSDeviceOGL.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index b9ad924d8c..629330a4d3 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -1349,16 +1349,26 @@ void GSDeviceOGL::CompileShaderFromSource(const std::string& glsl_file, const st header.copy(header_str, header.size(), 0); header_str[header.size()] = '\0'; +#if 0 + // Could be useful one day + const GLchar* ShaderSource[1]; + ShaderSource[0] = header.append(source).c_str(); + *program = glCreateShaderProgramv(type, 1, &ShaderSource[0]); +#else *program = glCreateShaderProgramv(type, 2, sources_array); +#endif - // Check the correctness of the driver - GLint slot = glGetFragDataLocation(*program, "SV_Target1"); - if (slot == 0) { // <=> SV_Target1 used same slot as SV_Target0 - GLint index = glGetFragDataIndex(*program, "SV_Target1"); - if (index != 1) { - fprintf(stderr, "Driver bug: failed to set the index, program will be recompiled\n"); - glDeleteProgram(*program); - *program = glCreateShaderProgramv_AMD_BUG_WORKAROUND(type, 2, sources_array); + // Check the correctness of the (AMD) driver + // Note: glGetFragDataLocation crash too!!! Catalyst 12.10 => HD 6XXX + if (theApp.GetConfig("renderer", 0) == 12) { + GLint slot = glGetFragDataLocation(*program, "SV_Target1"); + if (slot == 0) { // <=> SV_Target1 used same slot as SV_Target0 + GLint index = glGetFragDataIndex(*program, "SV_Target1"); + if (index != 1) { + fprintf(stderr, "Driver bug: failed to set the index, program will be recompiled\n"); + glDeleteProgram(*program); + *program = glCreateShaderProgramv_AMD_BUG_WORKAROUND(type, 2, sources_array); + } } }