Blender V5.3
gpu_py_shader.cc File Reference

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Functions

Public API
PyObject * blender::BPyGPUShader_CreatePyObject (gpu::Shader *shader, bool is_builtin)
PyObject * blender::bpygpu_shader_init ()
bool blender::bpygpu_shader_is_polyline (gpu::Shader *shader)

Enum Conversion.

#define PYDOC_BUILTIN_SHADER_DESCRIPTION
static const PyC_StringEnumItems blender::pygpu_shader_builtin_items []
static const PyC_StringEnumItems blender::pygpu_shader_config_items []
static int blender::pygpu_shader_uniform_location_get (gpu::Shader *shader, const char *name, const char *error_prefix)

Shader Type

static PyMethodDef blender::pygpu_shader__tp_methods []
static PyGetSetDef blender::pygpu_shader__tp_getseters []
PyTypeObject blender::BPyGPUShader_Type
 blender::PyDoc_STRVAR (pygpu_shader_bind_doc, ".. method:: bind()\n" "\n" " Bind the shader object. Required to be able to change uniforms of this shader.\n")
static PyObject * blender::pygpu_shader_bind (BPyGPUShader *self)
 blender::PyDoc_STRVAR (pygpu_shader_uniform_from_name_doc, ".. method:: uniform_from_name(name)\n" "\n" " Get uniform location by name.\n" "\n" " :param name: Name of the uniform variable whose location is to be queried.\n" " :type name: str\n" " :return: Location of the uniform variable.\n" " :rtype: int\n")
static PyObject * blender::pygpu_shader_uniform_from_name (BPyGPUShader *self, PyObject *arg)
 blender::PyDoc_STRVAR (pygpu_shader_uniform_block_from_name_doc, ".. method:: uniform_block_from_name(name)\n" "\n" " Get uniform block location by name.\n" "\n" " :param name: Name of the uniform block variable whose location is to be queried.\n" " :type name: str\n" " :return: The location of the uniform block variable.\n" " :rtype: int\n")
static PyObject * blender::pygpu_shader_uniform_block_from_name (BPyGPUShader *self, PyObject *arg)
static bool blender::pygpu_shader_uniform_vector_impl (PyObject *args, int elem_size, int *r_location, int *r_length, int *r_count, Py_buffer *r_pybuffer)
 blender::PyDoc_STRVAR (pygpu_shader_uniform_vector_float_doc, ".. method:: uniform_vector_float(location, buffer, length, count)\n" "\n" " Set the buffer to fill the uniform.\n" "\n" " :param location: Location of the uniform variable to be modified.\n" " :type location: int\n" " :param buffer: The data that should be set. Can support the buffer protocol.\n" " :type buffer: Sequence[float]\n" " :param length: Size of the uniform data type:\n" "\n" " - 1: float\n" " - 2: vec2 or float[2]\n" " - 3: vec3 or float[3]\n" " - 4: vec4 or float[4]\n" " - 9: mat3\n" " - 16: mat4\n" " :type length: int\n" " :param count: Specifies the number of elements, vector or matrices that are to " "be modified.\n" " :type count: int\n")
static PyObject * blender::pygpu_shader_uniform_vector_float (BPyGPUShader *self, PyObject *args)
 blender::PyDoc_STRVAR (pygpu_shader_uniform_vector_int_doc, ".. method:: uniform_vector_int(location, buffer, length, count)\n" "\n" " Set the buffer to fill the uniform.\n" "\n" " :param location: Location of the uniform variable to be modified.\n" " :type location: int\n" " :param buffer: Buffer object with format matching the uniform.\n" " :type buffer: Buffer\n" " :param length: Size of the uniform data type.\n" " :type length: int\n" " :param count: Specifies the number of elements that are to be modified.\n" " :type count: int\n")
static PyObject * blender::pygpu_shader_uniform_vector_int (BPyGPUShader *self, PyObject *args)
 blender::PyDoc_STRVAR (pygpu_shader_uniform_bool_doc, ".. method:: uniform_bool(name, value)\n" "\n" " Specify the value of a uniform variable for the current program object.\n" "\n" " :param name: Name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :param value: Value that will be used to update the specified uniform variable.\n" " :type value: bool | Sequence[bool]\n")
static PyObject * blender::pygpu_shader_uniform_bool (BPyGPUShader *self, PyObject *args)
 blender::PyDoc_STRVAR (pygpu_shader_uniform_float_doc, ".. method:: uniform_float(name, value)\n" "\n" " Specify the value of a uniform variable for the current program object.\n" "\n" " :param name: Name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :param value: Value that will be used to update the specified uniform variable.\n" " :type value: float | Sequence[float]\n")
static PyObject * blender::pygpu_shader_uniform_float (BPyGPUShader *self, PyObject *args)
 blender::PyDoc_STRVAR (pygpu_shader_uniform_int_doc, ".. method:: uniform_int(name, seq)\n" "\n" " Specify the value of a uniform variable for the current program object.\n" "\n" " :param name: Name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :param seq: Value that will be used to update the specified uniform variable.\n" " :type seq: int | Sequence[int]\n")
static PyObject * blender::pygpu_shader_uniform_int (BPyGPUShader *self, PyObject *args)
 blender::PyDoc_STRVAR (pygpu_shader_uniform_sampler_doc, ".. method:: uniform_sampler(name, texture)\n" "\n" " Specify the value of a texture uniform variable for the current GPUShader.\n" "\n" " :param name: Name of the uniform variable whose texture is to be specified.\n" " :type name: str\n" " :param texture: Texture to attach.\n" " :type texture: :class:`gpu.types.GPUTexture`\n")
static PyObject * blender::pygpu_shader_uniform_sampler (BPyGPUShader *self, PyObject *args)
 blender::PyDoc_STRVAR (pygpu_shader_image_doc, ".. method:: image(name, texture)\n" "\n" " Specify the value of an image variable for the current GPUShader.\n" "\n" " :param name: Name of the image variable to which the texture is to be bound.\n" " :type name: str\n" " :param texture: Texture to attach.\n" " :type texture: :class:`gpu.types.GPUTexture`\n")
static PyObject * blender::pygpu_shader_image (BPyGPUShader *self, PyObject *args)
 blender::PyDoc_STRVAR (pygpu_shader_uniform_block_doc, ".. method:: uniform_block(name, ubo)\n" "\n" " Specify the value of a uniform buffer object variable for the current GPUShader.\n" "\n" " :param name: Name of the uniform variable whose UBO is to be specified.\n" " :type name: str\n" " :param ubo: Uniform Buffer to attach.\n" " :type ubo: :class:`gpu.types.GPUUniformBuf`\n")
static PyObject * blender::pygpu_shader_uniform_block (BPyGPUShader *self, PyObject *args)
 blender::PyDoc_STRVAR (pygpu_shader_storage_block_doc, ".. method:: storage_block(name, ssbo)\n" "\n" " Specify the value of a storage buffer object variable for the current GPUShader.\n" "\n" " :param name: Name of the storage block variable whose SSBO is to be specified.\n" " :type name: str\n" " :param ssbo: Storage Buffer to attach.\n" " :type ssbo: :class:`gpu.types.GPUStorageBuf`\n")
static PyObject * blender::pygpu_shader_storage_block (BPyGPUShader *self, PyObject *args)
 blender::PyDoc_STRVAR (pygpu_shader_attr_from_name_doc, ".. method:: attr_from_name(name)\n" "\n" " Get attribute location by name.\n" "\n" " :param name: The name of the attribute variable whose location is to be queried.\n" " :type name: str\n" " :return: The location of an attribute variable.\n" " :rtype: int\n")
static PyObject * blender::pygpu_shader_attr_from_name (BPyGPUShader *self, PyObject *arg)
 blender::PyDoc_STRVAR (pygpu_shader_format_calc_doc, ".. method:: format_calc()\n" "\n" " Build a new format based on the attributes of the shader.\n" "\n" " :return: vertex attribute format for the shader\n" " :rtype: :class:`gpu.types.GPUVertFormat`\n")
static PyObject * blender::pygpu_shader_format_calc (BPyGPUShader *self, PyObject *)
 blender::PyDoc_STRVAR (pygpu_shader_attrs_info_get_doc, ".. method:: attrs_info_get()\n" "\n" " Information about the attributes used in the Shader.\n" "\n" " :return: tuples containing information about the attributes in order (name, type)\n" " :rtype: tuple[tuple[str, str | None], ...]\n")
static PyObject * blender::pygpu_shader_attrs_info_get (BPyGPUShader *self, PyObject *)
 blender::PyDoc_STRVAR (pygpu_shader_name_doc, "The name of the shader object for debugging purposes (read-only).\n" "\n" ":type: str\n")
static PyObject * blender::pygpu_shader_name (BPyGPUShader *self, void *)
 blender::PyDoc_STRVAR (pygpu_shader_program_doc, "The name of the program object for use by the OpenGL API (read-only).\n" "This is deprecated and will always return -1.\n" "\n" ":type: int\n")
static PyObject * blender::pygpu_shader_program_get (BPyGPUShader *, void *)
static void blender::pygpu_shader__tp_dealloc (BPyGPUShader *self)

gpu.shader Module API

static PyMethodDef blender::pygpu_shader_module__tp_methods []
static PyModuleDef blender::pygpu_shader_module_def
 blender::PyDoc_STRVAR (pygpu_shader_unbind_doc, ".. function:: unbind()\n" "\n" " Unbind the bound shader object.\n")
static PyObject * blender::pygpu_shader_unbind (PyObject *)
 blender::PyDoc_STRVAR (pygpu_shader_from_builtin_doc, ".. function:: from_builtin(shader_name, *, config='DEFAULT')\n" "\n" " Shaders that are embedded in the Blender internal code (see :ref:`built-in-shaders`).\n" " They all read the uniform ``mat4 ModelViewProjectionMatrix``,\n" " which can be edited by the :mod:`gpu.matrix` module.\n" "\n" " You can also choose a shader configuration that uses clip_planes by setting the " "``CLIPPED`` value to the config parameter. Note that in this case you also need to " "manually set the value of ``mat4 ModelMatrix``.\n" "\n" " :param shader_name: One of the builtin shader names.\n" " :type shader_name: str\n" " :param config: One of these types of shader configuration:\n" "\n" " - ``DEFAULT``\n" " - ``CLIPPED``\n" " :type config: str\n" " :return: Shader object corresponding to the given name.\n" " :rtype: :class:`gpu.types.GPUShader`\n")
static PyObject * blender::pygpu_shader_from_builtin (PyObject *, PyObject *args, PyObject *kwds)
 blender::PyDoc_STRVAR (pygpu_shader_create_from_info_doc, ".. function:: create_from_info(shader_info)\n" "\n" " Create shader from a GPUShaderCreateInfo.\n" "\n" " :param shader_info: GPUShaderCreateInfo\n" " :type shader_info: :class:`gpu.types.GPUShaderCreateInfo`\n" " :return: Shader object corresponding to the given shader info.\n" " :rtype: :class:`gpu.types.GPUShader`\n")
static PyObject * blender::pygpu_shader_create_from_info (BPyGPUShader *, BPyGPUShaderCreateInfo *o)
 blender::PyDoc_STRVAR (pygpu_shader_module__tp_doc, "This module provides access to GPUShader internal functions.\n" "\n" ".. _built-in-shaders:\n" "\n" ".. rubric:: Built-in shaders\n" "\n" "All built-in shaders have the ``mat4 ModelViewProjectionMatrix`` uniform.\n" "\n" "Its value must be modified using the :mod:`gpu.matrix` module.\n" "\n" ".. important::\n" "\n" " Shader uniforms must be explicitly initialized to avoid retaining values from previous " "executions.\n" "\n" PYDOC_BUILTIN_SHADER_DESCRIPTION)

Detailed Description

  • Use bpygpu_ for local API.
  • Use BPyGPU for public API.

Definition in file gpu_py_shader.cc.

Macro Definition Documentation

◆ PYDOC_BUILTIN_SHADER_DESCRIPTION

#define PYDOC_BUILTIN_SHADER_DESCRIPTION

Definition at line 42 of file gpu_py_shader.cc.

Referenced by blender::PyDoc_STRVAR().