Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2019-03-11 18:22:33 +0300
committermano-wii <germano.costa@ig.com.br>2019-03-11 18:23:04 +0300
commit005084ef62b63645f9189c493f4cdd5b49e7c7d7 (patch)
tree3c7c4e3d89c51c75bf99eaa6b363ca9668003b6f /source/blender/gpu
parent2703c405a4d8fee9c8f867cd02e603d0070b2ba5 (diff)
GPU: Make the creation of opengl shaders more stable.
This commit possibly fixes the T58938. The crash happens when a shader that is created in a rendering context is deleted and another shader with the same name/program of the deleted one is created in the same context and used in another context.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 63d875b07fd..8be4c178a75 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1254,8 +1254,6 @@ void GPU_nodes_extract_dynamic_inputs(GPUShader *shader, ListBase *inputs, ListB
if (!shader)
return;
- GPU_shader_bind(shader);
-
for (node = nodes->first; node; node = node->next) {
int z = 0;
for (input = node->inputs.first; input; input = next, z++) {
@@ -1284,8 +1282,6 @@ void GPU_nodes_extract_dynamic_inputs(GPUShader *shader, ListBase *inputs, ListB
}
}
}
-
- GPU_shader_unbind();
}
/* Node Link Functions */
@@ -1983,6 +1979,13 @@ void GPU_pass_compile(GPUPass *pass, const char *shname)
pass->shader = NULL;
}
pass->compiled = true;
+
+ if (!BLI_thread_is_main()) {
+ /* For some drivers, you must use the program at least once in the
+ * rendering context that it is created. */
+ glUseProgram(GPU_shader_get_program(pass->shader));
+ glUseProgram(0);
+ }
}
}