32 return PyLong_FromLong(self->
index);
36 "Device identifier.\n"
50 return PyUnicode_FromString(self->
name);
58 pygpu_device_index_doc,
63 pygpu_device_identifier_doc,
68 pygpu_device_name_doc,
70 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr},
76 return PyUnicode_FromFormat(
"<GPUDevice index=%d identifier=\"%s\" name=\"%s\">",
86 Py_RETURN_NOTIMPLEMENTED;
91 return PyBool_FromLong(self->
index < other_device->
index);
93 return PyBool_FromLong(self->
index <= other_device->
index);
95 return PyBool_FromLong(self->
index == other_device->
index);
97 return PyBool_FromLong(self->
index != other_device->
index);
99 return PyBool_FromLong(self->
index > other_device->
index);
101 return PyBool_FromLong(self->
index >= other_device->
index);
103 Py_RETURN_NOTIMPLEMENTED;
108 ".. class:: GPUDevice\n"
110 " Represents a GPU device.\n"
112 " :ivar index: Device index.\n"
113 " :type index: int\n"
114 " :ivar identifier: Device identifier.\n"
115 " :type identifier: str\n"
116 " :ivar name: Device name.\n"
117 " :type name: str\n");
120 PyVarObject_HEAD_INIT(
nullptr, 0)
121 "gpu.platform.GPUDevice",
140 pygpu_device__tp_doc,
175 if (self !=
nullptr) {
191 pygpu_platform_vendor_get_doc,
192 ".. function:: vendor_get()\n"
196 " :return: Vendor name.\n"
207 pygpu_platform_renderer_get_doc,
208 ".. function:: renderer_get()\n"
210 " Get GPU to be used for rendering.\n"
212 " :return: GPU name.\n"
223 pygpu_platform_version_get_doc,
224 ".. function:: version_get()\n"
226 " Get GPU driver version.\n"
228 " :return: Driver version.\n"
239 pygpu_platform_device_type_get_doc,
240 ".. function:: device_type_get()\n"
242 " Get GPU device type.\n"
244 " :return: Device type ('APPLE', 'NVIDIA', 'AMD', 'INTEL', 'SOFTWARE', 'QUALCOMM', "
274 return PyUnicode_FromString(device);
279 pygpu_platform_backend_type_get_doc,
280 ".. function:: backend_type_get()\n"
282 " Get active GPU backend.\n"
284 " :return: Backend type ('OPENGL', 'VULKAN', 'METAL', 'NONE', 'UNKNOWN').\n"
290 const char *backend =
"UNKNOWN";
311 return PyUnicode_FromString(backend);
316 pygpu_platform_devices_get_doc,
317 ".. function:: devices_get()\n"
319 " Get all available GPU devices.\n"
321 " :return: List of :class:`GPUDevice` objects for each device.\n"
328 PyObject *
list = PyList_New(devices.
size());
329 for (
int i = 0; i < devices.
size(); i++) {
331 PyObject *item =
reinterpret_cast<PyObject *
>(
333 PyList_SET_ITEM(
list, i, item);
348# pragma clang diagnostic push
349# pragma clang diagnostic ignored "-Wcast-function-type"
351# pragma GCC diagnostic push
352# pragma GCC diagnostic ignored "-Wcast-function-type"
360 pygpu_platform_vendor_get_doc},
364 pygpu_platform_renderer_get_doc},
368 pygpu_platform_version_get_doc},
372 pygpu_platform_device_type_get_doc},
376 pygpu_platform_backend_type_get_doc},
380 pygpu_platform_devices_get_doc},
381 {
nullptr,
nullptr, 0,
nullptr},
386# pragma clang diagnostic pop
388# pragma GCC diagnostic pop
394 pygpu_platform__tp_doc,
395 "This module provides access to GPU Platform definitions.");
399 pygpu_platform__tp_doc,
constexpr int64_t size() const
#define BPYGPU_IS_INIT_OR_ERROR_OBJ
static PyObject * pygpu_device_index_get(BPyGPUDevice *self, void *)
const char * GPU_platform_version()
static PyObject * pygpu_device__tp_repr(BPyGPUDevice *self)
static PyMethodDef pygpu_platform__tp_methods[]
Span< GPUDevice > GPU_platform_devices_list()
GPUBackendType GPU_backend_get_type()
PyDoc_STRVAR(bpy_bm_new_doc, ".. function:: new(*, use_operators=True)\n" "\n" " :param use_operators: Support calling operators in :mod:`bmesh.ops` (uses some " "extra memory per vert/edge/face).\n" " :type use_operators: bool\n" " :return: Return a new, empty BMesh.\n" " :rtype: :class:`bmesh.types.BMesh`\n")
static PyGetSetDef pygpu_device_getseters[]
static PyModuleDef pygpu_platform_module_def
static PyObject * pygpu_platform_devices_get(PyObject *)
bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
static PyObject * pygpu_platform_renderer_get(PyObject *)
const char * GPU_platform_renderer()
PyTypeObject BPyGPU_DeviceType
static PyObject * pygpu_platform_device_type_get(PyObject *)
const char * GPU_platform_vendor()
static PyObject * pygpu_device__tp_richcmp(BPyGPUDevice *self, PyObject *other, int op)
static PyObject * pygpu_platform_vendor_get(PyObject *)
static PyObject * pygpu_platform_backend_type_get(PyObject *)
static BPyGPUDevice * pygpu_device_new(int index, const char *identifier, const char *name)
PyObject * bpygpu_platform_init()
static PyObject * pygpu_device_name_get(BPyGPUDevice *self, void *)
static PyObject * pygpu_device_identifier_get(BPyGPUDevice *self, void *)
static PyObject * pygpu_platform_version_get(PyObject *)