From f9a5f94e777fabdd15639d35ca169f3e6b33714a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Tue, 30 Jan 2018 09:51:24 +0200 Subject: [PATCH] mesa: call useprogram(0) for DeletePending programs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This decrements current active shader program refcount and destroys it if it had DeletePending set. Signed-off-by: Tapani Pälli --- src/mesa/main/shaderapi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 76bad7f31e..1f92dcb268 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2053,6 +2053,15 @@ use_program(GLuint program, bool no_error) if (shProg) { /* Attach shader state to the binding point */ _mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader); + + /* Check if we have existing active program that has DeletePending set. + * If we have such, let's get rid of it immediatly. + */ + if (ctx->Shader.ActiveProgram && + ctx->Shader.ActiveProgram->DeletePending) { + _mesa_use_shader_program(ctx, 0); + } + /* Update the program */ _mesa_use_shader_program(ctx, shProg); } else { -- 2.14.3