diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-12 18:44:47 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-12 19:06:36 +0300 |
commit | 879ed5a165ae870c7a8967fdd0f084ea7b16ca13 (patch) | |
tree | c1f11b640f8042c9eb9737955c06b54f3b5b0310 /source/blender/draw/engines | |
parent | bea79e0c7bd76f55db0e58f6e8ca9386e780b143 (diff) |
EEVEE: Motion Blur: Fix issue with batch overflowing with VBOs
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_motion_blur.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index a02007fede9..91a9939cd1f 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -492,14 +492,7 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata) } else { /* Modify the batch to include the previous & next position. */ - if (i == MB_PREV) { - GPU_batch_vertbuf_add_ex(batch, vbo, true); - mb_geom->vbo[i] = NULL; - } - else { - /* This VBO can be reuse by next time step. Don't pass ownership. */ - GPU_batch_vertbuf_add_ex(batch, vbo, false); - } + GPU_batch_vertbuf_add_ex(batch, vbo, false); } } } @@ -568,6 +561,15 @@ void EEVEE_motion_blur_swap_data(EEVEE_Data *vedata) break; case EEVEE_MOTION_DATA_MESH: + if (mb_geom->batch != NULL) { + for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN; i++) { + if (mb_geom->batch->verts[i] == mb_geom->vbo[MB_PREV] || + mb_geom->batch->verts[i] == mb_geom->vbo[MB_NEXT]) { + /* Avoid double reference of the VBOs. */ + mb_geom->batch->verts[i] = NULL; + } + } + } GPU_VERTBUF_DISCARD_SAFE(mb_geom->vbo[MB_PREV]); mb_geom->vbo[MB_PREV] = mb_geom->vbo[MB_NEXT]; |