Disable UBO buffer generation if hardware doesn't support it.

This commit is contained in:
Ryan Houdek 2011-12-11 04:19:11 -06:00 committed by Sonicadvance1
parent 3bcec51334
commit a809feae1a
1 changed files with 28 additions and 24 deletions

View File

@ -169,6 +169,8 @@ namespace OGL
// We have to get the UBO alignment here because // We have to get the UBO alignment here because
// if we generate a buffer that isn't aligned // if we generate a buffer that isn't aligned
// then the UBO will fail. // then the UBO will fail.
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
GLint Align; GLint Align;
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &Align); glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &Align);
@ -188,12 +190,14 @@ namespace OGL
glBufferData(GL_UNIFORM_BUFFER, ROUND_UP(C_VENVCONST_END * 4 * 4, Align), NULL, GL_DYNAMIC_DRAW); glBufferData(GL_UNIFORM_BUFFER, ROUND_UP(C_VENVCONST_END * 4 * 4, Align), NULL, GL_DYNAMIC_DRAW);
glBindBufferBase(GL_UNIFORM_BUFFER, 2, UBOBuffers[1]); glBindBufferBase(GL_UNIFORM_BUFFER, 2, UBOBuffers[1]);
} }
}
void ProgramShaderCache::Shutdown(void) void ProgramShaderCache::Shutdown(void)
{ {
PCache::iterator iter = pshaders.begin(); PCache::iterator iter = pshaders.begin();
for (; iter != pshaders.end(); iter++) for (; iter != pshaders.end(); iter++)
iter->second.Destroy(); iter->second.Destroy();
pshaders.clear(); pshaders.clear();
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
glDeleteBuffers(2, UBOBuffers); glDeleteBuffers(2, UBOBuffers);
} }
} }