Blender  V2.93
gpu_py_types.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 "../generic/py_capi_utils.h"
27 #include "../generic/python_utildefines.h"
28 
29 #include "gpu_py_types.h" /* own include */
30 
31 /* -------------------------------------------------------------------- */
35 static struct PyModuleDef pygpu_types_module_def = {
36  PyModuleDef_HEAD_INIT,
37  .m_name = "gpu.types",
38 };
39 
40 PyObject *bpygpu_types_init(void)
41 {
42  PyObject *submodule;
43 
44  submodule = PyModule_Create(&pygpu_types_module_def);
45 
46  if (PyType_Ready(&BPyGPU_BufferType) < 0) {
47  return NULL;
48  }
49  if (PyType_Ready(&BPyGPUVertFormat_Type) < 0) {
50  return NULL;
51  }
52  if (PyType_Ready(&BPyGPUVertBuf_Type) < 0) {
53  return NULL;
54  }
55  if (PyType_Ready(&BPyGPUIndexBuf_Type) < 0) {
56  return NULL;
57  }
58  if (PyType_Ready(&BPyGPUBatch_Type) < 0) {
59  return NULL;
60  }
61  if (PyType_Ready(&BPyGPUOffScreen_Type) < 0) {
62  return NULL;
63  }
64  if (PyType_Ready(&BPyGPUShader_Type) < 0) {
65  return NULL;
66  }
67  if (PyType_Ready(&BPyGPUTexture_Type) < 0) {
68  return NULL;
69  }
70  if (PyType_Ready(&BPyGPUFrameBuffer_Type) < 0) {
71  return NULL;
72  }
73  if (PyType_Ready(&BPyGPUUniformBuf_Type) < 0) {
74  return NULL;
75  }
76 
77  PyModule_AddType(submodule, &BPyGPU_BufferType);
78  PyModule_AddType(submodule, &BPyGPUVertFormat_Type);
79  PyModule_AddType(submodule, &BPyGPUVertBuf_Type);
80  PyModule_AddType(submodule, &BPyGPUIndexBuf_Type);
81  PyModule_AddType(submodule, &BPyGPUBatch_Type);
82  PyModule_AddType(submodule, &BPyGPUOffScreen_Type);
83  PyModule_AddType(submodule, &BPyGPUShader_Type);
84  PyModule_AddType(submodule, &BPyGPUTexture_Type);
85  PyModule_AddType(submodule, &BPyGPUFrameBuffer_Type);
86  PyModule_AddType(submodule, &BPyGPUUniformBuf_Type);
87 
88  return submodule;
89 }
90 
PyTypeObject BPyGPUBatch_Type
Definition: gpu_py_batch.c:306
PyTypeObject BPyGPU_BufferType
PyTypeObject BPyGPUIndexBuf_Type
PyTypeObject BPyGPUFrameBuffer_Type
PyTypeObject BPyGPUOffScreen_Type
PyTypeObject BPyGPUShader_Type
PyTypeObject BPyGPUTexture_Type
static struct PyModuleDef pygpu_types_module_def
Definition: gpu_py_types.c:35
PyObject * bpygpu_types_init(void)
Definition: gpu_py_types.c:40
PyTypeObject BPyGPUUniformBuf_Type
PyTypeObject BPyGPUVertBuf_Type
PyTypeObject BPyGPUVertFormat_Type