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.
This commit is contained in:
Clément Foucault 2019-06-06 17:21:12 +02:00
parent 2239dca7e9
commit 2be3a75efd
Notes: blender-bot 2023-02-14 06:45:14 +01:00
Referenced by issue #65383, UI graphics glitches on macOS with Intel HD 4000
2 changed files with 13 additions and 0 deletions

View File

@ -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
}
}

View File

@ -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) */