Fix T96892 Overlay: Hiding all of a mesh in edit mode causes visual glitch
This is caused by the geometry shader used by the edit mode line drawing. If the drawcall uses indexed drawing and if the index buffer only contains restart indices, it seems the result is 1 glitchy invocation of the geometry shader. Workaround by tagging these special case index buffers and bypassing their drawcall.
This commit is contained in:
parent
74228e2cd2
commit
b47c5505aa
Notes:
blender-bot
2023-06-12 00:52:52 +02:00
Referenced by issue #97737, GPU Subdivision: Crash after opening particular files Referenced by issue #96892, Hiding all of a mesh (medium density or higher) in edit mode causes visual glitch
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue