From 7ee54ad057f05881d650443de13a6bf8099e7922 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Sat, 4 Nov 2017 16:47:25 -0700 Subject: [PATCH] main: add binary support to GetProgramBinary MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit V2: call generic _mesa_get_program_binary() helper rather than driver function directly to allow greater code sharing. Signed-off-by: Timothy Arceri Signed-off-by: Jordan Justen (v1) Reviewed-by: Nicolai Hähnle (v1) Reviewed-by: Tapani Pälli --- src/mesa/main/shaderapi.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 82a7fde697b..b728b320ac4 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2199,12 +2199,15 @@ _mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, return; } - *length = 0; - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramBinary(driver supports zero binary formats)"); - - (void) binaryFormat; - (void) binary; + if (ctx->Const.NumProgramBinaryFormats == 0) { + *length = 0; + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetProgramBinary(driver supports zero binary formats)"); + } else { + _mesa_get_program_binary(ctx, shProg, bufSize, length, binaryFormat, + binary); + assert(*length == 0 || *binaryFormat == GL_PROGRAM_BINARY_FORMAT_MESA); + } } void GLAPIENTRY -- 2.30.2