diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2022-08-01 17:29:52 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2022-08-01 17:29:52 +0300 |
commit | be0449cfcae25ff64540e3859232481826f675fb (patch) | |
tree | 80f663b543f27c97e39f6265ea119abc512b6c6a /source/blender/python | |
parent | 49bccd7740622d287f82e4c9b73bfc81d9a22584 (diff) | |
parent | 3393b7137e247383477eb38d938239fbb9221680 (diff) |
Merge branch 'master' into sculpt_curve_collisionssculpt_curve_collisions
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/gpu/gpu_py_platform.c | 32 | ||||
-rw-r--r-- | source/blender/python/gpu/gpu_py_shader.c | 8 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 1 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_anim.c | 1 |
4 files changed, 38 insertions, 4 deletions
diff --git a/source/blender/python/gpu/gpu_py_platform.c b/source/blender/python/gpu/gpu_py_platform.c index 656024ae22c..b877e3ceb98 100644 --- a/source/blender/python/gpu/gpu_py_platform.c +++ b/source/blender/python/gpu/gpu_py_platform.c @@ -55,6 +55,34 @@ static PyObject *pygpu_platform_version_get(PyObject *UNUSED(self)) return PyUnicode_FromString(GPU_platform_version()); } +PyDoc_STRVAR( + pygpu_platform_device_type_get_doc, + ".. function:: device_type_get()\n" + "\n" + " Get GPU device type.\n" + "\n" + " :return: Device type ('APPLE', 'NVIDIA', 'AMD', 'INTEL', 'SOFTWARE', 'UNKNOWN').\n" + " :rtype: str\n"); +static PyObject *pygpu_platform_device_type_get(PyObject *UNUSED(self)) +{ + if (GPU_type_matches(GPU_DEVICE_APPLE, GPU_OS_ANY, GPU_DRIVER_ANY)) { + return PyUnicode_FromString("APPLE"); + } + if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY)) { + return PyUnicode_FromString("NVIDIA"); + } + if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) { + return PyUnicode_FromString("AMD"); + } + if (GPU_type_matches(GPU_DEVICE_INTEL | GPU_DEVICE_INTEL_UHD, GPU_OS_ANY, GPU_DRIVER_ANY)) { + return PyUnicode_FromString("INTEL"); + } + if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_ANY, GPU_DRIVER_ANY)) { + return PyUnicode_FromString("SOFTWARE"); + } + return PyUnicode_FromString("UNKNOWN"); +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -74,6 +102,10 @@ static struct PyMethodDef pygpu_platform__tp_methods[] = { (PyCFunction)pygpu_platform_version_get, METH_NOARGS, pygpu_platform_version_get_doc}, + {"device_type_get", + (PyCFunction)pygpu_platform_device_type_get, + METH_NOARGS, + pygpu_platform_device_type_get_doc}, {NULL, NULL, 0, NULL}, }; diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c index 101b9f8e4c6..e3f789aa58d 100644 --- a/source/blender/python/gpu/gpu_py_shader.c +++ b/source/blender/python/gpu/gpu_py_shader.c @@ -31,16 +31,16 @@ #define PYDOC_BUILTIN_SHADER_DESCRIPTION \ "``2D_FLAT_COLOR``\n" \ - " :Attributes: vec3 pos, vec4 color\n" \ + " :Attributes: vec2 pos, vec4 color\n" \ " :Uniforms: none\n" \ "``2D_IMAGE``\n" \ - " :Attributes: vec3 pos, vec2 texCoord\n" \ + " :Attributes: vec2 pos, vec2 texCoord\n" \ " :Uniforms: sampler2D image\n" \ "``2D_SMOOTH_COLOR``\n" \ - " :Attributes: vec3 pos, vec4 color\n" \ + " :Attributes: vec2 pos, vec4 color\n" \ " :Uniforms: none\n" \ "``2D_UNIFORM_COLOR``\n" \ - " :Attributes: vec3 pos\n" \ + " :Attributes: vec2 pos\n" \ " :Uniforms: vec4 color\n" \ "``3D_FLAT_COLOR``\n" \ " :Attributes: vec3 pos, vec4 color\n" \ diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 14be9ceda94..d9c004fb6fa 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -15,6 +15,7 @@ #include <float.h> /* FLT_MIN/MAX */ #include <stddef.h> +#include "RNA_path.h" #include "RNA_types.h" #include "BLI_bitmap.h" diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index f25e9d0bbbc..d4a164d9482 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -32,6 +32,7 @@ #include "RNA_access.h" #include "RNA_enum_types.h" +#include "RNA_path.h" #include "RNA_prototypes.h" #include "WM_api.h" |