BGL: Workaround broken bgl usage caused by GPU refactor

This directly adress the issues caused by rB536c2e0ec916.

Since the state tracking is done at a lower level, using the bgl
functions needs to be safegarded by the state manager.
The current workaround is to bypass `apply_state` when inside a
callback that used a `bgl` function.

Related to T80730.

This fix T81003.

Also this fix the default blend equation for callbacks.
Fixes T80169 T81289.
This commit is contained in:
2020-10-08 16:19:42 +02:00
parent 5f364216ac
commit f12b0373f3
7 changed files with 50 additions and 10 deletions

View File

@@ -29,6 +29,8 @@
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "GPU_state.h"
#include "../generic/py_capi_utils.h"
#include "glew-mx.h"
@@ -1109,6 +1111,7 @@ static PyObject *Buffer_repr(Buffer *self)
if (!PyArg_ParseTuple(args, arg_str arg_list, arg_ref arg_list)) { \
return NULL; \
} \
GPU_bgl_start(); \
ret_set_##ret gl##funcname(arg_var arg_list); \
ret_ret_##ret; \
}