diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-06-06 18:21:12 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-06-06 18:21:22 +0300 |
commit | 2be3a75efd9b60cac64980bb83003a7370c3bd08 (patch) | |
tree | 1ba47bcb6d883482634dfb8542cce66ade069359 /source | |
parent | 2239dca7e9359ad0b1b8abe5fbbdefaeb85b480f (diff) |
Fix T65383 UI graphics glitches on macOS with Intel HD 4000
glDrawArrays is not supposed to be affected by primitive restart
but osx drivers never cease to surprise me.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.c | 6 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate.c | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index 1fb11da4fea..ba3c7f68518 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -634,12 +634,18 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_fi } } else { +#ifdef __APPLE__ + glDisable(GL_PRIMITIVE_RESTART); +#endif if (GLEW_ARB_base_instance) { glDrawArraysInstancedBaseInstance(batch->gl_prim_type, v_first, v_count, i_count, i_first); } else { glDrawArraysInstanced(batch->gl_prim_type, v_first, v_count, i_count); } +#ifdef __APPLE__ + glEnable(GL_PRIMITIVE_RESTART); +#endif } } diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c index 2fa7ee5fb32..6b5c4836e83 100644 --- a/source/blender/gpu/intern/gpu_immediate.c +++ b/source/blender/gpu/intern/gpu_immediate.c @@ -383,9 +383,16 @@ void immEnd(void) } else { glUnmapBuffer(GL_ARRAY_BUFFER); + if (imm.vertex_len > 0) { immDrawSetup(); +#ifdef __APPLE__ + glDisable(GL_PRIMITIVE_RESTART); +#endif glDrawArrays(convert_prim_type_to_gl(imm.prim_type), 0, imm.vertex_len); +#ifdef __APPLE__ + glEnable(GL_PRIMITIVE_RESTART); +#endif } /* These lines are causing crash on startup on some old GPU + drivers. * They are not required so just comment them. (T55722) */ |