Don't fail if the driver is uncertain whether there are any active uniforms

Co-Authored-By: Vitaliy <numzer0@yandex.ru>
master
Maksim 2022-03-14 11:11:25 +02:00
parent a8cb399bcf
commit 8be9dde47d
2 changed files with 27 additions and 6 deletions

View File

@ -292,16 +292,23 @@ bool COGLES2MaterialRenderer::linkProgram()
if (num == 0)
return true;
GLint maxlen = 0;
GLint maxlen = -1;
glGetProgramiv(Program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxlen);
if (maxlen == 0)
if (maxlen == -1)
{
os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR);
return false;
}
if (maxlen == 0)
{
os::Printer::log("GLSL: there are active uniforms but max. name length is zero", ELL_WARNING);
UniformInfo.clear();
return true;
}
// seems that some implementations use an extra null terminator.
++maxlen;
c8 *buf = new c8[maxlen];

View File

@ -449,17 +449,24 @@ bool COpenGLSLMaterialRenderer::linkProgram()
return true;
}
GLint maxlen = 0;
GLint maxlen = -1;
#ifdef GL_VERSION_2_0
Driver->extGlGetProgramiv(Program2, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxlen);
#endif
if (maxlen == 0)
if (maxlen == -1)
{
os::Printer::log("GLSL (> 2.x): failed to retrieve uniform information", ELL_ERROR);
return false;
}
if (maxlen == 0)
{
os::Printer::log("GLSL (> 2.x): there are active uniforms but max. name length is zero", ELL_WARNING);
UniformInfo.clear();
return true;
}
// seems that some implementations use an extra null terminator
++maxlen;
c8 *buf = new c8[maxlen];
@ -526,17 +533,24 @@ bool COpenGLSLMaterialRenderer::linkProgram()
return true;
}
GLint maxlen = 0;
GLint maxlen = -1;
#ifdef GL_ARB_shader_objects
Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB, &maxlen);
#endif
if (maxlen == 0)
if (maxlen == -1)
{
os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR);
return false;
}
if (maxlen == 0)
{
os::Printer::log("GLSL: there are active uniforms but max. name length is zero", ELL_WARNING);
UniformInfo.clear();
return true;
}
// seems that some implementations use an extra null terminator
++maxlen;
c8 *buf = new c8[maxlen];