From: Jordan Justen Date: Sat, 4 Nov 2017 23:47:54 +0000 (-0700) Subject: main: add binary support to ProgramBinary X-Git-Tag: upstream/18.1.0~3346 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50c09a648f6d389cdc1657a0ccf54cf263aa8aa6;p=platform%2Fupstream%2Fmesa.git main: add binary support to ProgramBinary V2: call generic mesa_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 b728b32..51031e1 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2221,9 +2221,6 @@ _mesa_ProgramBinary(GLuint program, GLenum binaryFormat, if (!shProg) return; - (void) binaryFormat; - (void) binary; - /* 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 @@ -2234,20 +2231,25 @@ _mesa_ProgramBinary(GLuint program, GLenum binaryFormat, return; } - /* The ARB_get_program_binary spec says: - * - * " and must be those returned by a previous - * call to GetProgramBinary, and must be the length of the - * program binary as returned by GetProgramBinary or GetProgramiv with - * PROGRAM_BINARY_LENGTH. Loading the program binary will fail, - * setting the LINK_STATUS of to FALSE, if these conditions - * are not met." - * - * Since any value of binaryFormat passed "is not one of those specified as - * allowable for [this] command, an INVALID_ENUM error is generated." - */ - shProg->data->LinkStatus = linking_failure; - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramBinary"); + if (ctx->Const.NumProgramBinaryFormats == 0 || + binaryFormat != GL_PROGRAM_BINARY_FORMAT_MESA) { + /* The ARB_get_program_binary spec says: + * + * " and must be those returned by a previous + * call to GetProgramBinary, and must be the length of the + * program binary as returned by GetProgramBinary or GetProgramiv with + * PROGRAM_BINARY_LENGTH. Loading the program binary will fail, + * setting the LINK_STATUS of to FALSE, if these conditions + * are not met." + * + * Since any value of binaryFormat passed "is not one of those specified as + * allowable for [this] command, an INVALID_ENUM error is generated." + */ + shProg->data->LinkStatus = linking_failure; + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramBinary"); + } else { + _mesa_program_binary(ctx, shProg, binaryFormat, binary, length); + } }