Cleanup: Move some utilities to 'gpu_py.h'

This commit is contained in:
2021-02-22 09:44:57 -03:00
parent 8f6fd07b54
commit 5be72125bf
11 changed files with 35 additions and 39 deletions

View File

@@ -23,6 +23,7 @@
#include <Python.h>
#include "GPU_init_exit.h"
#include "GPU_primitive.h"
#include "GPU_texture.h"
@@ -58,3 +59,21 @@ struct PyC_StringEnumItems bpygpu_dataformat_items[] = {
{0, NULL},
};
/** \} */
/* -------------------------------------------------------------------- */
/** \name Utilities
* \{ */
bool bpygpu_is_init_or_error(void)
{
if (!GPU_is_init()) {
PyErr_SetString(PyExc_SystemError,
"GPU functions for drawing are not available in background mode");
return false;
}
return true;
}
/** \} */