[Mesa-dev] [PATCH] mesa: fix empty program log length

Iago Toral itoral at igalia.com
Thu Aug 18 12:11:55 UTC 2016


On Wed, 2016-08-17 at 11:18 +0300, 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."

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

> Signed-off-by: Tapani Pälli <tapani.palli at 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) ?
> +         strlen(shProg->InfoLog) + 1 : 0;
>        return;
>     case GL_ATTACHED_SHADERS:
>        *params = shProg->NumShaders;


More information about the mesa-dev mailing list