PyAPI: Add exceptions to stack push/pop

Raise exception when stack limits are reached.
This commit is contained in:
2017-08-20 17:23:49 +10:00
parent 33b265c4fb
commit 8037f3602f
3 changed files with 67 additions and 6 deletions

View File

@@ -113,6 +113,16 @@ const float (*gpuGetNormalMatrixInverse(float m[3][3]))[3];
void gpuBindMatrices(const Gwn_ShaderInterface*);
bool gpuMatricesDirty(void); /* since last bind */
/* Python API needs to be able to inspect the stack so errors raise exceptions instead of crashing. */
#ifdef USE_GPU_PY_MATRIX_API
int GPU_matrix_stack_level_get_model_view(void);
int GPU_matrix_stack_level_get_projection(void);
/* static assert ensures this doesn't change! */
#define GPU_PY_MATRIX_STACK_LEN 31
#endif /* USE_GPU_PY_MATRIX_API */
#ifdef __cplusplus
}
#endif