mirror of https://github.com/PCSX2/pcsx2.git
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
This commit is contained in:
parent
c51f8cae54
commit
320d3a572e
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <limits.h>
|
||||
#include "GSTextureOGL.h"
|
||||
static int g_state_texture_unit = -1;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue