From 320d3a572e18cb5c558a61eb772acb70469b7924 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut" Date: Wed, 8 May 2013 15:51:42 +0000 Subject: [PATCH] gsdx ogl: AMD fix some bugs in their driver ! (catalyst 13.4 branch). Let's remove some buggy workaround now. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5627 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSDeviceOGL.cpp | 48 ----------------------------------- plugins/GSdx/GSDeviceOGL.h | 2 -- plugins/GSdx/GSTextureOGL.cpp | 2 -- plugins/GSdx/res/tfx.glsl | 5 +--- 4 files changed, 1 insertion(+), 56 deletions(-) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 64197f82ed..dae4b5d5d2 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -1262,40 +1262,6 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto } } -// AMD drivers fail to support correctly the setting of index in fragment shader (layout statement in glsl)... -// So instead to use directly glCreateShaderProgramv, you need to emulate the function and manually set -// the index in the fragment shader. -GLuint GSDeviceOGL::glCreateShaderProgramv_AMD_BUG_WORKAROUND(GLenum type, GLsizei count, const char ** strings) -{ - const GLuint shader = glCreateShader(type); - if (shader) { - glShaderSource(shader, count, strings, NULL); - glCompileShader(shader); - const GLuint program = glCreateProgram(); - if (program) { - GLint compiled = GL_FALSE; - glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); - glProgramParameteri(program, GL_PROGRAM_SEPARABLE, GL_TRUE); - if (compiled) { - glAttachShader(program, shader); - // HACK TO SET CORRECTLY THE INDEX - if (type == GL_FRAGMENT_SHADER) { - glBindFragDataLocationIndexed(program, 0, 0, "SV_Target0"); - glBindFragDataLocationIndexed(program, 0, 1, "SV_Target1"); - } - // END OF HACK - glLinkProgram(program); - glDetachShader(program, shader); - } - /* append-shader-info-log-to-program-info-log */ - } - glDeleteShader(shader); - return program; - } else { - return 0; - } -} - void GSDeviceOGL::CompileShaderFromSource(const std::string& glsl_file, const std::string& entry, GLenum type, GLuint* program, const std::string& macro_sel) { // ***************************************************** @@ -1381,20 +1347,6 @@ void GSDeviceOGL::CompileShaderFromSource(const std::string& glsl_file, const st *program = glCreateShaderProgramv(type, 2, sources_array); #endif - // Check the correctness of the (AMD) driver - // Note: glGetFragDataLocation crash too!!! Catalyst 12.10 (and later) => HD 5XXX,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); - } - } - } - free(source_str); free(header_str); free(sources_array); diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 697c9e6da0..ad18b5624c 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -656,6 +656,4 @@ class GSDeviceOGL : public GSDevice void SetupGS(GSSelector sel); void SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSelector ssel); void SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint8 afix); - - GLuint glCreateShaderProgramv_AMD_BUG_WORKAROUND(GLenum type, GLsizei count, const char ** strings); }; diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index d21055d697..3c5bc47ebf 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -19,8 +19,6 @@ * */ -#pragma once - #include #include "GSTextureOGL.h" static int g_state_texture_unit = -1; diff --git a/plugins/GSdx/res/tfx.glsl b/plugins/GSdx/res/tfx.glsl index f25ba617a2..e6f87aff26 100644 --- a/plugins/GSdx/res/tfx.glsl +++ b/plugins/GSdx/res/tfx.glsl @@ -153,10 +153,7 @@ out gl_PerVertex { float gl_ClipDistance[]; }; -// FIXME -// AMD Driver bug again !!!! -//layout(location = 0) in vertex GSin[]; -in vertex GSin[]; +layout(location = 0) in vertex GSin[]; layout(location = 0) out vertex GSout;