diff options
author | Jeroen Bakker <jeroen@blender.org> | 2019-12-03 10:27:55 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2019-12-04 17:17:09 +0300 |
commit | 9c337fcfe2a46b2ccfb8a4960b7af0eac5c615de (patch) | |
tree | d85b5e66174d01ef509fa49745fecf70a9043955 /source/blender/gpu | |
parent | 186d74020e50f894982fb678434716dc2646171b (diff) |
Fix T72130: Wireframe Visible After Disabling
The lines index buffer can contain all edges (edit mode) or only loose
edges (object mode). When switching between these modes the wrong
content of the index buffer can be used.
This patch will clear the lines index buffer when a `loose_edges` is requested. Making sure it is always up to date.
Note that this is supporting an exising hack where the IBO is truncated
during the creation. We should find a different way how to solve these
kind of issues.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D6349
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_element.h | 4 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_element.c | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/gpu/GPU_element.h b/source/blender/gpu/GPU_element.h index 75caf4cbd6a..996ade3e0f6 100644 --- a/source/blender/gpu/GPU_element.h +++ b/source/blender/gpu/GPU_element.h @@ -90,6 +90,10 @@ void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *, GPUIndexBuf *); /* Create a subrange of an existing indexbuffer. */ GPUIndexBuf *GPU_indexbuf_create_subrange(GPUIndexBuf *ibo, uint start, uint length); +void GPU_indexbuf_create_subrange_in_place(GPUIndexBuf *r_ibo, + GPUIndexBuf *ibo, + uint start, + uint length); void GPU_indexbuf_discard(GPUIndexBuf *); diff --git a/source/blender/gpu/intern/gpu_element.c b/source/blender/gpu/intern/gpu_element.c index 518829d1c78..036588b4a48 100644 --- a/source/blender/gpu/intern/gpu_element.c +++ b/source/blender/gpu/intern/gpu_element.c @@ -242,6 +242,15 @@ void GPU_indexbuf_set_tri_restart(GPUIndexBufBuilder *builder, uint elem) GPUIndexBuf *GPU_indexbuf_create_subrange(GPUIndexBuf *elem_src, uint start, uint length) { GPUIndexBuf *elem = MEM_callocN(sizeof(GPUIndexBuf), "GPUIndexBuf"); + GPU_indexbuf_create_subrange_in_place(elem, elem_src, start, length); + return elem; +} + +void GPU_indexbuf_create_subrange_in_place(GPUIndexBuf *elem, + GPUIndexBuf *elem_src, + uint start, + uint length) +{ BLI_assert(elem_src && !elem_src->is_subrange); BLI_assert((length == 0) || (start + length <= elem_src->index_len)); #if GPU_TRACK_INDEX_RANGE @@ -253,7 +262,6 @@ GPUIndexBuf *GPU_indexbuf_create_subrange(GPUIndexBuf *elem_src, uint start, uin elem->src = elem_src; elem->index_start = start; elem->index_len = length; - return elem; } #if GPU_TRACK_INDEX_RANGE |