Blender  V3.3
gpu_py_platform.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
10 #include <Python.h>
11 
12 #include "BLI_utildefines.h"
13 
14 #include "GPU_platform.h"
15 
16 #include "gpu_py_platform.h" /* Own include. */
17 
18 /* -------------------------------------------------------------------- */
22 PyDoc_STRVAR(pygpu_platform_vendor_get_doc,
23  ".. function:: vendor_get()\n"
24  "\n"
25  " Get GPU vendor.\n"
26  "\n"
27  " :return: Vendor name.\n"
28  " :rtype: str\n");
29 static PyObject *pygpu_platform_vendor_get(PyObject *UNUSED(self))
30 {
31  return PyUnicode_FromString(GPU_platform_vendor());
32 }
33 
34 PyDoc_STRVAR(pygpu_platform_renderer_get_doc,
35  ".. function:: renderer_get()\n"
36  "\n"
37  " Get GPU to be used for rendering.\n"
38  "\n"
39  " :return: GPU name.\n"
40  " :rtype: str\n");
41 static PyObject *pygpu_platform_renderer_get(PyObject *UNUSED(self))
42 {
43  return PyUnicode_FromString(GPU_platform_renderer());
44 }
45 
46 PyDoc_STRVAR(pygpu_platform_version_get_doc,
47  ".. function:: version_get()\n"
48  "\n"
49  " Get GPU driver version.\n"
50  "\n"
51  " :return: Driver version.\n"
52  " :rtype: str\n");
53 static PyObject *pygpu_platform_version_get(PyObject *UNUSED(self))
54 {
55  return PyUnicode_FromString(GPU_platform_version());
56 }
57 
60 /* -------------------------------------------------------------------- */
64 static struct PyMethodDef pygpu_platform__tp_methods[] = {
65  {"vendor_get",
66  (PyCFunction)pygpu_platform_vendor_get,
67  METH_NOARGS,
68  pygpu_platform_vendor_get_doc},
69  {"renderer_get",
70  (PyCFunction)pygpu_platform_renderer_get,
71  METH_NOARGS,
72  pygpu_platform_renderer_get_doc},
73  {"version_get",
74  (PyCFunction)pygpu_platform_version_get,
75  METH_NOARGS,
76  pygpu_platform_version_get_doc},
77  {NULL, NULL, 0, NULL},
78 };
79 
80 PyDoc_STRVAR(pygpu_platform__tp_doc, "This module provides access to GPU Platform definitions.");
81 static PyModuleDef pygpu_platform_module_def = {
82  PyModuleDef_HEAD_INIT,
83  .m_name = "gpu.platform",
84  .m_doc = pygpu_platform__tp_doc,
85  .m_methods = pygpu_platform__tp_methods,
86 };
87 
88 PyObject *bpygpu_platform_init(void)
89 {
90  PyObject *submodule;
91 
92  submodule = PyModule_Create(&pygpu_platform_module_def);
93 
94  return submodule;
95 }
96 
#define UNUSED(x)
const char * GPU_platform_vendor(void)
const char * GPU_platform_version(void)
const char * GPU_platform_renderer(void)
static PyObject * pygpu_platform_vendor_get(PyObject *UNUSED(self))
static PyModuleDef pygpu_platform_module_def
static PyObject * pygpu_platform_version_get(PyObject *UNUSED(self))
static PyObject * pygpu_platform_renderer_get(PyObject *UNUSED(self))
PyObject * bpygpu_platform_init(void)
static struct PyMethodDef pygpu_platform__tp_methods[]
PyDoc_STRVAR(pygpu_platform_vendor_get_doc, ".. function:: vendor_get()\n" "\n" " Get GPU vendor.\n" "\n" " :return: Vendor name.\n" " :rtype: str\n")