From: Jordan Justen Date: Sat, 4 Nov 2017 23:47:25 +0000 (-0700) Subject: main: add binary support to GetProgramBinary X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ee54ad057f05881d650443de13a6bf8099e7922;p=mesa.git main: add binary support to GetProgramBinary 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 --- 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