Blender
V3.3
|
#include <Python.h>
#include "BLI_utildefines.h"
#include "GPU_shader.h"
#include "intern/gpu_shader_create_info.hh"
#include "../generic/py_capi_utils.h"
#include "gpu_py_shader.h"
Go to the source code of this file.
Macros | |
#define | PYDOC_TYPE_LIST |
#define | PYDOC_IMAGE_TYPES |
#define | VULKAN_LIMIT 128 |
Functions | |
GPUStageInterfaceInfo Type | |
static PyObject * | pygpu_interface_info__tp_new (PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) |
static void | pygpu_interface_info__tp_dealloc (PyObject *self) |
PyDoc_STRVAR (pygpu_interface_info__tp_doc, ".. class:: GPUStageInterfaceInfo(name)\n" "\n" " List of varyings between shader stages.\n\n" "\n" " :param name: Name of the interface block.\n" " :type value: str\n") | |
constexpr PyTypeObject | pygpu_interface_info_type () |
GPUShaderCreateInfo Init | |
static PyObject * | pygpu_shader_info__tp_new (PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) |
static void | pygpu_shader_info__tp_dealloc (PyObject *self) |
PyDoc_STRVAR (pygpu_shader_info__tp_doc, ".. class:: GPUShaderCreateInfo()\n" "\n" " Stores and describes types and variables that are used in shader sources.\n") | |
constexpr PyTypeObject | pygpu_shader_info_type () |
Variables | |
static const struct PyC_StringEnumItems | pygpu_attrtype_items [] |
static const struct PyC_StringEnumItems | pygpu_imagetype_items [] |
static const struct PyC_StringEnumItems | pygpu_dualblend_items [] |
GPUStageInterfaceInfo Methods | |
static struct PyMethodDef | pygpu_interface_info__tp_methods [] |
static bool | pygpu_interface_info_get_args (BPyGPUStageInterfaceInfo *self, PyObject *args, const char *format, Type *r_type, const char **r_name) |
PyDoc_STRVAR (pygpu_interface_info_smooth_doc, ".. method:: smooth(type, name)\n" "\n" " Add an attribute with qualifier of type `smooth` to the interface block.\n" "\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: name of the attribute.\n" " :type name: str\n") | |
static PyObject * | pygpu_interface_info_smooth (BPyGPUStageInterfaceInfo *self, PyObject *args) |
PyDoc_STRVAR (pygpu_interface_info_flat_doc, ".. method:: flat(type, name)\n" "\n" " Add an attribute with qualifier of type `flat` to the interface block.\n" "\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: name of the attribute.\n" " :type name: str\n") | |
static PyObject * | pygpu_interface_info_flat (BPyGPUStageInterfaceInfo *self, PyObject *args) |
PyDoc_STRVAR (pygpu_interface_info_no_perspective_doc, ".. method:: no_perspective(type, name)\n" "\n" " Add an attribute with qualifier of type `no_perspective` to the interface block.\n" "\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: name of the attribute.\n" " :type name: str\n") | |
static PyObject * | pygpu_interface_info_no_perspective (BPyGPUStageInterfaceInfo *self, PyObject *args) |
GPUStageInterfaceInfo Getters and Setters | |
static PyGetSetDef | pygpu_interface_info__tp_getseters [] |
PyDoc_STRVAR (pygpu_interface_info_name_doc, "Name of the interface block.\n" "\n" ":type: str") | |
static PyObject * | pygpu_interface_info_name_get (BPyGPUStageInterfaceInfo *self, void *UNUSED(closure)) |
GPUShaderCreateInfo Methods | |
static struct PyMethodDef | pygpu_shader_info__tp_methods [] |
PyDoc_STRVAR (pygpu_shader_info_vertex_in_doc, ".. method:: vertex_in(slot, type, name)\n" "\n" " Add a vertex shader input attribute.\n" "\n" " :param slot: The attribute index.\n" " :type slot: int\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: name of the attribute.\n" " :type name: str\n") | |
static PyObject * | pygpu_shader_info_vertex_in (BPyGPUShaderCreateInfo *self, PyObject *args) |
PyDoc_STRVAR (pygpu_shader_info_vertex_out_doc, ".. method:: vertex_out(interface)\n" "\n" " Add a vertex shader output interface block.\n" "\n" " :param interface: Object describing the block.\n" " :type interface: :class:`gpu.types.GPUStageInterfaceInfo`\n") | |
static PyObject * | pygpu_shader_info_vertex_out (BPyGPUShaderCreateInfo *self, BPyGPUStageInterfaceInfo *o) |
PyDoc_STRVAR (pygpu_shader_info_fragment_out_doc, ".. method:: fragment_out(slot, type, name, blend='NONE')\n" "\n" " Specify a fragment output corresponding to a framebuffer target slot.\n" "\n" " :param slot: The attribute index.\n" " :type slot: int\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: Name of the attribute.\n" " :type name: str\n" " :param blend: Dual Source Blending Index. It can be 'NONE', 'SRC_0' or 'SRC_1'.\n" " :type blend: str\n") | |
static PyObject * | pygpu_shader_info_fragment_out (BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds) |
PyDoc_STRVAR (pygpu_shader_info_uniform_buf_doc, ".. method:: uniform_buf(slot, type_name, name)\n" "\n" " Specify a uniform variable whose type can be one of those declared in `typedef_source`.\n" "\n" " :param slot: The uniform variable index.\n" " :type slot: int\n" " :param type_name: Name of the data type. It can be a struct type defined in the source " "passed through the :meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n" " :type type_name: str\n" " :param name: The uniform variable name.\n" " :type name: str\n") | |
static PyObject * | pygpu_shader_info_uniform_buf (BPyGPUShaderCreateInfo *self, PyObject *args) |
PyDoc_STRVAR (pygpu_shader_info_sampler_doc, ".. method:: sampler(slot, type, name)\n" "\n" " Specify an image texture sampler.\n" "\n" " :param slot: The image texture sampler index.\n" " :type slot: int\n" " :param type: The data type describing the format of each sampler unit. Possible values " "are:\n" "\n" PYDOC_IMAGE_TYPES "\n" " :type type: str\n" " :param name: The image texture sampler name.\n" " :type name: str\n") | |
static PyObject * | pygpu_shader_info_sampler (BPyGPUShaderCreateInfo *self, PyObject *args) |
static int | constant_type_size (Type type) |
static int | constants_calc_size (ShaderCreateInfo *info) |
PyDoc_STRVAR (pygpu_shader_info_push_constant_doc, ".. method:: push_constant(type, name, size=0)\n" "\n" " Specify a global access constant.\n" "\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: Name of the constant.\n" " :type name: str\n" " :param size: If not zero, indicates that the constant is an array with the " "specified size.\n" " :type size: uint\n") | |
static PyObject * | pygpu_shader_info_push_constant (BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds) |
PyDoc_STRVAR (pygpu_shader_info_vertex_source_doc, ".. method:: vertex_source(source)\n" "\n" " Vertex shader source code written in GLSL.\n" "\n" " Example:\n" "\n" " .. code-block:: python\n" "\n" " \"void main {gl_Position = vec4(pos, 1.0);}\"\n" "\n" " :param source: The vertex shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://wiki.blender.org/wiki/EEVEE_%26_Viewport/GPU_Module/GLSL_Cross_Compilation>`__\n") | |
static PyObject * | pygpu_shader_info_vertex_source (BPyGPUShaderCreateInfo *self, PyObject *o) |
PyDoc_STRVAR (pygpu_shader_info_fragment_source_doc, ".. method:: fragment_source(source)\n" "\n" " Fragment shader source code written in GLSL.\n" "\n" " Example:\n" "\n" " .. code-block:: python\n" "\n" " \"void main {fragColor = vec4(0.0, 0.0, 0.0, 1.0);}\"\n" "\n" " :param source: The fragment shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://wiki.blender.org/wiki/EEVEE_%26_Viewport/GPU_Module/GLSL_Cross_Compilation>`__\n") | |
static PyObject * | pygpu_shader_info_fragment_source (BPyGPUShaderCreateInfo *self, PyObject *o) |
PyDoc_STRVAR (pygpu_shader_info_typedef_source_doc, ".. method:: typedef_source(source)\n" "\n" " Source code included before resource declaration. " "Useful for defining structs used by Uniform Buffers.\n" "\n" " Example:\n" "\n" ".. code-block:: python\n" "\n" " \"struct MyType {int foo; float bar;};\"\n" "\n" " :param source: The source code defining types.\n" " :type source: str\n") | |
static PyObject * | pygpu_shader_info_typedef_source (BPyGPUShaderCreateInfo *self, PyObject *o) |
PyDoc_STRVAR (pygpu_shader_info_define_doc, ".. method:: define(name, value)\n" "\n" " Add a preprocessing define directive. In GLSL it would be something like:\n" "\n" ".. code-block:: glsl\n" "\n" " #define name value\n" "\n" " :param name: Token name.\n" " :type name: str\n" " :param value: Text that replaces token occurrences.\n" " :type value: str\n") | |
static PyObject * | pygpu_shader_info_define (BPyGPUShaderCreateInfo *self, PyObject *args) |
Public API | |
PyTypeObject | BPyGPUStageInterfaceInfo_Type = pygpu_interface_info_type() |
PyTypeObject | BPyGPUShaderCreateInfo_Type = pygpu_shader_info_type() |
PyObject * | BPyGPUStageInterfaceInfo_CreatePyObject (GPUStageInterfaceInfo *interface) |
PyObject * | BPyGPUShaderCreateInfo_CreatePyObject (GPUShaderCreateInfo *info) |
bpygpu_
for local API.BPyGPU
for public API. Definition in file gpu_py_shader_create_info.cc.
#define PYDOC_IMAGE_TYPES |
Definition at line 80 of file gpu_py_shader_create_info.cc.
#define PYDOC_TYPE_LIST |
Definition at line 45 of file gpu_py_shader_create_info.cc.
#define VULKAN_LIMIT 128 |
PyObject* BPyGPUShaderCreateInfo_CreatePyObject | ( | GPUShaderCreateInfo * | info | ) |
Definition at line 1109 of file gpu_py_shader_create_info.cc.
References BPyGPUShaderCreateInfo_Type, and BPyGPUShaderCreateInfo::vertex_source.
Referenced by pygpu_shader_info__tp_new().
PyObject* BPyGPUStageInterfaceInfo_CreatePyObject | ( | GPUStageInterfaceInfo * | interface | ) |
Definition at line 1093 of file gpu_py_shader_create_info.cc.
References BPyGPUStageInterfaceInfo_Type, and BPyGPUStageInterfaceInfo::references.
Referenced by pygpu_interface_info__tp_new().
|
static |
Definition at line 669 of file gpu_py_shader_create_info.cc.
References BLI_assert, FLOAT, type, and UINT().
Referenced by constants_calc_size().
|
static |
Definition at line 703 of file gpu_py_shader_create_info.cc.
References constant_type_size(), max, pad, blender::gpu::shader::ShaderCreateInfo::push_constants_, and size().
Referenced by pygpu_shader_info_push_constant().
PyDoc_STRVAR | ( | pygpu_interface_info__tp_doc | , |
".. class:: GPUStageInterfaceInfo(name)\n" "\n" " List of varyings between shader stages.\n\n" "\n" " :param name: Name of the interface block.\n" " :type value: str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_interface_info_flat_doc | , |
".. method:: flat(type, name)\n" "\n" " Add an attribute with qualifier of type `flat` to the interface block.\n" "\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: name of the attribute.\n" " :type name: str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_interface_info_name_doc | , |
"Name of the interface block.\n" "\n" ":type: str" | |||
) |
PyDoc_STRVAR | ( | pygpu_interface_info_no_perspective_doc | , |
".. method:: no_perspective(type, name)\n" "\n" " Add an attribute with qualifier of type `no_perspective` to the interface block.\n" "\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: name of the attribute.\n" " :type name: str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_interface_info_smooth_doc | , |
".. method:: smooth(type, name)\n" "\n" " Add an attribute with qualifier of type `smooth` to the interface block.\n" "\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: name of the attribute.\n" " :type name: str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info__tp_doc | , |
".. class:: GPUShaderCreateInfo()\n" "\n" " Stores and describes types and variables that are used in shader sources.\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_define_doc | , |
".. method:: define(name, value)\n" "\n" " Add a preprocessing define directive. In GLSL it would be something like:\n" "\n" ".. code-block:: glsl\n" "\n" " #define name value\n" "\n" " :param name: Token name.\n" " :type name: str\n" " :param value: Text that replaces token occurrences.\n" " :type value: str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_fragment_out_doc | , |
".. method:: fragment_out(slot, type, name, blend='NONE')\n" "\n" " Specify a fragment output corresponding to a framebuffer target slot.\n" "\n" " :param slot: The attribute index.\n" " :type slot: int\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: Name of the attribute.\n" " :type name: str\n" " :param blend: Dual Source Blending Index. It can be 'NONE' | , | ||
'SRC_0' or 'SRC_1'.\n" " :type blend:str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_fragment_source_doc | , |
".. method:: fragment_source(source)\n" "\n" " Fragment shader source code written in GLSL.\n" "\n" " Example:\n" "\n" " .. code-block:: python\n" "\n" " \"void main {fragColor = vec4(0.0, 0.0, 0.0, 1.0);}\"\n" "\n" " :param source: The fragment shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://wiki.blender.org/wiki/EEVEE_%26_Viewport/GPU_Module/GLSL_Cross_Compilation>`__\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_push_constant_doc | , |
".. method:: push_constant(type, name, size=0)\n" "\n" " Specify a global access constant.\n" "\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: Name of the constant.\n" " :type name: str\n" " :param size: If not | zero, | ||
indicates that the constant is an array with the " "specified size.\n" " :type size:uint\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_sampler_doc | , |
".. method:: sampler(slot, type, name)\n" "\n" " Specify an image texture sampler.\n" "\n" " :param slot: The image texture sampler index.\n" " :type slot: int\n" " :param type: The data type describing the format of each sampler unit. Possible values " "are:\n" "\n" PYDOC_IMAGE_TYPES "\n" " :type type: str\n" " :param name: The image texture sampler name.\n" " :type name: str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_typedef_source_doc | , |
".. method:: typedef_source(source)\n" "\n" " Source code included before resource declaration. " "Useful for defining structs used by Uniform Buffers.\n" "\n" " Example:\n" "\n" ".. code-block:: python\n" "\n" " \"struct MyType {int foo; float bar;};\"\n" "\n" " :param source: The source code defining types.\n" " :type source: str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_uniform_buf_doc | , |
".. method:: uniform_buf(slot, type_name, name)\n" "\n" " Specify a uniform variable whose type can be one of those declared in `typedef_source`.\n" "\n" " :param slot: The uniform variable index.\n" " :type slot: int\n" " :param type_name: Name of the data type. It can be a struct type defined in the source " "passed through the :meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n" " :type type_name: str\n" " :param name: The uniform variable name.\n" " :type name: str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_vertex_in_doc | , |
".. method:: vertex_in(slot, type, name)\n" "\n" " Add a vertex shader input attribute.\n" "\n" " :param slot: The attribute index.\n" " :type slot: int\n" " :param type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :param name: name of the attribute.\n" " :type name: str\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_vertex_out_doc | , |
".. method:: vertex_out(interface)\n" "\n" " Add a vertex shader output interface block.\n" "\n" " :param interface: Object describing the block.\n" " :type interface: :class:`gpu.types.GPUStageInterfaceInfo`\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_shader_info_vertex_source_doc | , |
".. method:: vertex_source(source)\n" "\n" " Vertex shader source code written in GLSL.\n" "\n" " Example:\n" "\n" " .. code-block:: python\n" "\n" " \"void main {gl_Position = vec4(pos, 1.0);}\"\n" "\n" " :param source: The vertex shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://wiki.blender.org/wiki/EEVEE_%26_Viewport/GPU_Module/GLSL_Cross_Compilation>`__\n" | |||
) |
|
static |
Definition at line 351 of file gpu_py_shader_create_info.cc.
References BPyGPUStageInterfaceInfo::interface, and BPyGPUStageInterfaceInfo::references.
Referenced by pygpu_interface_info_type().
|
static |
Definition at line 306 of file gpu_py_shader_create_info.cc.
References BPyGPUStageInterfaceInfo_CreatePyObject(), and new().
Referenced by pygpu_interface_info_type().
|
static |
Definition at line 222 of file gpu_py_shader_create_info.cc.
References blender::gpu::shader::StageInterfaceInfo::flat(), pygpu_interface_info_get_args(), and type.
|
static |
Definition at line 160 of file gpu_py_shader_create_info.cc.
References PyC_ParseStringEnum(), pygpu_attrtype_items, self, and PyC_StringEnum::value_found.
Referenced by pygpu_interface_info_flat(), and pygpu_interface_info_smooth().
|
static |
Definition at line 284 of file gpu_py_shader_create_info.cc.
|
static |
Definition at line 247 of file gpu_py_shader_create_info.cc.
|
static |
Definition at line 198 of file gpu_py_shader_create_info.cc.
References pygpu_interface_info_get_args(), blender::gpu::shader::StageInterfaceInfo::smooth(), and type.
|
constexpr |
Definition at line 375 of file gpu_py_shader_create_info.cc.
References pygpu_interface_info__tp_dealloc(), pygpu_interface_info__tp_getseters, pygpu_interface_info__tp_methods, and pygpu_interface_info__tp_new().
|
static |
Definition at line 1042 of file gpu_py_shader_create_info.cc.
References BPyGPUShaderCreateInfo::fragment_source, BPyGPUShaderCreateInfo::info, BPyGPUShaderCreateInfo::references, and BPyGPUShaderCreateInfo::vertex_source.
Referenced by pygpu_shader_info_type().
|
static |
Definition at line 1005 of file gpu_py_shader_create_info.cc.
References BPyGPUShaderCreateInfo_CreatePyObject().
Referenced by pygpu_shader_info_type().
|
static |
Definition at line 925 of file gpu_py_shader_create_info.cc.
|
static |
Definition at line 475 of file gpu_py_shader_create_info.cc.
References blender::gpu::shader::ShaderCreateInfo::fragment_out(), PyC_ParseStringEnum(), pygpu_attrtype_items, pygpu_dualblend_items, self, and PyC_StringEnum::value_found.
|
static |
Definition at line 846 of file gpu_py_shader_create_info.cc.
References fragment_source(), blender::gpu::shader::ShaderCreateInfo::fragment_source(), blender::gpu::shader::ShaderCreateInfo::fragment_source_generated, and self.
|
static |
Definition at line 745 of file gpu_py_shader_create_info.cc.
References constants_calc_size(), blender::gpu::shader::ShaderCreateInfo::push_constant(), PyC_ParseStringEnum(), pygpu_attrtype_items, self, size(), STRINGIFY, PyC_StringEnum::value_found, and VULKAN_LIMIT.
|
static |
Definition at line 648 of file gpu_py_shader_create_info.cc.
References PyC_ParseStringEnum(), pygpu_imagetype_items, blender::gpu::shader::ShaderCreateInfo::sampler(), self, and PyC_StringEnum::value_found.
|
constexpr |
Definition at line 1065 of file gpu_py_shader_create_info.cc.
References pygpu_shader_info__tp_dealloc(), pygpu_shader_info__tp_methods, and pygpu_shader_info__tp_new().
|
static |
|
static |
Definition at line 531 of file gpu_py_shader_create_info.cc.
References self, and blender::gpu::shader::ShaderCreateInfo::uniform_buf().
|
static |
Definition at line 414 of file gpu_py_shader_create_info.cc.
References PyC_ParseStringEnum(), pygpu_attrtype_items, self, PyC_StringEnum::value_found, and blender::gpu::shader::ShaderCreateInfo::vertex_in().
|
static |
Definition at line 441 of file gpu_py_shader_create_info.cc.
References BPyGPUStageInterfaceInfo_Check, BPyGPUStageInterfaceInfo::interface, self, and blender::gpu::shader::ShaderCreateInfo::vertex_out().
|
static |
Definition at line 805 of file gpu_py_shader_create_info.cc.
References self, vertex_source(), blender::gpu::shader::ShaderCreateInfo::vertex_source(), and blender::gpu::shader::ShaderCreateInfo::vertex_source_generated.
PyTypeObject BPyGPUShaderCreateInfo_Type = pygpu_shader_info_type() |
Definition at line 1091 of file gpu_py_shader_create_info.cc.
Referenced by bpygpu_types_init(), and BPyGPUShaderCreateInfo_CreatePyObject().
PyTypeObject BPyGPUStageInterfaceInfo_Type = pygpu_interface_info_type() |
Definition at line 1090 of file gpu_py_shader_create_info.cc.
Referenced by bpygpu_types_init(), and BPyGPUStageInterfaceInfo_CreatePyObject().
|
static |
Definition at line 1 of file gpu_py_shader_create_info.cc.
Referenced by pygpu_interface_info_get_args(), pygpu_shader_info_fragment_out(), pygpu_shader_info_push_constant(), and pygpu_shader_info_vertex_in().
|
static |
Definition at line 1 of file gpu_py_shader_create_info.cc.
Referenced by pygpu_shader_info_fragment_out().
|
static |
Definition at line 1 of file gpu_py_shader_create_info.cc.
Referenced by pygpu_shader_info_sampler().
|
static |
Definition at line 291 of file gpu_py_shader_create_info.cc.
Referenced by pygpu_interface_info_type().
|
static |
Definition at line 247 of file gpu_py_shader_create_info.cc.
Referenced by pygpu_interface_info_type().
|
static |
Definition at line 925 of file gpu_py_shader_create_info.cc.
Referenced by pygpu_shader_info_type().