On 12/20/2012 05:05 PM, Eric Anholt wrote:
Ian Romanick <i...@freedesktop.org> writes:
From: Ian Romanick <ian.d.roman...@intel.com>
It looks to me like we really do have to support getting a
binary with this extension/gles3:
"Any program binary retrieved using GetProgramBinary and submitted us-
ing ProgramBinary under the same configuration must be successful. Any
programs loaded successfully by ProgramBinary must be run properly with
any legal GL state vector."
where I read configuration as "hardware and driver version" I don't see
any of the text I would expect if they're letting length == 0 mean
"sorry, can't save this one".
I thought I had replied to this, but I don't see my e-mail. Weird.
Anyway, the spec allows us to expose zero binary formats. If there are
no binary formats, any value specified as binaryFormat for
glProgramBinary must be invalid. The older ARB_get_shader_binary spec
uses basically the same method to allow the same cowardly retreat. :)
---
src/mesa/main/shaderapi.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
src/mesa/main/shaderapi.h | 8 ++++++++
2 files changed, 58 insertions(+)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 19fa6fc..550018e 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1500,6 +1500,56 @@ _mesa_ShaderBinary(GLint n, const GLuint* shaders,
GLenum binaryformat,
#endif /* FEATURE_ES2 */
+void GLAPIENTRY
+_mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length,
+ GLenum *binaryFormat, GLvoid *binary)
+{
+ struct gl_shader_program *shProg;
+ GET_CURRENT_CONTEXT(ctx);
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ shProg = _mesa_lookup_shader_program_err(ctx, program,
"glGetProgramBinary");
+ if (!shProg)
+ return;
+
+ if (!shProg->LinkStatus) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetProgramBinary(program %u not linked)",
tabs, probably from a copy and paste.
Naturally. Fixed.
+ shProg->Name);
+ return;
+ }
+
+ if (bufSize < 0){
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramBinary(bufSize < 0)");
+ return;
+ }
+
+ *length = 0;
"If <length> is NULL, then no length is returned."
Good catch. I'll fix that.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev