diff --git a/source/Irrlicht/COGLES2MaterialRenderer.cpp b/source/Irrlicht/COGLES2MaterialRenderer.cpp index 628df02c..f9e139b8 100644 --- a/source/Irrlicht/COGLES2MaterialRenderer.cpp +++ b/source/Irrlicht/COGLES2MaterialRenderer.cpp @@ -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]; diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp index b2ba9f67..74401f60 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp @@ -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];