From: Pierre-Eric Pelloux-Prayer Date: Thu, 9 May 2019 07:52:40 +0000 (+0200) Subject: mesa: fix GL_PROGRAM_BINARY_RETRIEVABLE_HINT handling X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=62ed82ea1a93e4fb9676a1edd9447b26cdd4f173;p=mesa.git mesa: fix GL_PROGRAM_BINARY_RETRIEVABLE_HINT handling When first implemented in fefd03e16c16 Mesa's behavior was aligned on behavior of Nvidia's driver. This caused a failing test in piglit but was ok since the specification is unclear on this subject. Nvidia's driver behavior has been modified because using version 410.104, the problematic test (program_binary_retrievable_hint) now passes. This commit defers BinaryRetrievableHint update until the next linking so the test passes on Mesa as well. Signed-off-by: Pierre-Eric Pelloux-Prayer Signed-off-by: Marek Olšák --- diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 0ca87561f05..76905f60662 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2956,8 +2956,13 @@ struct gl_shader_program /** * Is the application intending to glGetProgramBinary this program? + * + * BinaryRetrievableHint is the currently active hint that gets set + * during initialization and after linking and BinaryRetrievableHintPending + * is the hint set by the user to be active when program is linked next time. */ - GLboolean BinaryRetreivableHint; + GLboolean BinaryRetrievableHint; + GLboolean BinaryRetrievableHintPending; /** * Indicates whether program can be bound for individual pipeline stages diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 6b73e6c7e7a..2cc5fe5d8f8 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -843,7 +843,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx)) break; - *params = shProg->BinaryRetreivableHint; + *params = shProg->BinaryRetrievableHint; return; case GL_PROGRAM_BINARY_LENGTH: if (ctx->Const.NumProgramBinaryFormats == 0 || !shProg->data->LinkStatus) { @@ -1287,6 +1287,8 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg, _mesa_update_vertex_processing_mode(ctx); + shProg->BinaryRetrievableHint = shProg->BinaryRetrievableHintPending; + /* debug code */ if (0) { GLuint i; @@ -2380,7 +2382,7 @@ program_parameteri(struct gl_context *ctx, struct gl_shader_program *shProg, * will not be in effect until the next time LinkProgram or * ProgramBinary has been called successfully." * - * The resloution of issue 9 in the extension spec also says: + * The resolution of issue 9 in the extension spec also says: * * "The application may use the PROGRAM_BINARY_RETRIEVABLE_HINT hint * to indicate to the GL implementation that this program will @@ -2389,7 +2391,7 @@ program_parameteri(struct gl_context *ctx, struct gl_shader_program *shProg, * changes made to the program before being saved such that when it * is loaded again a recompile can be avoided." */ - shProg->BinaryRetreivableHint = value; + shProg->BinaryRetrievableHintPending = value; return; case GL_PROGRAM_SEPARABLE: