Blender  V2.93
gpu_py_api.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 
27 #include <Python.h>
28 
29 #include "BLI_utildefines.h"
30 
31 #include "../generic/python_utildefines.h"
32 
33 #include "gpu_py_matrix.h"
34 #include "gpu_py_select.h"
35 #include "gpu_py_state.h"
36 #include "gpu_py_types.h"
37 
38 #include "gpu_py_api.h" /* own include */
39 
40 /* -------------------------------------------------------------------- */
44 PyDoc_STRVAR(pygpu_doc,
45  "This module provides Python wrappers for the GPU implementation in Blender.\n"
46  "Some higher level functions can be found in the `gpu_extras` module.");
47 static struct PyModuleDef pygpu_module_def = {
48  PyModuleDef_HEAD_INIT,
49  .m_name = "gpu",
50  .m_doc = pygpu_doc,
51 };
52 
53 PyObject *BPyInit_gpu(void)
54 {
55  PyObject *sys_modules = PyImport_GetModuleDict();
56  PyObject *submodule;
57  PyObject *mod;
58 
59  mod = PyModule_Create(&pygpu_module_def);
60 
61  PyModule_AddObject(mod, "types", (submodule = bpygpu_types_init()));
62  PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
63 
64  PyModule_AddObject(mod, "matrix", (submodule = bpygpu_matrix_init()));
65  PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
66 
67  PyModule_AddObject(mod, "select", (submodule = bpygpu_select_init()));
68  PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
69 
70  PyModule_AddObject(mod, "shader", (submodule = bpygpu_shader_init()));
71  PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
72 
73  PyModule_AddObject(mod, "state", (submodule = bpygpu_state_init()));
74  PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
75 
76  PyModule_AddObject(mod, "texture", (submodule = bpygpu_texture_init()));
77  PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
78 
79  return mod;
80 }
81 
PyObject * BPyInit_gpu(void)
Definition: gpu_py_api.c:53
PyDoc_STRVAR(pygpu_doc, "This module provides Python wrappers for the GPU implementation in Blender.\n" "Some higher level functions can be found in the `gpu_extras` module.")
static struct PyModuleDef pygpu_module_def
Definition: gpu_py_api.c:47
PyObject * bpygpu_matrix_init(void)
PyObject * bpygpu_select_init(void)
Definition: gpu_py_select.c:79
PyObject * bpygpu_shader_init(void)
PyObject * bpygpu_state_init(void)
Definition: gpu_py_state.c:410
PyObject * bpygpu_texture_init(void)
PyObject * bpygpu_types_init(void)
Definition: gpu_py_types.c:40
ccl_device_inline int mod(int x, int m)
Definition: util_math.h:405