Page MenuHome

Make GPU_pass_cache_garbage_collect run in another rendering context.

Authored by Germano Cavalcante (mano-wii) on Mar 18 2019, 4:11 PM.



This fixes a crash on old Intel GPUs.
This patch forces the compilation of shaders in only one thread at a time.
So there is no longer the need to create multiple rendering contexts.
Thus having a thread and a rendering context, this can be used for the GPU_pass_cache_garbage_collect and thus fix the Intel crash that involves:

  • deleting shaders in the same context in which they were used,
  • re-creating a shader with the same program nme in another context and
  • reusing in the first context .


  • I only know how to use the BLI_rw_mutex_lock and BLI_rw_mutex_unlock functions, I don't know the impact of replacing BLI_spin_lock;
  • Is there a better place for DRW_deferred_shader_init and DRW_deferred_shader_end?;

Diff Detail

rB Blender
Build Status
Buildable 3172
Build 3172: arc lint + arc unit

Event Timeline

Harbormaster completed remote builds in B3164: Diff 14250.
  • comment out the code.
  • make drw_deferred_shader_compilation_exec more protected from interruptions.
  • Using a bool to check if the loop to compile shaders is still running is dangerous.

Better check if the list of materials is empty.