Blender V5.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
11
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
22namespace blender {
23
24/* -------------------------------------------------------------------- */
27
29 {GPU_PRIM_POINTS, "POINTS"},
30 {GPU_PRIM_LINES, "LINES"},
31 {GPU_PRIM_TRIS, "TRIS"},
32 {GPU_PRIM_LINE_STRIP, "LINE_STRIP"},
33 {GPU_PRIM_LINE_LOOP, "LINE_LOOP"},
34 {GPU_PRIM_TRI_STRIP, "TRI_STRIP"},
35 {GPU_PRIM_TRI_FAN, "TRI_FAN"},
36 {GPU_PRIM_LINES_ADJ, "LINES_ADJ"},
37 {GPU_PRIM_TRIS_ADJ, "TRIS_ADJ"},
38 {GPU_PRIM_LINE_STRIP_ADJ, "LINE_STRIP_ADJ"},
39 {0, nullptr},
40};
41
43 {GPU_DATA_FLOAT, "FLOAT"},
44 {GPU_DATA_INT, "INT"},
45 {GPU_DATA_UINT, "UINT"},
46 {GPU_DATA_UBYTE, "UBYTE"},
47 {GPU_DATA_UINT_24_8_DEPRECATED, "UINT_24_8"},
48 {GPU_DATA_10_11_11_REV, "10_11_11_REV"},
49 {0, nullptr},
50};
51
53
54/* -------------------------------------------------------------------- */
57
59{
60 if (!GPU_is_init()) {
61 PyErr_SetString(
62 PyExc_SystemError,
63 "GPU functions for drawing requires the gpu module to be initialized. See gpu.init.");
64 return false;
65 }
66
67 return true;
68}
69
71
72} // namespace blender
BMesh Iterators.
PyC_StringEnumItems bpygpu_dataformat_items[]
Definition gpu_py.cc:42
@ GPU_DATA_10_11_11_REV
@ GPU_DATA_UINT_24_8_DEPRECATED
@ GPU_PRIM_TRI_STRIP
@ GPU_PRIM_TRIS_ADJ
@ GPU_PRIM_LINES_ADJ
@ GPU_PRIM_LINE_STRIP_ADJ
@ GPU_PRIM_LINE_STRIP
@ GPU_PRIM_LINE_LOOP
PyC_StringEnumItems bpygpu_primtype_items[]
Definition gpu_py.cc:28
bool bpygpu_is_init_or_error()
Definition gpu_py.cc:58
bool GPU_is_init()