Add the patch from Dragonlord for broken Cg 2.1 on Linux with ATI cards (Fixes Issue 2508). Shouldn't affect anything else than Linux, please test it there.

Update Issue 2508
This should take care about the black screen. Please open a new issue for other problems that may arise.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5830 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
j4ck.fr0st 2010-07-03 19:10:23 +00:00
parent 2074b2ef8e
commit 6cc3e4ba14
3 changed files with 27 additions and 3 deletions

View File

@ -93,10 +93,16 @@ void PixelShaderCache::Init()
lastPSconstants[i/4][i%4] = -100000000.0f;
memset(&last_pixel_shader_uid, 0xFF, sizeof(last_pixel_shader_uid));
s_displayCompileAlert = true;
s_displayCompileAlert = true;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, (GLint *)&s_nMaxPixelInstructions);
#ifdef __linux__
if (strstr((const char*)glGetString(GL_VENDOR), "ATI") != NULL)
{
s_nMaxPixelInstructions = 4096;
}
#endif
int maxinst, maxattribs;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&maxinst);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, (GLint *)&maxattribs);

View File

@ -403,8 +403,20 @@ bool Renderer::Init()
g_cgvProf = cgGLGetLatestProfile(CG_GL_VERTEX);
g_cgfProf = cgGLGetLatestProfile(CG_GL_FRAGMENT);
#ifdef __linux__
// A bug was introduced in Cg2.1's handling of very large profile option values
// so this will not work on ATI. ATI returns MAXINT = 2147483647 (0x7fffffff)
// which is correct in OpenGL but Cg fails to handle it properly. As a result
// -1 is used by Cg resulting (signedness incorrect) and compilation fails.
if (strstr((const char*)glGetString(GL_VENDOR), "ATI") == NULL)
{
cgGLSetOptimalOptions(g_cgvProf);
cgGLSetOptimalOptions(g_cgfProf);
}
#else
cgGLSetOptimalOptions(g_cgvProf);
cgGLSetOptimalOptions(g_cgfProf);
#endif
INFO_LOG(VIDEO, "Max buffer sizes: %d %d", cgGetProgramBufferMaxSize(g_cgvProf), cgGetProgramBufferMaxSize(g_cgfProf));
int nenvvertparams, nenvfragparams, naddrregisters[2];

View File

@ -111,7 +111,13 @@ void VertexShaderCache::Init()
s_displayCompileAlert = true;
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&s_nMaxVertexInstructions);
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&s_nMaxVertexInstructions);
#ifdef __linux__
if (strstr((const char*)glGetString(GL_VENDOR), "ATI") != NULL)
{
s_nMaxVertexInstructions = 4096;
}
#endif
}
void VertexShaderCache::Shutdown()