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:
authorClément Foucault <foucault.clem@gmail.com>2018-03-12 01:43:09 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-03-12 01:44:10 +0300
commit765d7242d5a14551d0dc876f13bf6ee579b47b10 (patch)
treec18455eaabcad076fe98427d1a32d76d2c9c38f7 /source/blender/windowmanager
parent7194259fb1a8b9ef84c0896130b92ff577fc76b1 (diff)
GPUMaterial: Add Material shader cache.
This is mostly to avoid re-compilation when using undo/redo operators. This also has the benefit to reuse the same GPUShader for multiple materials using the same nodetree configuration. The cache stores GPUPasses that already contains the shader code and a hash to test for matches. We use refcounts to know when a GPUPass is not used anymore. I had to move the GPUInput list from GPUPass to GPUMaterial because it's containing references to the material nodetree and cannot be reused. A garbage collection is hardcoded to run every 60 seconds to free every unused GPUPass.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index a2f5f1b1e10..98ac3eebb57 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -116,6 +116,7 @@
#include "BLF_api.h"
#include "BLT_lang.h"
+#include "GPU_material.h"
#include "GPU_buffers.h"
#include "GPU_draw.h"
#include "GPU_init_exit.h"
@@ -553,6 +554,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
BLF_exit();
if (!G.background) {
+ GPU_pass_cache_free();
DRW_opengl_context_destroy();
}