[Bf-blender-cvs] [d60e28093f8] master: Docs: add API docs for gpu.platform

nutti noreply at git.blender.org
Tue Aug 17 06:46:06 CEST 2021


Commit: d60e28093f8b3145d099ca696e0ddc2d0c9850ed
Author: nutti
Date:   Tue Aug 17 14:44:28 2021 +1000
Branches: master
https://developer.blender.org/rBd60e28093f8b3145d099ca696e0ddc2d0c9850ed

Docs: add API docs for gpu.platform

Adds Python API documentations for gpu.platform module.

Ref D12222

===================================================================

M	doc/python_api/sphinx_doc_gen.py
M	source/blender/python/gpu/gpu_py_platform.c

===================================================================

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 43d0319b73f..3b13f119229 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -254,6 +254,7 @@ else:
         "gpu.shader",
         "gpu.state",
         "gpu.texture",
+        "gpu.platform",
         "gpu_extras",
         "idprop.types",
         "mathutils",
@@ -2000,6 +2001,7 @@ def write_rst_importable_modules(basepath):
         "gpu.shader": "GPU Shader Utilities",
         "gpu.state": "GPU State Utilities",
         "gpu.texture": "GPU Texture Utilities",
+        "gpu.platform": "GPU Platform Utilities",
         "bmesh": "BMesh Module",
         "bmesh.ops": "BMesh Operators",
         "bmesh.types": "BMesh Types",
diff --git a/source/blender/python/gpu/gpu_py_platform.c b/source/blender/python/gpu/gpu_py_platform.c
index 132052b6f1d..7d10f0e9b43 100644
--- a/source/blender/python/gpu/gpu_py_platform.c
+++ b/source/blender/python/gpu/gpu_py_platform.c
@@ -33,16 +33,37 @@
 /** \name Functions
  * \{ */
 
+PyDoc_STRVAR(pygpu_platform_vendor_get_doc,
+             ".. function:: vendor_get()\n"
+             "\n"
+             "   Get GPU vendor.\n"
+             "\n"
+             "   :return: Vendor name.\n"
+             "   :rtype: str\n");
 static PyObject *pygpu_platform_vendor_get(PyObject *UNUSED(self))
 {
   return PyUnicode_FromString(GPU_platform_vendor());
 }
 
+PyDoc_STRVAR(pygpu_platform_renderer_get_doc,
+             ".. function:: renderer_get()\n"
+             "\n"
+             "   Get GPU to be used for rendering.\n"
+             "\n"
+             "   :return: GPU name.\n"
+             "   :rtype: str\n");
 static PyObject *pygpu_platform_renderer_get(PyObject *UNUSED(self))
 {
   return PyUnicode_FromString(GPU_platform_renderer());
 }
 
+PyDoc_STRVAR(pygpu_platform_version_get_doc,
+             ".. function:: version_get()\n"
+             "\n"
+             "   Get GPU driver version.\n"
+             "\n"
+             "   :return: Driver version.\n"
+             "   :rtype: str\n");
 static PyObject *pygpu_platform_version_get(PyObject *UNUSED(self))
 {
   return PyUnicode_FromString(GPU_platform_version());
@@ -55,9 +76,12 @@ static PyObject *pygpu_platform_version_get(PyObject *UNUSED(self))
  * \{ */
 
 static struct PyMethodDef pygpu_platform__tp_methods[] = {
-    {"vendor_get", (PyCFunction)pygpu_platform_vendor_get, METH_NOARGS, NULL},
-    {"renderer_get", (PyCFunction)pygpu_platform_renderer_get, METH_NOARGS, NULL},
-    {"version_get", (PyCFunction)pygpu_platform_version_get, METH_NOARGS, NULL},
+    {"vendor_get", (PyCFunction)pygpu_platform_vendor_get, METH_NOARGS,
+     pygpu_platform_vendor_get_doc},
+    {"renderer_get", (PyCFunction)pygpu_platform_renderer_get, METH_NOARGS,
+     pygpu_platform_renderer_get_doc},
+    {"version_get", (PyCFunction)pygpu_platform_version_get, METH_NOARGS,
+     pygpu_platform_version_get_doc},
     {NULL, NULL, 0, NULL},
 };



More information about the Bf-blender-cvs mailing list