summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2016-08-17 10:37:45 +0300
committerEmil Velikov <emil.l.velikov@gmail.com>2016-11-24 16:34:41 +0000
commit8691daef62d3a40014757426c3f25960095b8d3c (patch)
treea117105c63f8773cdcc2f5fc2228d0fa384c3e87
parent1809f17bda56d4f9d6385f63a9c4a5df890e3cad (diff)
downloadexternal_mesa3d-8691daef62d3a40014757426c3f25960095b8d3c.zip
external_mesa3d-8691daef62d3a40014757426c3f25960095b8d3c.tar.gz
external_mesa3d-8691daef62d3a40014757426c3f25960095b8d3c.tar.bz2
mesa: fix empty program log length
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." v2: apply same fix for get_shaderiv and _mesa_GetProgramPipelineiv (Ian) Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1) Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97321 Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit ec4e71f75e9b8a1c427994efa32a61593e3172f9)
-rw-r--r--src/mesa/main/pipelineobj.c3
-rw-r--r--src/mesa/main/shaderapi.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index 8229840..310b745 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -645,7 +645,8 @@ _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
*params = pipe->ActiveProgram ? pipe->ActiveProgram->Name : 0;
return;
case GL_INFO_LOG_LENGTH:
- *params = pipe->InfoLog ? strlen(pipe->InfoLog) + 1 : 0;
+ *params = (pipe->InfoLog && pipe->InfoLog[0] != '\0') ?
+ strlen(pipe->InfoLog) + 1 : 0;
return;
case GL_VALIDATE_STATUS:
*params = pipe->Validated;
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 2ed47f0..15f324b 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -642,7 +642,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;
@@ -890,7 +891,8 @@ get_shaderiv(struct gl_context *ctx, GLuint name, GLenum pname, GLint *params)
*params = shader->CompileStatus;
break;
case GL_INFO_LOG_LENGTH:
- *params = shader->InfoLog ? strlen(shader->InfoLog) + 1 : 0;
+ *params = (shader->InfoLog && shader->InfoLog[0] != '\0') ?
+ strlen(shader->InfoLog) + 1 : 0;
break;
case GL_SHADER_SOURCE_LENGTH:
*params = shader->Source ? strlen((char *) shader->Source) + 1 : 0;