OpenGL: use shader 420pack if available to staticly bind ubo location

Bindung locations after compiling a shader stalls the driver. So if we manage not to bind anything after compilation, the lag would be reduced much.
This commit is contained in:
degasus
2014-01-05 10:38:45 +01:00
parent 4fff5ac90d
commit c42f274e22
5 changed files with 8 additions and 4 deletions

View File

@ -96,7 +96,7 @@ void SHADER::SetProgramVariables()
Bind();
// Bind UBO
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO && !g_ActiveConfig.backend_info.bSupportShadingLanguage420pack)
{
GLint PSBlock_id = glGetUniformBlockIndex(glprogid, "PSBlock");
GLint VSBlock_id = glGetUniformBlockIndex(glprogid, "VSBlock");
@ -135,7 +135,6 @@ void SHADER::SetProgramVariables()
}
}
// Bind Texture Sampler
for (int a = 0; a <= 9; ++a)
{
@ -569,6 +568,7 @@ void ProgramShaderCache::CreateHeader ( void )
"%s\n"
"%s\n" // ubo
"%s\n" // early-z
"%s\n" // 420pack
// Precision defines for GLSLES3
"%s\n"
@ -597,6 +597,7 @@ void ProgramShaderCache::CreateHeader ( void )
, v==GLSLES3 ? "#version 300 es" : v==GLSL_130 ? "#version 130" : v==GLSL_140 ? "#version 140" : "#version 150"
, g_ActiveConfig.backend_info.bSupportsGLSLUBO && v<GLSL_140 ? "#extension GL_ARB_uniform_buffer_object : enable" : ""
, g_ActiveConfig.backend_info.bSupportsEarlyZ ? "#extension GL_ARB_shader_image_load_store : enable" : ""
, g_ActiveConfig.backend_info.bSupportShadingLanguage420pack ? "#extension GL_ARB_shading_language_420pack : enable" : ""
, v==GLSLES3 ? "precision highp float;" : ""