On 08/17/2016 01:18 AM, Tapani Pälli wrote: > In case we have empty log (""), we should return 0. This fixes > Khronos WebGL conformance test 'program-infolog'. > > From OpenGL ES 3.1 (and OpenGL 4.5 Core) spec: > "If pname is INFO_LOG_LENGTH , the length of the info log, including > a null terminator, is returned. If there is no info log, zero is > returned." > > Signed-off-by: Tapani Pälli <tapani.pa...@intel.com> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97321 > --- > src/mesa/main/shaderapi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c > index 4f29cd9..b2b3b0a 100644 > --- a/src/mesa/main/shaderapi.c > +++ b/src/mesa/main/shaderapi.c > @@ -654,7 +654,8 @@ get_programiv(struct gl_context *ctx, GLuint program, > GLenum pname, > *params = shProg->Validated; > return; > case GL_INFO_LOG_LENGTH: > - *params = shProg->InfoLog ? strlen(shProg->InfoLog) + 1 : 0; > + *params = (shProg->InfoLog && shProg->InfoLog[0] != 0) ?
I'd rather have this be shProg->InfoLog[0] != '\0' to make it explicit that we're comparing characters. Also, we need this same fix in _mesa_GetProgramPipelineiv and get_shaderiv. Maybe refactor this to a function? GLint _mesa_get_info_log_length(const char *log); That may not be the refactor... it has always been annoying that gl_shader, gl_shader_program, and gl_pipeline_object are so similar, but can't really share any code. :( Maybe it's best to do the simple fix now (and tag for stable), and then do some sort of refactor. > + strlen(shProg->InfoLog) + 1 : 0; > return; > case GL_ATTACHED_SHADERS: > *params = shProg->NumShaders; > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev