[Mesa-dev] [PATCH] mesa: fix empty program log length
Tapani Pälli
tapani.palli at intel.com
Wed Aug 17 08:18:19 UTC 2016
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.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;
--
2.7.4
More information about the mesa-dev
mailing list