Blender V4.3
gpu_py.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
12#include <Python.h>
13
14#include "GPU_init_exit.hh"
15#include "GPU_primitive.hh"
16#include "GPU_texture.hh"
17
19
20#include "gpu_py.hh" /* own include */
21
22/* -------------------------------------------------------------------- */
27 {GPU_PRIM_POINTS, "POINTS"},
28 {GPU_PRIM_LINES, "LINES"},
29 {GPU_PRIM_TRIS, "TRIS"},
30 {GPU_PRIM_LINE_STRIP, "LINE_STRIP"},
31 {GPU_PRIM_LINE_LOOP, "LINE_LOOP"},
32 {GPU_PRIM_TRI_STRIP, "TRI_STRIP"},
33 {GPU_PRIM_TRI_FAN, "TRI_FAN"},
34 {GPU_PRIM_LINES_ADJ, "LINES_ADJ"},
35 {GPU_PRIM_TRIS_ADJ, "TRIS_ADJ"},
36 {GPU_PRIM_LINE_STRIP_ADJ, "LINE_STRIP_ADJ"},
37 {0, nullptr},
38};
39
41 {GPU_DATA_FLOAT, "FLOAT"},
42 {GPU_DATA_INT, "INT"},
43 {GPU_DATA_UINT, "UINT"},
44 {GPU_DATA_UBYTE, "UBYTE"},
45 {GPU_DATA_UINT_24_8, "UINT_24_8"},
46 {GPU_DATA_10_11_11_REV, "10_11_11_REV"},
47 {0, nullptr},
48};
49
52/* -------------------------------------------------------------------- */
57{
58 if (!GPU_is_init()) {
59 PyErr_SetString(PyExc_SystemError,
60 "GPU functions for drawing are not available in background mode");
61
62 return false;
63 }
64
65 return true;
66}
67
bool GPU_is_init()
@ GPU_PRIM_TRI_FAN
@ GPU_PRIM_LINE_LOOP
@ GPU_PRIM_LINE_STRIP_ADJ
@ GPU_PRIM_TRIS_ADJ
@ GPU_PRIM_LINES
@ GPU_PRIM_POINTS
@ GPU_PRIM_LINES_ADJ
@ GPU_PRIM_LINE_STRIP
@ GPU_PRIM_TRI_STRIP
@ GPU_PRIM_TRIS
@ GPU_DATA_UINT_24_8
@ GPU_DATA_INT
@ GPU_DATA_10_11_11_REV
@ GPU_DATA_UBYTE
@ GPU_DATA_UINT
@ GPU_DATA_FLOAT
bool bpygpu_is_init_or_error()
Definition gpu_py.cc:56
PyC_StringEnumItems bpygpu_primtype_items[]
Definition gpu_py.cc:26
PyC_StringEnumItems bpygpu_dataformat_items[]
Definition gpu_py.cc:40