Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/gpu/gpu_py_shader_create_info.cc
| Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | #endif | ||||
| return true; | return true; | ||||
| } | } | ||||
| PyDoc_STRVAR(pygpu_interface_info_smooth_doc, | PyDoc_STRVAR(pygpu_interface_info_smooth_doc, | ||||
| ".. method:: smooth(type, name)\n" | ".. method:: smooth(type, name)\n" | ||||
| "\n" | "\n" | ||||
| " Add an attribute with qualifier of type `smooth` to the interface block.\n" | " Add an attribute with qualifier of type `smooth` to the interface block.\n" | ||||
| "\n" | "\n" | ||||
| " :param type: One of these types:\n" | " :arg type: One of these types:\n" | ||||
| "\n" PYDOC_TYPE_LIST | "\n" PYDOC_TYPE_LIST | ||||
| "\n" | "\n" | ||||
| " :type type: str\n" | " :type type: str\n" | ||||
| " :param name: name of the attribute.\n" | " :arg name: name of the attribute.\n" | ||||
| " :type name: str\n"); | " :type name: str\n"); | ||||
| static PyObject *pygpu_interface_info_smooth(BPyGPUStageInterfaceInfo *self, PyObject *args) | static PyObject *pygpu_interface_info_smooth(BPyGPUStageInterfaceInfo *self, PyObject *args) | ||||
| { | { | ||||
| Type type; | Type type; | ||||
| const char *name; | const char *name; | ||||
| if (!pygpu_interface_info_get_args(self, args, "O&O:smooth", &type, &name)) { | if (!pygpu_interface_info_get_args(self, args, "O&O:smooth", &type, &name)) { | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| StageInterfaceInfo *interface = reinterpret_cast<StageInterfaceInfo *>(self->interface); | StageInterfaceInfo *interface = reinterpret_cast<StageInterfaceInfo *>(self->interface); | ||||
| interface->smooth(type, name); | interface->smooth(type, name); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| PyDoc_STRVAR(pygpu_interface_info_flat_doc, | PyDoc_STRVAR(pygpu_interface_info_flat_doc, | ||||
| ".. method:: flat(type, name)\n" | ".. method:: flat(type, name)\n" | ||||
| "\n" | "\n" | ||||
| " Add an attribute with qualifier of type `flat` to the interface block.\n" | " Add an attribute with qualifier of type `flat` to the interface block.\n" | ||||
| "\n" | "\n" | ||||
| " :param type: One of these types:\n" | " :arg type: One of these types:\n" | ||||
| "\n" PYDOC_TYPE_LIST | "\n" PYDOC_TYPE_LIST | ||||
| "\n" | "\n" | ||||
| " :type type: str\n" | " :type type: str\n" | ||||
| " :param name: name of the attribute.\n" | " :arg name: name of the attribute.\n" | ||||
| " :type name: str\n"); | " :type name: str\n"); | ||||
| static PyObject *pygpu_interface_info_flat(BPyGPUStageInterfaceInfo *self, PyObject *args) | static PyObject *pygpu_interface_info_flat(BPyGPUStageInterfaceInfo *self, PyObject *args) | ||||
| { | { | ||||
| Type type; | Type type; | ||||
| const char *name; | const char *name; | ||||
| if (!pygpu_interface_info_get_args(self, args, "O&O:flat", &type, &name)) { | if (!pygpu_interface_info_get_args(self, args, "O&O:flat", &type, &name)) { | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| StageInterfaceInfo *interface = reinterpret_cast<StageInterfaceInfo *>(self->interface); | StageInterfaceInfo *interface = reinterpret_cast<StageInterfaceInfo *>(self->interface); | ||||
| interface->flat(type, name); | interface->flat(type, name); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| PyDoc_STRVAR( | PyDoc_STRVAR( | ||||
| pygpu_interface_info_no_perspective_doc, | pygpu_interface_info_no_perspective_doc, | ||||
| ".. method:: no_perspective(type, name)\n" | ".. method:: no_perspective(type, name)\n" | ||||
| "\n" | "\n" | ||||
| " Add an attribute with qualifier of type `no_perspective` to the interface block.\n" | " Add an attribute with qualifier of type `no_perspective` to the interface block.\n" | ||||
| "\n" | "\n" | ||||
| " :param type: One of these types:\n" | " :arg type: One of these types:\n" | ||||
| "\n" PYDOC_TYPE_LIST | "\n" PYDOC_TYPE_LIST | ||||
| "\n" | "\n" | ||||
| " :type type: str\n" | " :type type: str\n" | ||||
| " :param name: name of the attribute.\n" | " :arg name: name of the attribute.\n" | ||||
| " :type name: str\n"); | " :type name: str\n"); | ||||
| static PyObject *pygpu_interface_info_no_perspective(BPyGPUStageInterfaceInfo *self, | static PyObject *pygpu_interface_info_no_perspective(BPyGPUStageInterfaceInfo *self, | ||||
| PyObject *args) | PyObject *args) | ||||
| { | { | ||||
| Type type; | Type type; | ||||
| const char *name; | const char *name; | ||||
| if (!pygpu_interface_info_get_args(self, args, "O&O:no_perspective", &type, &name)) { | if (!pygpu_interface_info_get_args(self, args, "O&O:no_perspective", &type, &name)) { | ||||
| return nullptr; | return nullptr; | ||||
| ▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | #endif | ||||
| Py_TYPE(self)->tp_free((PyObject *)self); | Py_TYPE(self)->tp_free((PyObject *)self); | ||||
| } | } | ||||
| PyDoc_STRVAR(pygpu_interface_info__tp_doc, | PyDoc_STRVAR(pygpu_interface_info__tp_doc, | ||||
| ".. class:: GPUStageInterfaceInfo(name)\n" | ".. class:: GPUStageInterfaceInfo(name)\n" | ||||
| "\n" | "\n" | ||||
| " List of varyings between shader stages.\n\n" | " List of varyings between shader stages.\n\n" | ||||
| "\n" | "\n" | ||||
| " :param name: Name of the interface block.\n" | " :arg name: Name of the interface block.\n" | ||||
| " :type value: str\n"); | " :type value: str\n"); | ||||
| constexpr PyTypeObject pygpu_interface_info_type() | constexpr PyTypeObject pygpu_interface_info_type() | ||||
| { | { | ||||
| PyTypeObject pytype = {PyVarObject_HEAD_INIT(nullptr, 0)}; | PyTypeObject pytype = {PyVarObject_HEAD_INIT(nullptr, 0)}; | ||||
| pytype.tp_name = "GPUStageInterfaceInfo"; | pytype.tp_name = "GPUStageInterfaceInfo"; | ||||
| pytype.tp_basicsize = sizeof(BPyGPUStageInterfaceInfo); | pytype.tp_basicsize = sizeof(BPyGPUStageInterfaceInfo); | ||||
| pytype.tp_dealloc = pygpu_interface_info__tp_dealloc; | pytype.tp_dealloc = pygpu_interface_info__tp_dealloc; | ||||
| pytype.tp_doc = pygpu_interface_info__tp_doc; | pytype.tp_doc = pygpu_interface_info__tp_doc; | ||||
| Show All 16 Lines | |||||
| /** \name GPUShaderCreateInfo Methods | /** \name GPUShaderCreateInfo Methods | ||||
| * \{ */ | * \{ */ | ||||
| PyDoc_STRVAR(pygpu_shader_info_vertex_in_doc, | PyDoc_STRVAR(pygpu_shader_info_vertex_in_doc, | ||||
| ".. method:: vertex_in(slot, type, name)\n" | ".. method:: vertex_in(slot, type, name)\n" | ||||
| "\n" | "\n" | ||||
| " Add a vertex shader input attribute.\n" | " Add a vertex shader input attribute.\n" | ||||
| "\n" | "\n" | ||||
| " :param slot: The attribute index.\n" | " :arg slot: The attribute index.\n" | ||||
| " :type slot: int\n" | " :type slot: int\n" | ||||
| " :param type: One of these types:\n" | " :arg type: One of these types:\n" | ||||
| "\n" PYDOC_TYPE_LIST | "\n" PYDOC_TYPE_LIST | ||||
| "\n" | "\n" | ||||
| " :type type: str\n" | " :type type: str\n" | ||||
| " :param name: name of the attribute.\n" | " :arg name: name of the attribute.\n" | ||||
| " :type name: str\n"); | " :type name: str\n"); | ||||
| static PyObject *pygpu_shader_info_vertex_in(BPyGPUShaderCreateInfo *self, PyObject *args) | static PyObject *pygpu_shader_info_vertex_in(BPyGPUShaderCreateInfo *self, PyObject *args) | ||||
| { | { | ||||
| int slot; | int slot; | ||||
| struct PyC_StringEnum pygpu_type = {pygpu_attrtype_items}; | struct PyC_StringEnum pygpu_type = {pygpu_attrtype_items}; | ||||
| const char *param; | const char *param; | ||||
| if (!PyArg_ParseTuple(args, "iO&s:vertex_in", &slot, PyC_ParseStringEnum, &pygpu_type, ¶m)) { | if (!PyArg_ParseTuple(args, "iO&s:vertex_in", &slot, PyC_ParseStringEnum, &pygpu_type, ¶m)) { | ||||
| Show All 10 Lines | #endif | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| PyDoc_STRVAR(pygpu_shader_info_vertex_out_doc, | PyDoc_STRVAR(pygpu_shader_info_vertex_out_doc, | ||||
| ".. method:: vertex_out(interface)\n" | ".. method:: vertex_out(interface)\n" | ||||
| "\n" | "\n" | ||||
| " Add a vertex shader output interface block.\n" | " Add a vertex shader output interface block.\n" | ||||
| "\n" | "\n" | ||||
| " :param interface: Object describing the block.\n" | " :arg interface: Object describing the block.\n" | ||||
| " :type interface: :class:`gpu.types.GPUStageInterfaceInfo`\n"); | " :type interface: :class:`gpu.types.GPUStageInterfaceInfo`\n"); | ||||
| static PyObject *pygpu_shader_info_vertex_out(BPyGPUShaderCreateInfo *self, | static PyObject *pygpu_shader_info_vertex_out(BPyGPUShaderCreateInfo *self, | ||||
| BPyGPUStageInterfaceInfo *o) | BPyGPUStageInterfaceInfo *o) | ||||
| { | { | ||||
| if (!BPyGPUStageInterfaceInfo_Check(o)) { | if (!BPyGPUStageInterfaceInfo_Check(o)) { | ||||
| PyErr_Format(PyExc_TypeError, "Expected a GPUStageInterfaceInfo, got %s", Py_TYPE(o)->tp_name); | PyErr_Format(PyExc_TypeError, "Expected a GPUStageInterfaceInfo, got %s", Py_TYPE(o)->tp_name); | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| Show All 9 Lines | #endif | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| PyDoc_STRVAR(pygpu_shader_info_fragment_out_doc, | PyDoc_STRVAR(pygpu_shader_info_fragment_out_doc, | ||||
| ".. method:: fragment_out(slot, type, name, blend='NONE')\n" | ".. method:: fragment_out(slot, type, name, blend='NONE')\n" | ||||
| "\n" | "\n" | ||||
| " Specify a fragment output corresponding to a framebuffer target slot.\n" | " Specify a fragment output corresponding to a framebuffer target slot.\n" | ||||
| "\n" | "\n" | ||||
| " :param slot: The attribute index.\n" | " :arg slot: The attribute index.\n" | ||||
| " :type slot: int\n" | " :type slot: int\n" | ||||
| " :param type: One of these types:\n" | " :arg type: One of these types:\n" | ||||
| "\n" PYDOC_TYPE_LIST | "\n" PYDOC_TYPE_LIST | ||||
| "\n" | "\n" | ||||
| " :type type: str\n" | " :type type: str\n" | ||||
| " :param name: Name of the attribute.\n" | " :arg name: Name of the attribute.\n" | ||||
| " :type name: str\n" | " :type name: str\n" | ||||
| " :param blend: Dual Source Blending Index. It can be 'NONE', 'SRC_0' or 'SRC_1'.\n" | " :arg blend: Dual Source Blending Index. It can be 'NONE', 'SRC_0' or 'SRC_1'.\n" | ||||
| " :type blend: str\n"); | " :type blend: str\n"); | ||||
| static PyObject *pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self, | static PyObject *pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self, | ||||
| PyObject *args, | PyObject *args, | ||||
| PyObject *kwds) | PyObject *kwds) | ||||
| { | { | ||||
| int slot; | int slot; | ||||
| struct PyC_StringEnum pygpu_type = {pygpu_attrtype_items}; | struct PyC_StringEnum pygpu_type = {pygpu_attrtype_items}; | ||||
| const char *name; | const char *name; | ||||
| Show All 34 Lines | |||||
| } | } | ||||
| PyDoc_STRVAR( | PyDoc_STRVAR( | ||||
| pygpu_shader_info_uniform_buf_doc, | pygpu_shader_info_uniform_buf_doc, | ||||
| ".. method:: uniform_buf(slot, type_name, name)\n" | ".. method:: uniform_buf(slot, type_name, name)\n" | ||||
| "\n" | "\n" | ||||
| " Specify a uniform variable whose type can be one of those declared in `typedef_source`.\n" | " Specify a uniform variable whose type can be one of those declared in `typedef_source`.\n" | ||||
| "\n" | "\n" | ||||
| " :param slot: The uniform variable index.\n" | " :arg slot: The uniform variable index.\n" | ||||
| " :type slot: int\n" | " :type slot: int\n" | ||||
| " :param type_name: Name of the data type. It can be a struct type defined in the source " | " :arg 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" | "passed through the :meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n" | ||||
| " :type type_name: str\n" | " :type type_name: str\n" | ||||
| " :param name: The uniform variable name.\n" | " :arg name: The uniform variable name.\n" | ||||
| " :type name: str\n"); | " :type name: str\n"); | ||||
| static PyObject *pygpu_shader_info_uniform_buf(BPyGPUShaderCreateInfo *self, PyObject *args) | static PyObject *pygpu_shader_info_uniform_buf(BPyGPUShaderCreateInfo *self, PyObject *args) | ||||
| { | { | ||||
| int slot; | int slot; | ||||
| const char *type_name; | const char *type_name; | ||||
| const char *name; | const char *name; | ||||
| if (!PyArg_ParseTuple(args, "iss:uniform_buf", &slot, &type_name, &name)) { | if (!PyArg_ParseTuple(args, "iss:uniform_buf", &slot, &type_name, &name)) { | ||||
| Show All 13 Lines | |||||
| #ifdef USE_PYGPU_SHADER_INFO_IMAGE_METHOD | #ifdef USE_PYGPU_SHADER_INFO_IMAGE_METHOD | ||||
| PyDoc_STRVAR( | PyDoc_STRVAR( | ||||
| pygpu_shader_info_image_doc, | pygpu_shader_info_image_doc, | ||||
| ".. method:: image(slot, format, type, name, qualifiers={'NO_RESTRICT'})\n" | ".. method:: image(slot, format, type, name, qualifiers={'NO_RESTRICT'})\n" | ||||
| "\n" | "\n" | ||||
| " Specify an image resource used for arbitrary load and store operations.\n" | " Specify an image resource used for arbitrary load and store operations.\n" | ||||
| "\n" | "\n" | ||||
| " :param slot: The image resource index.\n" | " :arg slot: The image resource index.\n" | ||||
| " :type slot: int\n" | " :type slot: int\n" | ||||
| " :param format: The GPUTexture format that is passed to the shader. Possible values are:\n" | " :arg format: The GPUTexture format that is passed to the shader. Possible values are:\n" | ||||
| "" PYDOC_TEX_FORMAT_ITEMS | "" PYDOC_TEX_FORMAT_ITEMS | ||||
| " :type format: str\n" | " :type format: str\n" | ||||
| " :param type: The data type describing how the image is to be read in the shader. " | " :arg type: The data type describing how the image is to be read in the shader. " | ||||
| "Possible values are:\n" | "Possible values are:\n" | ||||
| "\n" PYDOC_IMAGE_TYPES | "\n" PYDOC_IMAGE_TYPES | ||||
| "\n" | "\n" | ||||
| " :type type: str\n" | " :type type: str\n" | ||||
| " :param name: The image resource name.\n" | " :arg name: The image resource name.\n" | ||||
| " :type name: str\n" | " :type name: str\n" | ||||
| " :param qualifiers: Set containing values that describe how the image resource is to be " | " :arg qualifiers: Set containing values that describe how the image resource is to be " | ||||
| "read or written. Possible values are:\n" | "read or written. Possible values are:\n" | ||||
| "" PYDOC_QUALIFIERS | "" PYDOC_QUALIFIERS | ||||
| "" | "" | ||||
| " :type qualifiers: set\n"); | " :type qualifiers: set\n"); | ||||
| static PyObject *pygpu_shader_info_image(BPyGPUShaderCreateInfo *self, | static PyObject *pygpu_shader_info_image(BPyGPUShaderCreateInfo *self, | ||||
| PyObject *args, | PyObject *args, | ||||
| PyObject *kwds) | PyObject *kwds) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| PyDoc_STRVAR( | PyDoc_STRVAR( | ||||
| pygpu_shader_info_sampler_doc, | pygpu_shader_info_sampler_doc, | ||||
| ".. method:: sampler(slot, type, name)\n" | ".. method:: sampler(slot, type, name)\n" | ||||
| "\n" | "\n" | ||||
| " Specify an image texture sampler.\n" | " Specify an image texture sampler.\n" | ||||
| "\n" | "\n" | ||||
| " :param slot: The image texture sampler index.\n" | " :arg slot: The image texture sampler index.\n" | ||||
| " :type slot: int\n" | " :type slot: int\n" | ||||
| " :param type: The data type describing the format of each sampler unit. Possible values " | " :arg type: The data type describing the format of each sampler unit. Possible values " | ||||
| "are:\n" | "are:\n" | ||||
| "\n" PYDOC_IMAGE_TYPES | "\n" PYDOC_IMAGE_TYPES | ||||
| "\n" | "\n" | ||||
| " :type type: str\n" | " :type type: str\n" | ||||
| " :param name: The image texture sampler name.\n" | " :arg name: The image texture sampler name.\n" | ||||
| " :type name: str\n"); | " :type name: str\n"); | ||||
| static PyObject *pygpu_shader_info_sampler(BPyGPUShaderCreateInfo *self, PyObject *args) | static PyObject *pygpu_shader_info_sampler(BPyGPUShaderCreateInfo *self, PyObject *args) | ||||
| { | { | ||||
| int slot; | int slot; | ||||
| struct PyC_StringEnum pygpu_samplertype = {pygpu_imagetype_items}; | struct PyC_StringEnum pygpu_samplertype = {pygpu_imagetype_items}; | ||||
| const char *name; | const char *name; | ||||
| if (!PyArg_ParseTuple( | if (!PyArg_ParseTuple( | ||||
| ▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | static int constants_calc_size(ShaderCreateInfo *info) | ||||
| return size_prev + (size_prev % 16); | return size_prev + (size_prev % 16); | ||||
| } | } | ||||
| PyDoc_STRVAR(pygpu_shader_info_push_constant_doc, | PyDoc_STRVAR(pygpu_shader_info_push_constant_doc, | ||||
| ".. method:: push_constant(type, name, size=0)\n" | ".. method:: push_constant(type, name, size=0)\n" | ||||
| "\n" | "\n" | ||||
| " Specify a global access constant.\n" | " Specify a global access constant.\n" | ||||
| "\n" | "\n" | ||||
| " :param type: One of these types:\n" | " :arg type: One of these types:\n" | ||||
| "\n" PYDOC_TYPE_LIST | "\n" PYDOC_TYPE_LIST | ||||
| "\n" | "\n" | ||||
| " :type type: str\n" | " :type type: str\n" | ||||
| " :param name: Name of the constant.\n" | " :arg name: Name of the constant.\n" | ||||
| " :type name: str\n" | " :type name: str\n" | ||||
| " :param size: If not zero, indicates that the constant is an array with the " | " :arg size: If not zero, indicates that the constant is an array with the " | ||||
| "specified size.\n" | "specified size.\n" | ||||
| " :type size: uint\n"); | " :type size: uint\n"); | ||||
| static PyObject *pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self, | static PyObject *pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self, | ||||
| PyObject *args, | PyObject *args, | ||||
| PyObject *kwds) | PyObject *kwds) | ||||
| { | { | ||||
| struct PyC_StringEnum pygpu_type = {pygpu_attrtype_items}; | struct PyC_StringEnum pygpu_type = {pygpu_attrtype_items}; | ||||
| const char *name = nullptr; | const char *name = nullptr; | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | PyDoc_STRVAR( | ||||
| " Vertex shader source code written in GLSL.\n" | " Vertex shader source code written in GLSL.\n" | ||||
| "\n" | "\n" | ||||
| " Example:\n" | " Example:\n" | ||||
| "\n" | "\n" | ||||
| " .. code-block:: python\n" | " .. code-block:: python\n" | ||||
| "\n" | "\n" | ||||
| " \"void main {gl_Position = vec4(pos, 1.0);}\"\n" | " \"void main {gl_Position = vec4(pos, 1.0);}\"\n" | ||||
| "\n" | "\n" | ||||
| " :param source: The vertex shader source code.\n" | " :arg source: The vertex shader source code.\n" | ||||
| " :type source: str\n" | " :type source: str\n" | ||||
| "\n" | "\n" | ||||
| " .. seealso:: `GLSL Cross Compilation " | " .. seealso:: `GLSL Cross Compilation " | ||||
| "<https://wiki.blender.org/wiki/EEVEE_%26_Viewport/GPU_Module/GLSL_Cross_Compilation>`__\n"); | "<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) | static PyObject *pygpu_shader_info_vertex_source(BPyGPUShaderCreateInfo *self, PyObject *o) | ||||
| { | { | ||||
| const char *vertex_source = PyUnicode_AsUTF8(o); | const char *vertex_source = PyUnicode_AsUTF8(o); | ||||
| if (vertex_source == nullptr) { | if (vertex_source == nullptr) { | ||||
| Show All 24 Lines | PyDoc_STRVAR( | ||||
| " Fragment shader source code written in GLSL.\n" | " Fragment shader source code written in GLSL.\n" | ||||
| "\n" | "\n" | ||||
| " Example:\n" | " Example:\n" | ||||
| "\n" | "\n" | ||||
| " .. code-block:: python\n" | " .. code-block:: python\n" | ||||
| "\n" | "\n" | ||||
| " \"void main {fragColor = vec4(0.0, 0.0, 0.0, 1.0);}\"\n" | " \"void main {fragColor = vec4(0.0, 0.0, 0.0, 1.0);}\"\n" | ||||
| "\n" | "\n" | ||||
| " :param source: The fragment shader source code.\n" | " :arg source: The fragment shader source code.\n" | ||||
| " :type source: str\n" | " :type source: str\n" | ||||
| "\n" | "\n" | ||||
| " .. seealso:: `GLSL Cross Compilation " | " .. seealso:: `GLSL Cross Compilation " | ||||
| "<https://wiki.blender.org/wiki/EEVEE_%26_Viewport/GPU_Module/GLSL_Cross_Compilation>`__\n"); | "<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) | static PyObject *pygpu_shader_info_fragment_source(BPyGPUShaderCreateInfo *self, PyObject *o) | ||||
| { | { | ||||
| const char *fragment_source = PyUnicode_AsUTF8(o); | const char *fragment_source = PyUnicode_AsUTF8(o); | ||||
| if (fragment_source == nullptr) { | if (fragment_source == nullptr) { | ||||
| Show All 24 Lines | PyDoc_STRVAR(pygpu_shader_info_typedef_source_doc, | ||||
| "Useful for defining structs used by Uniform Buffers.\n" | "Useful for defining structs used by Uniform Buffers.\n" | ||||
| "\n" | "\n" | ||||
| " Example:\n" | " Example:\n" | ||||
| "\n" | "\n" | ||||
| ".. code-block:: python\n" | ".. code-block:: python\n" | ||||
| "\n" | "\n" | ||||
| " \"struct MyType {int foo; float bar;};\"\n" | " \"struct MyType {int foo; float bar;};\"\n" | ||||
| "\n" | "\n" | ||||
| " :param source: The source code defining types.\n" | " :arg source: The source code defining types.\n" | ||||
| " :type source: str\n"); | " :type source: str\n"); | ||||
| static PyObject *pygpu_shader_info_typedef_source(BPyGPUShaderCreateInfo *self, PyObject *o) | static PyObject *pygpu_shader_info_typedef_source(BPyGPUShaderCreateInfo *self, PyObject *o) | ||||
| { | { | ||||
| const char *typedef_source = PyUnicode_AsUTF8(o); | const char *typedef_source = PyUnicode_AsUTF8(o); | ||||
| if (typedef_source == nullptr) { | if (typedef_source == nullptr) { | ||||
| PyErr_Format(PyExc_ValueError, "expected a string, got %s", Py_TYPE(o)->tp_name); | PyErr_Format(PyExc_ValueError, "expected a string, got %s", Py_TYPE(o)->tp_name); | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| Show All 22 Lines | PyDoc_STRVAR(pygpu_shader_info_define_doc, | ||||
| ".. method:: define(name, value)\n" | ".. method:: define(name, value)\n" | ||||
| "\n" | "\n" | ||||
| " Add a preprocessing define directive. In GLSL it would be something like:\n" | " Add a preprocessing define directive. In GLSL it would be something like:\n" | ||||
| "\n" | "\n" | ||||
| ".. code-block:: glsl\n" | ".. code-block:: glsl\n" | ||||
| "\n" | "\n" | ||||
| " #define name value\n" | " #define name value\n" | ||||
| "\n" | "\n" | ||||
| " :param name: Token name.\n" | " :arg name: Token name.\n" | ||||
| " :type name: str\n" | " :type name: str\n" | ||||
| " :param value: Text that replaces token occurrences.\n" | " :arg value: Text that replaces token occurrences.\n" | ||||
| " :type value: str\n"); | " :type value: str\n"); | ||||
| static PyObject *pygpu_shader_info_define(BPyGPUShaderCreateInfo *self, PyObject *args) | static PyObject *pygpu_shader_info_define(BPyGPUShaderCreateInfo *self, PyObject *args) | ||||
| { | { | ||||
| const char *name; | const char *name; | ||||
| const char *value = nullptr; | const char *value = nullptr; | ||||
| if (!PyArg_ParseTuple(args, "s|s:define", &name, &value)) { | if (!PyArg_ParseTuple(args, "s|s:define", &name, &value)) { | ||||
| return nullptr; | return nullptr; | ||||
| ▲ Show 20 Lines • Show All 198 Lines • Show Last 20 Lines | |||||