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-11-16 21:26:23 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-11-16 21:26:23 +0300
commit2c347ebbba9b76c26f3a4b1e4f8bbe84cb90d1f4 (patch)
tree9224a975548570da64af7700be3a389905ab5879 /source/blender/editors/space_action
parent64dc0f2685afbd829fffa1a95741006b7a734f7d (diff)
Fix T57874: Crash due to IMM_BUFFER_SIZE when drawing cached frames...
... in the timeline.
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r--source/blender/editors/space_action/action_draw.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 77def4af6d0..738c5e4d2e2 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -476,7 +476,6 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
}
const int sta = pid->cache->startframe, end = pid->cache->endframe;
- const int len = (end - sta + 1) * 6;
GPU_blend(true);
@@ -493,23 +492,40 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
immUniformColor4fv(col);
- if (len > 0) {
- immBeginAtMost(GPU_PRIM_TRIS, len);
+ {
+ /* draw a quad for each chunk of consecutive cached frames */
+ const int chunk_tot = 32;
+ int chunk_len = 0;
+ int ista = 0, iend = -1;
- /* draw a quad for each cached frame */
for (int i = sta; i <= end; i++) {
if (pid->cache->cached_frames[i - sta]) {
- immVertex2f(pos, (float)i - 0.5f, 0.0f);
- immVertex2f(pos, (float)i - 0.5f, 1.0f);
- immVertex2f(pos, (float)i + 0.5f, 1.0f);
-
- immVertex2f(pos, (float)i - 0.5f, 0.0f);
- immVertex2f(pos, (float)i + 0.5f, 1.0f);
- immVertex2f(pos, (float)i + 0.5f, 0.0f);
+ if (chunk_len == 0) {
+ immBeginAtMost(GPU_PRIM_TRIS, chunk_tot * 6);
+ }
+ if (ista > iend) {
+ chunk_len++;
+ ista = i;
+ }
+ iend = i;
+ }
+ else {
+ if (ista <= iend) {
+ immRectf_fast(pos, (float)ista - 0.5f, 0.0f, (float)iend + 0.5f, 1.0f);
+ iend = ista - 1;
+ }
+ if (chunk_len >= chunk_tot) {
+ immEnd();
+ chunk_len = 0;
+ }
}
}
-
- immEnd();
+ if (ista <= iend) {
+ immRectf_fast(pos, (float)ista - 0.5f, 0.0f, (float)iend + 0.5f, 1.0f);
+ }
+ if (chunk_len != 0) {
+ immEnd();
+ }
}
GPU_blend(false);