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>2019-01-17 20:33:08 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-01-17 21:48:00 +0300
commite3b3b3207682233978dac5b06aef6748dcc0367c (patch)
tree34adba542c21f2c983b072e4d7330ce64b55a6b1 /source/blender/draw/intern/draw_manager_exec.c
parentdc7e492989408038c89b5283ec5710b98457696f (diff)
DRW: Use name buffer to request uniform location before drawing.
This is in order to avoid GL call during the "cache creation" phase and support multithreading.
Diffstat (limited to 'source/blender/draw/intern/draw_manager_exec.c')
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index a428fde6f00..1f1ccc7a66e 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -1050,6 +1050,12 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
/* Binding Uniform */
for (DRWUniform *uni = shgroup->uniforms; uni; uni = uni->next) {
+ if (uni->location == -2) {
+ uni->location = GPU_shader_get_uniform_ensure(shgroup->shader, DST.uniform_names.buffer + uni->name_ofs);
+ if (uni->location == -1) {
+ continue;
+ }
+ }
switch (uni->type) {
case DRW_UNIFORM_SHORT_TO_INT:
val = (int)*((short *)uni->pvalue);