GSdx: only enable AMD hack for AMD GPU. Remove the older geometry sha… · PCSX2/pcsx2@a9020c6
@@ -39,6 +39,7 @@ GSDeviceOGL::GSDeviceOGL()
3939 , m_pipeline(0)
4040 , m_fbo(0)
4141 , m_fbo_read(0)
42+ , m_AMD_gpu(false)
4243 , m_enable_shader_AMD_hack(false)
4344 , m_vb_sr(NULL)
4445 , m_srv_changed(false)
@@ -148,8 +149,10 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
148149{
149150if (m_window == NULL) {
150151// FIXME......
151-// GLEW's problem is that it calls glGetString(GL_EXTENSIONS) which causes GL_INVALID_ENUM on GL 3.2 forward compatible context as soon as glewInit() is called. It also doesn't fetch the function pointers. The solution is for GLEW to use glGetStringi instead.
152-// The current version of GLEW is 1.7.0 but they still haven't corrected it. The only fix is to use glewExperimental for now :
152+// GLEW's problem is that it calls glGetString(GL_EXTENSIONS) which causes GL_INVALID_ENUM
153+// on GL 3.2 forward compatible context as soon as glewInit() is called. It also doesn't fetch
154+// the function pointers. The solution is for GLEW to use glGetStringi instead.
155+// The current version of GLEW is 1.9.0 but they still haven't corrected it. The only fix is to use glewExperimental for now :
153156//NOTE: I'm not sure experimental work on 1.6 ...
154157 glewExperimental=true;
155158const int glew_ok = glewInit();
@@ -168,7 +171,10 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
168171const GLubyte* s;
169172 s = glGetString(GL_VERSION);
170173if (s == NULL) return false;
171-fprintf(stderr, "Supported Opengl version: %s\n", s);
174+fprintf(stderr, "Supported Opengl version: %s on GPU: %s. Vendor: %s\n", s, glGetString(GL_RENDERER), glGetString(GL_VENDOR));
175+if ( strcmp((const char*)glGetString(GL_VENDOR), "ATI Technologies Inc.") == 0 ) {
176+ m_AMD_gpu = true;
177+ }
172178173179 GLuint dot = 0;
174180while (s[dot] != '\0' && s[dot] != '.') dot++;
@@ -379,7 +385,9 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
379385// ****************************************************************
380386// HW renderer shader
381387// ****************************************************************
382- m_enable_shader_AMD_hack = true; // ....
388+if (m_AMD_gpu) {
389+ m_enable_shader_AMD_hack = true; // ....
390+ }
383391CreateTextureFX();
384392385393// ****************************************************************
@@ -779,11 +787,8 @@ void GSDeviceOGL::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
779787return;
780788 }
781789782-// GL_NV_copy_image seem like the good extension but not supported on AMD...
783-// Maybe opengl 4.3 !
790+// FIXME: the extension was integrated in opengl 4.3 (now we need driver that support OGL4.3)
784791// FIXME check those function work as expected
785-// FIXME: it is an NVIDIA extension. Hopefully lastest AMD driver support it too.
786-// An EXT extensions might be release later.
787792// void CopyImageSubDataNV(
788793// uint srcName, enum srcTarget, int srcLevel, int srcX, int srcY, int srcZ,
789794// uint dstName, enum dstTarget, int dstLevel, int dstX, int dstY, int dstZ,
@@ -880,11 +885,7 @@ void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt,
880885// gs
881886// ************************************
882887883-#ifdef AMD_DRIVER_WORKAROUND
884-GSSetShader(m_convert.gs);
885-#else
886888GSSetShader(0);
887-#endif
888889889890// ************************************
890891// ps
@@ -992,12 +993,7 @@ void GSDeviceOGL::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* ver
992993993994// gs
994995995-#ifdef AMD_DRIVER_WORKAROUND
996-GSSetShader(m_convert.gs);
997-#else
998996GSSetShader(0);
999-#endif
1000-10019971002998// ps
1003999@@ -1360,8 +1356,10 @@ void GSDeviceOGL::CompileShaderFromSource(const std::string& glsl_file, const st
13601356 header_str[header.size()] = '\0';
1361135713621358// ... See below to test that index is correctly set by driver
1363-//*program = glCreateShaderProgramv(type, 2, sources_array);
1364- *program = glCreateShaderProgramv_AMD_BUG_WORKAROUND(type, 2, sources_array);
1359+if (m_AMD_gpu)
1360+ *program = glCreateShaderProgramv_AMD_BUG_WORKAROUND(type, 2, sources_array);
1361+else
1362+ *program = glCreateShaderProgramv(type, 2, sources_array);
1365136313661364// DEBUG AMD failure...
13671365// GLint index = -1;