Blender V4.3
gpu_py_shader.cc File Reference
#include <Python.h>
#include "BLI_utildefines.h"
#include "GPU_shader.hh"
#include "GPU_texture.hh"
#include "GPU_uniform_buffer.hh"
#include "../generic/py_capi_utils.hh"
#include "../generic/python_compat.hh"
#include "../generic/python_utildefines.hh"
#include "../mathutils/mathutils.hh"
#include "gpu_py.hh"
#include "gpu_py_texture.hh"
#include "gpu_py_uniformbuffer.hh"
#include "gpu_py_vertex_format.hh"
#include "gpu_py_shader.hh"

Go to the source code of this file.

Functions

Public API
PyObject * BPyGPUShader_CreatePyObject (GPUShader *shader, bool is_builtin)
 
PyObject * bpygpu_shader_init ()
 

Enum Conversion.

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

Shader Type

static PyMethodDef pygpu_shader__tp_methods []
 
static PyGetSetDef pygpu_shader__tp_getseters []
 
PyTypeObject BPyGPUShader_Type
 
static PyObject * pygpu_shader__tp_new (PyTypeObject *, PyObject *args, PyObject *kwds)
 
 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 * pygpu_shader_bind (BPyGPUShader *self)
 
 PyDoc_STRVAR (pygpu_shader_uniform_from_name_doc, ".. method:: uniform_from_name(name)\n" "\n" " Get uniform location by name.\n" "\n" " :arg 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 * pygpu_shader_uniform_from_name (BPyGPUShader *self, PyObject *arg)
 
 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" " :arg 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 * pygpu_shader_uniform_block_from_name (BPyGPUShader *self, PyObject *arg)
 
static bool pygpu_shader_uniform_vector_impl (PyObject *args, int elem_size, int *r_location, int *r_length, int *r_count, Py_buffer *r_pybuffer)
 
 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" " :arg location: Location of the uniform variable to be modified.\n" " :type location: int\n" " :arg buffer: The data that should be set. Can support the buffer protocol.\n" " :type buffer: Sequence[float]\n" " :arg 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" " :arg count: Specifies the number of elements, vector or matrices that are to " "be modified.\n" " :type count: int\n")
 
static PyObject * pygpu_shader_uniform_vector_float (BPyGPUShader *self, PyObject *args)
 
 PyDoc_STRVAR (pygpu_shader_uniform_vector_int_doc, ".. method:: uniform_vector_int(location, buffer, length, count)\n" "\n" " See GPUShader.uniform_vector_float(...) description.\n")
 
static PyObject * pygpu_shader_uniform_vector_int (BPyGPUShader *self, PyObject *args)
 
 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" " :arg name: Name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :arg value: Value that will be used to update the specified uniform variable.\n" " :type value: bool | Sequence[bool]\n")
 
static PyObject * pygpu_shader_uniform_bool (BPyGPUShader *self, PyObject *args)
 
 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" " :arg name: Name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :arg value: Value that will be used to update the specified uniform variable.\n" " :type value: float | Sequence[float]\n")
 
static PyObject * pygpu_shader_uniform_float (BPyGPUShader *self, PyObject *args)
 
 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" " :arg name: name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :arg seq: Value that will be used to update the specified uniform variable.\n" " :type seq: Sequence[int]\n")
 
static PyObject * pygpu_shader_uniform_int (BPyGPUShader *self, PyObject *args)
 
 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" " :arg name: name of the uniform variable whose texture is to be specified.\n" " :type name: str\n" " :arg texture: Texture to attach.\n" " :type texture: :class:`gpu.types.GPUTexture`\n")
 
static PyObject * pygpu_shader_uniform_sampler (BPyGPUShader *self, PyObject *args)
 
 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" " :arg name: Name of the image variable to which the texture is to be bound.\n" " :type name: str\n" " :arg texture: Texture to attach.\n" " :type texture: :class:`gpu.types.GPUTexture`\n")
 
static PyObject * pygpu_shader_image (BPyGPUShader *self, PyObject *args)
 
 PyDoc_STRVAR (pygpu_shader_uniform_block_doc, ".. method:: uniform_block(name, ubo)\n" "\n" " Specify the value of an uniform buffer object variable for the current GPUShader.\n" "\n" " :arg name: name of the uniform variable whose UBO is to be specified.\n" " :type name: str\n" " :arg ubo: Uniform Buffer to attach.\n" " :type texture: :class:`gpu.types.GPUUniformBuf`\n")
 
static PyObject * pygpu_shader_uniform_block (BPyGPUShader *self, PyObject *args)
 
 PyDoc_STRVAR (pygpu_shader_attr_from_name_doc, ".. method:: attr_from_name(name)\n" "\n" " Get attribute location by name.\n" "\n" " :arg 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 * pygpu_shader_attr_from_name (BPyGPUShader *self, PyObject *arg)
 
 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 * pygpu_shader_format_calc (BPyGPUShader *self, PyObject *)
 
 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 * pygpu_shader_attrs_info_get (BPyGPUShader *self, PyObject *)
 
 PyDoc_STRVAR (pygpu_shader_name_doc, "The name of the shader object for debugging purposes (read-only).\n" "\n" ":type: str")
 
static PyObject * pygpu_shader_name (BPyGPUShader *self, void *)
 
 PyDoc_STRVAR (pygpu_shader_program_doc, "The name of the program object for use by the OpenGL API (read-only).\n" "\n" ":type: int")
 
static PyObject * pygpu_shader_program_get (BPyGPUShader *self, void *)
 
static void pygpu_shader__tp_dealloc (BPyGPUShader *self)
 
 PyDoc_STRVAR (pygpu_shader__tp_doc, ".. class:: GPUShader(vertexcode, fragcode, geocode=None, libcode=None, defines=None, " "name='pyGPUShader')\n" "\n" " GPUShader combines multiple GLSL shaders into a program used for drawing.\n" " It must contain at least a vertex and fragment shaders.\n" "\n" " The GLSL ``#version`` directive is automatically included at the top of shaders,\n" " and set to 330. Some preprocessor directives are automatically added according to\n" " the Operating System or availability: ``GPU_ATI``, ``GPU_NVIDIA`` and ``GPU_INTEL``.\n" "\n" " The following extensions are enabled by default if supported by the GPU:\n" " ``GL_ARB_texture_gather``, ``GL_ARB_texture_cube_map_array``\n" " and ``GL_ARB_shader_draw_parameters``.\n" "\n" " For drawing user interface elements and gizmos, use\n" " ``fragOutput = blender_srgb_to_framebuffer_space(fragOutput)``\n" " to transform the output sRGB colors to the frame-buffer color-space.\n" "\n" " :arg vertexcode: Vertex shader code.\n" " :type vertexcode: str\n" " :arg fragcode: Fragment shader code.\n" " :type value: str\n" " :arg geocode: Geometry shader code.\n" " :type value: str\n" " :arg libcode: Code with functions and presets to be shared between shaders.\n" " :type value: str\n" " :arg defines: Preprocessor directives.\n" " :type value: str\n" " :arg name: Name of shader code, for debugging purposes.\n" " :type value: str\n")
 

gpu.shader Module API

static PyMethodDef pygpu_shader_module__tp_methods []
 
static PyModuleDef pygpu_shader_module_def
 
 PyDoc_STRVAR (pygpu_shader_unbind_doc, ".. function:: unbind()\n" "\n" " Unbind the bound shader object.\n")
 
static PyObject * pygpu_shader_unbind (BPyGPUShader *)
 
 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" " :arg shader_name: One of the builtin shader names.\n" " :type shader_name: str\n" " :arg 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 * pygpu_shader_from_builtin (PyObject *, PyObject *args, PyObject *kwds)
 
 PyDoc_STRVAR (pygpu_shader_create_from_info_doc, ".. function:: create_from_info(shader_info)\n" "\n" " Create shader from a GPUShaderCreateInfo.\n" "\n" " :arg shader_info: GPUShaderCreateInfo\n" " :type shader_info: :class:`bpy.types.GPUShaderCreateInfo`\n" " :return: Shader object corresponding to the given name.\n" " :rtype: :class:`gpu.types.GPUShader`\n")
 
static PyObject * pygpu_shader_create_from_info (BPyGPUShader *, BPyGPUShaderCreateInfo *o)
 
 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 :class:`gpu.matrix` module.\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
Value:
"``FLAT_COLOR``\n" \
" :Attributes: vec3 pos, vec4 color\n" \
" :Uniforms: none\n" \
"``IMAGE``\n" \
" :Attributes: vec3 pos, vec2 texCoord\n" \
" :Uniforms: sampler2D image\n" \
"``IMAGE_COLOR``\n" \
" :Attributes: vec3 pos, vec2 texCoord\n" \
" :Uniforms: sampler2D image, vec4 color\n" \
"``SMOOTH_COLOR``\n" \
" :Attributes: vec3 pos, vec4 color\n" \
" :Uniforms: none\n" \
"``UNIFORM_COLOR``\n" \
" :Attributes: vec3 pos\n" \
" :Uniforms: vec4 color\n" \
"``POLYLINE_FLAT_COLOR``\n" \
" :Attributes: vec3 pos, vec4 color\n" \
" :Uniforms: vec2 viewportSize, float lineWidth\n" \
"``POLYLINE_SMOOTH_COLOR``\n" \
" :Attributes: vec3 pos, vec4 color\n" \
" :Uniforms: vec2 viewportSize, float lineWidth\n" \
"``POLYLINE_UNIFORM_COLOR``\n" \
" :Attributes: vec3 pos\n" \
" :Uniforms: vec2 viewportSize, float lineWidth\n"

Definition at line 37 of file gpu_py_shader.cc.

Function Documentation

◆ bpygpu_shader_init()

PyObject * bpygpu_shader_init ( void )

Definition at line 1085 of file gpu_py_shader.cc.

References pygpu_shader_module_def.

Referenced by BPyInit_gpu().

◆ BPyGPUShader_CreatePyObject()

PyObject * BPyGPUShader_CreatePyObject ( GPUShader * shader,
bool is_builtin )

◆ PyDoc_STRVAR() [1/21]

PyDoc_STRVAR ( pygpu_shader__tp_doc ,
".. class:: GPUShader(vertexcode, fragcode, geocode=None, libcode=None, defines=None, " "name='pyGPUShader')\n" "\n" " GPUShader combines multiple GLSL shaders into a program used for drawing.\n" " It must contain at least a vertex and fragment shaders.\n" "\n" " The GLSL ``#version`` directive is automatically included at the top of shaders,
\n" " and set to 330. Some preprocessor directives are automatically added according to\n" " the Operating System or availability:``GPU_ATI`` ,
``GPU_NVIDIA`` and ``GPU_INTEL``.\n" "\n" " The following extensions are enabled by default if supported by the GPU:\n" " ``GL_ARB_texture_gather`` ,
``GL_ARB_texture_cube_map_array``\n" " and ``GL_ARB_shader_draw_parameters``.\n" "\n" " For drawing user interface elements and gizmos,
use\n" " `` fragOutput = blender_srgb_to_framebuffer_space(fragOutput)``\n" "   to transform the output sRGB colors to the frame-buffer color-space.\n" "\n" "   :arg vertexcode: Vertex shader code.\n" "   :type vertexcode: str\n" "   :arg fragcode: Fragment shader code.\n" "   :type value: str\n" "   :arg geocode: Geometry shader code.\n" "   :type value: str\n" "   :arg libcode: Code with functions and presets to be shared between shaders.\n" "   :type value: str\n" "   :arg defines: Preprocessor directives.\n" "   :type value: str\n" "   :arg name: Name of shader code,
for debugging purposes.\n" " :type value:str\n"  )

◆ PyDoc_STRVAR() [2/21]

PyDoc_STRVAR ( pygpu_shader_attr_from_name_doc ,
".. method:: attr_from_name(name)\n" "\n" " Get attribute location by name.\n" "\n" " :arg 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"  )

◆ PyDoc_STRVAR() [3/21]

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"  )

◆ PyDoc_STRVAR() [4/21]

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"  )

◆ PyDoc_STRVAR() [5/21]

PyDoc_STRVAR ( pygpu_shader_create_from_info_doc ,
".. function:: create_from_info(shader_info)\n" "\n" " Create shader from a GPUShaderCreateInfo.\n" "\n" " :arg shader_info: GPUShaderCreateInfo\n" " :type shader_info: :class:`bpy.types.GPUShaderCreateInfo`\n" " :return: Shader object corresponding to the given name.\n" " :rtype: :class:`gpu.types.GPUShader`\n"  )

◆ PyDoc_STRVAR() [6/21]

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"  )

◆ PyDoc_STRVAR() [7/21]

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" " :arg shader_name:One of the builtin shader names.\n" " :type shader_name:str\n" " :arg 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"  )

◆ PyDoc_STRVAR() [8/21]

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" " :arg name: Name of the image variable to which the texture is to be bound.\n" " :type name: str\n" " :arg texture: Texture to attach.\n" " :type texture: :class:`gpu.types.GPUTexture`\n"  )

◆ PyDoc_STRVAR() [9/21]

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 :class:`gpu.matrix` module.\n" "\n" PYDOC_BUILTIN_SHADER_DESCRIPTION )

◆ PyDoc_STRVAR() [10/21]

PyDoc_STRVAR ( pygpu_shader_name_doc ,
"The name of the shader object for debugging purposes (read-only).\n" "\n" ":type: str"  )

◆ PyDoc_STRVAR() [11/21]

PyDoc_STRVAR ( pygpu_shader_program_doc ,
"The name of the program object for use by the OpenGL API (read-only).\n" "\n" ":type: int"  )

◆ PyDoc_STRVAR() [12/21]

PyDoc_STRVAR ( pygpu_shader_unbind_doc ,
".. function:: unbind()\n" "\n" " Unbind the bound shader object.\n"  )

◆ PyDoc_STRVAR() [13/21]

PyDoc_STRVAR ( pygpu_shader_uniform_block_doc ,
".. method:: uniform_block(name, ubo)\n" "\n" " Specify the value of an uniform buffer object variable for the current GPUShader.\n" "\n" " :arg name: name of the uniform variable whose UBO is to be specified.\n" " :type name: str\n" " :arg ubo: Uniform Buffer to attach.\n" " :type texture: :class:`gpu.types.GPUUniformBuf`\n"  )

◆ PyDoc_STRVAR() [14/21]

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" " :arg 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"  )

◆ PyDoc_STRVAR() [15/21]

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" " :arg name: Name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :arg value: Value that will be used to update the specified uniform variable.\n" " :type value: bool | Sequence\n" [bool] )

◆ PyDoc_STRVAR() [16/21]

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" " :arg name: Name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :arg value: Value that will be used to update the specified uniform variable.\n" " :type value: float | Sequence\n" [float] )

◆ PyDoc_STRVAR() [17/21]

PyDoc_STRVAR ( pygpu_shader_uniform_from_name_doc ,
".. method:: uniform_from_name(name)\n" "\n" " Get uniform location by name.\n" "\n" " :arg 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"  )

◆ PyDoc_STRVAR() [18/21]

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" " :arg name: name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :arg seq: Value that will be used to update the specified uniform variable.\n" " :type seq: Sequence\n" [int] )

◆ PyDoc_STRVAR() [19/21]

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" " :arg name: name of the uniform variable whose texture is to be specified.\n" " :type name: str\n" " :arg texture: Texture to attach.\n" " :type texture: :class:`gpu.types.GPUTexture`\n"  )

◆ PyDoc_STRVAR() [20/21]

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" " :arg location: Location of the uniform variable to be modified.\n" " :type location: int\n" " :arg buffer: The data that should be set. Can support the buffer protocol.\n" " :type buffer: Sequence\n" " :arg length: Size of the uniform data type:\n" "\n" " - 1: float\n" " - 2: vec2 or float\n" " - 3: vec3 or float\n" " - 4: vec4 or float\n" " - 9: mat3\n" " - 16: mat4\n" " :type length: int\n" " :arg count: Specifies the number of elements[float][2][3][4],
vector or matrices that are to " "be modified.\n" " :type count:int\n"  )

◆ PyDoc_STRVAR() [21/21]

PyDoc_STRVAR ( pygpu_shader_uniform_vector_int_doc ,
".. method:: uniform_vector_int(location, buffer, length, count)\n" "\n" " See GPUShader.uniform_vector_float(...) description.\n"  )

◆ pygpu_shader__tp_dealloc()

static void pygpu_shader__tp_dealloc ( BPyGPUShader * self)
static

Definition at line 818 of file gpu_py_shader.cc.

References GPU_shader_free(), and self.

◆ pygpu_shader__tp_new()

static PyObject * pygpu_shader__tp_new ( PyTypeObject * ,
PyObject * args,
PyObject * kwds )
static

◆ pygpu_shader_attr_from_name()

static PyObject * pygpu_shader_attr_from_name ( BPyGPUShader * self,
PyObject * arg )
static

Definition at line 651 of file gpu_py_shader.cc.

References GPU_shader_get_attribute(), and self.

◆ pygpu_shader_attrs_info_get()

static PyObject * pygpu_shader_attrs_info_get ( BPyGPUShader * self,
PyObject *  )
static

◆ pygpu_shader_bind()

static PyObject * pygpu_shader_bind ( BPyGPUShader * self)
static

Definition at line 162 of file gpu_py_shader.cc.

References GPU_shader_bind(), and self.

◆ pygpu_shader_create_from_info()

◆ pygpu_shader_format_calc()

static PyObject * pygpu_shader_format_calc ( BPyGPUShader * self,
PyObject *  )
static

◆ pygpu_shader_from_builtin()

◆ pygpu_shader_image()

static PyObject * pygpu_shader_image ( BPyGPUShader * self,
PyObject * args )
static

◆ pygpu_shader_name()

static PyObject * pygpu_shader_name ( BPyGPUShader * self,
void *  )
static

Definition at line 792 of file gpu_py_shader.cc.

References GPU_shader_get_name(), and self.

◆ pygpu_shader_program_get()

static PyObject * pygpu_shader_program_get ( BPyGPUShader * self,
void *  )
static

Definition at line 803 of file gpu_py_shader.cc.

References GPU_shader_get_program(), and self.

◆ pygpu_shader_unbind()

static PyObject * pygpu_shader_unbind ( BPyGPUShader * )
static

Definition at line 923 of file gpu_py_shader.cc.

References GPU_shader_unbind().

◆ pygpu_shader_uniform_block()

static PyObject * pygpu_shader_uniform_block ( BPyGPUShader * self,
PyObject * args )
static

◆ pygpu_shader_uniform_block_from_name()

static PyObject * pygpu_shader_uniform_block_from_name ( BPyGPUShader * self,
PyObject * arg )
static

Definition at line 207 of file gpu_py_shader.cc.

References GPU_shader_get_uniform_block(), and self.

◆ pygpu_shader_uniform_bool()

static PyObject * pygpu_shader_uniform_bool ( BPyGPUShader * self,
PyObject * args )
static

◆ pygpu_shader_uniform_float()

◆ pygpu_shader_uniform_from_name()

static PyObject * pygpu_shader_uniform_from_name ( BPyGPUShader * self,
PyObject * arg )
static

Definition at line 179 of file gpu_py_shader.cc.

References pygpu_shader_uniform_location_get(), and self.

◆ pygpu_shader_uniform_int()

static PyObject * pygpu_shader_uniform_int ( BPyGPUShader * self,
PyObject * args )
static

◆ pygpu_shader_uniform_location_get()

static int pygpu_shader_uniform_location_get ( GPUShader * shader,
const char * name,
const char * error_prefix )
static

◆ pygpu_shader_uniform_sampler()

static PyObject * pygpu_shader_uniform_sampler ( BPyGPUShader * self,
PyObject * args )
static

◆ pygpu_shader_uniform_vector_float()

static PyObject * pygpu_shader_uniform_vector_float ( BPyGPUShader * self,
PyObject * args )
static

◆ pygpu_shader_uniform_vector_impl()

static bool pygpu_shader_uniform_vector_impl ( PyObject * args,
int elem_size,
int * r_location,
int * r_length,
int * r_count,
Py_buffer * r_pybuffer )
static

◆ pygpu_shader_uniform_vector_int()

static PyObject * pygpu_shader_uniform_vector_int ( BPyGPUShader * self,
PyObject * args )
static

Variable Documentation

◆ BPyGPUShader_Type

◆ pygpu_shader__tp_getseters

PyGetSetDef pygpu_shader__tp_getseters[]
static
Initial value:
= {
{"program",
(setter) nullptr,
pygpu_shader_program_doc,
nullptr},
{"name", (getter)pygpu_shader_name, (setter) nullptr, pygpu_shader_name_doc, nullptr},
{nullptr, nullptr, nullptr, nullptr, nullptr}
}
static PyObject * pygpu_shader_program_get(BPyGPUShader *self, void *)
static PyObject * pygpu_shader_name(BPyGPUShader *self, void *)

Definition at line 808 of file gpu_py_shader.cc.

◆ pygpu_shader__tp_methods

PyMethodDef pygpu_shader__tp_methods[]
static

Definition at line 728 of file gpu_py_shader.cc.

◆ pygpu_shader_builtin_items

const PyC_StringEnumItems pygpu_shader_builtin_items[]
static
Initial value:
= {
{GPU_SHADER_3D_FLAT_COLOR, "FLAT_COLOR"},
{GPU_SHADER_3D_IMAGE, "IMAGE"},
{GPU_SHADER_3D_IMAGE_COLOR, "IMAGE_COLOR"},
{GPU_SHADER_3D_SMOOTH_COLOR, "SMOOTH_COLOR"},
{GPU_SHADER_3D_UNIFORM_COLOR, "UNIFORM_COLOR"},
{GPU_SHADER_3D_POLYLINE_FLAT_COLOR, "POLYLINE_FLAT_COLOR"},
{GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR, "POLYLINE_SMOOTH_COLOR"},
{GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, "POLYLINE_UNIFORM_COLOR"},
{0, nullptr},
}
@ GPU_SHADER_3D_SMOOTH_COLOR
@ GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_FLAT_COLOR
@ GPU_SHADER_3D_IMAGE
@ GPU_SHADER_3D_POLYLINE_FLAT_COLOR
@ GPU_SHADER_3D_IMAGE_COLOR

Definition at line 63 of file gpu_py_shader.cc.

Referenced by pygpu_shader_from_builtin().

◆ pygpu_shader_config_items

const PyC_StringEnumItems pygpu_shader_config_items[]
static
Initial value:
= {
{GPU_SHADER_CFG_DEFAULT, "DEFAULT"},
{GPU_SHADER_CFG_CLIPPED, "CLIPPED"},
{0, nullptr},
}
@ GPU_SHADER_CFG_DEFAULT
@ GPU_SHADER_CFG_CLIPPED

Definition at line 75 of file gpu_py_shader.cc.

Referenced by pygpu_shader_from_builtin().

◆ pygpu_shader_module__tp_methods

PyMethodDef pygpu_shader_module__tp_methods[]
static
Initial value:
= {
{"unbind", (PyCFunction)pygpu_shader_unbind, METH_NOARGS, pygpu_shader_unbind_doc},
{"from_builtin",
METH_VARARGS | METH_KEYWORDS,
pygpu_shader_from_builtin_doc},
{"create_from_info",
METH_O,
pygpu_shader_create_from_info_doc},
{nullptr, nullptr, 0, nullptr},
}
static PyObject * pygpu_shader_unbind(BPyGPUShader *)
static PyObject * pygpu_shader_create_from_info(BPyGPUShader *, BPyGPUShaderCreateInfo *o)
static PyObject * pygpu_shader_from_builtin(PyObject *, PyObject *args, PyObject *kwds)

Definition at line 1026 of file gpu_py_shader.cc.

◆ pygpu_shader_module_def

PyModuleDef pygpu_shader_module_def
static
Initial value:
= {
PyModuleDef_HEAD_INIT,
"gpu.shader",
pygpu_shader_module__tp_doc,
0,
nullptr,
nullptr,
nullptr,
nullptr,
}
static PyMethodDef pygpu_shader_module__tp_methods[]

Definition at line 1056 of file gpu_py_shader.cc.

Referenced by bpygpu_shader_init().