[Mesa-dev] [PATCH 16/23] main: Clear shader program data whenever ProgramBinary is called
Timothy Arceri
tarceri at itsqueeze.com
Wed Nov 29 01:24:52 UTC 2017
From: Jordan Justen <jordan.l.justen at intel.com>
The GL_ARB_get_program_binary extension spec says:
"If ProgramBinary fails to load a binary, no error is generated, but
any information about a previous link or load of that program object
is lost."
v2:
* Re-initialize shProg->data after clear. (Jordan)
(Required after 6a72eba755fea15a0d97abb913a6315d9d32e274)
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/mesa/main/shaderapi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 51031e12ec9..4607cbb99bc 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -2214,20 +2214,23 @@ void GLAPIENTRY
_mesa_ProgramBinary(GLuint program, GLenum binaryFormat,
const GLvoid *binary, GLsizei length)
{
struct gl_shader_program *shProg;
GET_CURRENT_CONTEXT(ctx);
shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramBinary");
if (!shProg)
return;
+ _mesa_clear_shader_program_data(ctx, shProg);
+ shProg->data = _mesa_create_shader_program_data();
+
/* Section 2.3.1 (Errors) of the OpenGL 4.5 spec says:
*
* "If a negative number is provided where an argument of type sizei or
* sizeiptr is specified, an INVALID_VALUE error is generated."
*/
if (length < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramBinary(length < 0)");
return;
}
--
2.14.3
More information about the mesa-dev
mailing list