Blender  V2.93
gpu_py.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
24 #include <Python.h>
25 
26 #include "GPU_init_exit.h"
27 #include "GPU_primitive.h"
28 #include "GPU_texture.h"
29 
30 #include "../generic/py_capi_utils.h"
31 
32 #include "gpu_py.h" /* own include */
33 
34 /* -------------------------------------------------------------------- */
39  {GPU_PRIM_POINTS, "POINTS"},
40  {GPU_PRIM_LINES, "LINES"},
41  {GPU_PRIM_TRIS, "TRIS"},
42  {GPU_PRIM_LINE_STRIP, "LINE_STRIP"},
43  {GPU_PRIM_LINE_LOOP, "LINE_LOOP"},
44  {GPU_PRIM_TRI_STRIP, "TRI_STRIP"},
45  {GPU_PRIM_TRI_FAN, "TRI_FAN"},
46  {GPU_PRIM_LINES_ADJ, "LINES_ADJ"},
47  {GPU_PRIM_TRIS_ADJ, "TRIS_ADJ"},
48  {GPU_PRIM_LINE_STRIP_ADJ, "LINE_STRIP_ADJ"},
49  {0, NULL},
50 };
51 
53  {GPU_DATA_FLOAT, "FLOAT"},
54  {GPU_DATA_INT, "INT"},
55  {GPU_DATA_UINT, "UINT"},
56  {GPU_DATA_UBYTE, "UBYTE"},
57  {GPU_DATA_UINT_24_8, "UINT_24_8"},
58  {GPU_DATA_10_11_11_REV, "10_11_11_REV"},
59  {0, NULL},
60 };
63 /* -------------------------------------------------------------------- */
68 {
69  if (!GPU_is_init()) {
70  PyErr_SetString(PyExc_SystemError,
71  "GPU functions for drawing are not available in background mode");
72 
73  return false;
74  }
75 
76  return true;
77 }
78 
bool GPU_is_init(void)
Definition: gpu_init_exit.c:76
@ GPU_PRIM_TRI_FAN
Definition: GPU_primitive.h:41
@ GPU_PRIM_LINE_LOOP
Definition: GPU_primitive.h:39
@ GPU_PRIM_LINE_STRIP_ADJ
Definition: GPU_primitive.h:45
@ GPU_PRIM_TRIS_ADJ
Definition: GPU_primitive.h:44
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:36
@ GPU_PRIM_POINTS
Definition: GPU_primitive.h:35
@ GPU_PRIM_LINES_ADJ
Definition: GPU_primitive.h:43
@ GPU_PRIM_LINE_STRIP
Definition: GPU_primitive.h:38
@ GPU_PRIM_TRI_STRIP
Definition: GPU_primitive.h:40
@ GPU_PRIM_TRIS
Definition: GPU_primitive.h:37
@ GPU_DATA_UINT_24_8
Definition: GPU_texture.h:176
@ GPU_DATA_INT
Definition: GPU_texture.h:173
@ GPU_DATA_10_11_11_REV
Definition: GPU_texture.h:177
@ GPU_DATA_UBYTE
Definition: GPU_texture.h:175
@ GPU_DATA_UINT
Definition: GPU_texture.h:174
@ GPU_DATA_FLOAT
Definition: GPU_texture.h:172
struct PyC_StringEnumItems bpygpu_dataformat_items[]
Definition: gpu_py.c:52
struct PyC_StringEnumItems bpygpu_primtype_items[]
Definition: gpu_py.c:38
bool bpygpu_is_init_or_error(void)
Definition: gpu_py.c:67