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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-04 12:13:13 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-04 12:30:55 +0300
commitfb5a57ab97279728b6a44641ea72d340058057db (patch)
treef77dcbdeffc2467baafad9c0fad738c56efff83d /source/blender/draw/intern
parent3f4df3f847a948b9e9954d00311b0135008258f8 (diff)
Fix part of T53497: Eevee stuttering on macOS for the first few seconds of usage.
The problem was that textures were assigned to different slots on different draw calls, which caused shader specialization/patching by the driver. So the shader would be compiled over and over until all possible assignments were used.
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/draw_manager_data.c19
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c8
2 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index b09e45e90f7..23e339bcd8f 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -82,7 +82,24 @@ static void drw_shgroup_uniform_create_ex(DRWShadingGroup *shgroup, int loc,
uni->length = length;
uni->arraysize = arraysize;
- BLI_LINKS_PREPEND(shgroup->uniforms, uni);
+ /* Insert into list sorted by location so that slots are consistenly assigned
+ * for different draw calls, to avoid shader specialization/patching by the driver. */
+ DRWUniform *next = shgroup->uniforms;
+ DRWUniform *prev = NULL;
+
+ while (next && loc > next->location) {
+ prev = next;
+ next = next->next;
+ }
+
+ if (prev) {
+ prev->next = uni;
+ }
+ else {
+ shgroup->uniforms = uni;
+ }
+
+ uni->next = next;
}
static void drw_shgroup_builtin_uniform(
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index 58cd6ce44c6..e69a1026815 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -861,6 +861,10 @@ static void release_texture_slots(bool with_persist)
DST.RST.bound_tex_slots[i] = BIND_NONE;
}
}
+
+ /* Reset so that slots are consistenly assigned for different shader
+ * draw calls, to avoid shader specialization/patching by the driver. */
+ DST.RST.bind_tex_inc = 0;
}
static void release_ubo_slots(bool with_persist)
@@ -874,6 +878,10 @@ static void release_ubo_slots(bool with_persist)
DST.RST.bound_ubo_slots[i] = BIND_NONE;
}
}
+
+ /* Reset so that slots are consistenly assigned for different shader
+ * draw calls, to avoid shader specialization/patching by the driver. */
+ DST.RST.bind_ubo_inc = 0;
}
static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)