diff options
author | Campbell Barton <campbell@blender.org> | 2022-05-11 09:34:33 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-05-11 09:34:33 +0300 |
commit | c0546ff95300dada91ea9803ef308032a3392008 (patch) | |
tree | f3b0fd7e0416a0a7da802bf2eedd0c3c1e5b8a83 | |
parent | 0c5a7ca1177ab5f508df3a1456c6243e9f5949bc (diff) | |
parent | b47c5505aa3791639c2bd7d68a95bd1515e606ed (diff) |
Merge branch 'blender-v3.2-release'
-rw-r--r-- | source/blender/gpu/intern/gpu_index_buffer.cc | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_index_buffer_private.hh | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_index_buffer.cc b/source/blender/gpu/intern/gpu_index_buffer.cc index 54473b3a44d..146461d1dfb 100644 --- a/source/blender/gpu/intern/gpu_index_buffer.cc +++ b/source/blender/gpu/intern/gpu_index_buffer.cc @@ -232,6 +232,7 @@ void IndexBuf::init(uint indices_len, uint32_t *indices, uint min_index, uint ma data_ = indices; index_start_ = 0; index_len_ = indices_len; + is_empty_ = min_index > max_index; #if GPU_TRACK_INDEX_RANGE /* Everything remains 32 bit while building to keep things simple. diff --git a/source/blender/gpu/intern/gpu_index_buffer_private.hh b/source/blender/gpu/intern/gpu_index_buffer_private.hh index 9323a81d393..6ce62ae852e 100644 --- a/source/blender/gpu/intern/gpu_index_buffer_private.hh +++ b/source/blender/gpu/intern/gpu_index_buffer_private.hh @@ -45,6 +45,8 @@ class IndexBuf { bool is_init_ = false; /** Is this object only a reference to a subrange of another IndexBuf. */ bool is_subrange_ = false; + /** True if buffer only contains restart indices. */ + bool is_empty_ = false; union { /** Mapped buffer data. non-NULL indicates not yet sent to VRAM. */ @@ -61,9 +63,12 @@ class IndexBuf { void init_subrange(IndexBuf *elem_src, uint start, uint length); void init_build_on_device(uint index_len); + /* Returns render index count (not precise). */ uint32_t index_len_get() const { - return index_len_; + /* Return 0 to bypass drawing for index buffers full of restart indices. + * They can lead to graphical glitches on some systems. (See T96892) */ + return is_empty_ ? 0 : index_len_; } /* Return size in byte of the drawable data buffer range. Actual buffer size might be bigger. */ size_t size_get() const |