Blender  V2.93
gpu_py_shader.c File Reference
#include <Python.h>
#include "BLI_utildefines.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
#include "GPU_uniform_buffer.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
#include "../mathutils/mathutils.h"
#include "gpu_py.h"
#include "gpu_py_texture.h"
#include "gpu_py_uniformbuffer.h"
#include "gpu_py_vertex_format.h"
#include "gpu_py_shader.h"

Go to the source code of this file.

Functions

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

Enum Conversion.

static const struct PyC_StringEnumItems pygpu_shader_builtin_items []
 
static int pygpu_shader_uniform_location_get (GPUShader *shader, const char *name, const char *error_prefix)
 

Shader Type

static struct PyMethodDef pygpu_shader__tp_methods []
 
static PyGetSetDef pygpu_shader__tp_getseters []
 
PyTypeObject BPyGPUShader_Type
 
static PyObject * pygpu_shader__tp_new (PyTypeObject *UNUSED(type), 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" " :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 * 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" " :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 * 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" " :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 of floats\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 * 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, 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: sequence of bools\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" " :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: single number or sequence of numbers\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" " :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: sequence of numbers\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" " :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 * pygpu_shader_uniform_sampler (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" " :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 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" " :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 * pygpu_shader_attr_from_name (BPyGPUShader *self, PyObject *arg)
 
 PyDoc_STRVAR (pygpu_shader_calc_format_doc, ".. method:: calc_format()\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_calc_format (BPyGPUShader *self, PyObject *UNUSED(arg))
 
 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 *UNUSED(closure))
 
static void pygpu_shader__tp_dealloc (BPyGPUShader *self)
 
 PyDoc_STRVAR (pygpu_shader__tp_doc, ".. class:: GPUShader(vertexcode, fragcode, geocode=None, libcode=None, defines=None)\n" "\n" " GPUShader combines multiple GLSL shaders into a program used for drawing.\n" " It must contain a vertex and fragment shaders, with an optional geometry shader.\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" " :param vertexcode: Vertex shader code.\n" " :type vertexcode: str\n" " :param fragcode: Fragment shader code.\n" " :type value: str\n" " :param geocode: Geometry shader code.\n" " :type value: str\n" " :param libcode: Code with functions and presets to be shared between shaders.\n" " :type value: str\n" " :param defines: Preprocessor directives.\n" " :type value: str\n")
 

gpu.shader Module API

static struct 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 *UNUSED(self))
 
 PyDoc_STRVAR (pygpu_shader_from_builtin_doc, ".. function:: from_builtin(pygpu_shader_name)\n" "\n" " Shaders that are embedded in the blender internal code.\n" " They all read the uniform ``mat4 ModelViewProjectionMatrix``,\n" " which can be edited by the :mod:`gpu.matrix` module.\n" " For more details, you can check the shader code with the\n" " :func:`gpu.shader.code_from_builtin` function.\n" "\n" " :param pygpu_shader_name: One of these builtin shader names:\n\n" " - ``2D_UNIFORM_COLOR``\n" " - ``2D_FLAT_COLOR``\n" " - ``2D_SMOOTH_COLOR``\n" " - ``2D_IMAGE``\n" " - ``3D_UNIFORM_COLOR``\n" " - ``3D_FLAT_COLOR``\n" " - ``3D_SMOOTH_COLOR``\n" " :type pygpu_shader_name: str\n" " :return: Shader object corresponding to the given name.\n" " :rtype: :class:`bpy.types.GPUShader`\n")
 
static PyObject * pygpu_shader_from_builtin (PyObject *UNUSED(self), PyObject *arg)
 
 PyDoc_STRVAR (pygpu_shader_code_from_builtin_doc, ".. function:: code_from_builtin(pygpu_shader_name)\n" "\n" " Exposes the internal shader code for query.\n" "\n" " :param pygpu_shader_name: One of these builtin shader names:\n\n" " - ``2D_UNIFORM_COLOR``\n" " - ``2D_FLAT_COLOR``\n" " - ``2D_SMOOTH_COLOR``\n" " - ``2D_IMAGE``\n" " - ``3D_UNIFORM_COLOR``\n" " - ``3D_FLAT_COLOR``\n" " - ``3D_SMOOTH_COLOR``\n" " :type pygpu_shader_name: str\n" " :return: Vertex, fragment and geometry shader codes.\n" " :rtype: dict\n")
 
static PyObject * pygpu_shader_code_from_builtin (BPyGPUShader *UNUSED(self), PyObject *arg)
 
 PyDoc_STRVAR (pygpu_shader_module__tp_doc, "This module provides access to GPUShader internal functions.\n" "\n" ".. rubric:: Built-in shaders\n" "\n" "All built-in shaders have the ``mat4 ModelViewProjectionMatrix`` uniform.\n" "The value of it can only be modified using the :class:`gpu.matrix` module.\n" "\n" "2D_UNIFORM_COLOR\n" " :Attributes: vec3 pos\n" " :Uniforms: vec4 color\n" "2D_FLAT_COLOR\n" " :Attributes: vec3 pos, vec4 color\n" " :Uniforms: none\n" "2D_SMOOTH_COLOR\n" " :Attributes: vec3 pos, vec4 color\n" " :Uniforms: none\n" "2D_IMAGE\n" " :Attributes: vec3 pos, vec2 texCoord\n" " :Uniforms: sampler2D image\n" "3D_UNIFORM_COLOR\n" " :Attributes: vec3 pos\n" " :Uniforms: vec4 color\n" "3D_FLAT_COLOR\n" " :Attributes: vec3 pos, vec4 color\n" " :Uniforms: none\n" "3D_SMOOTH_COLOR\n" " :Attributes: vec3 pos, vec4 color\n" " :Uniforms: none\n")
 

Detailed Description

Definition in file gpu_py_shader.c.

Function Documentation

◆ bpygpu_shader_init()

PyObject* bpygpu_shader_init ( void  )

Definition at line 848 of file gpu_py_shader.c.

References pygpu_shader_module_def.

Referenced by BPyInit_gpu().

◆ BPyGPUShader_CreatePyObject()

PyObject* BPyGPUShader_CreatePyObject ( GPUShader shader,
bool  is_builtin 
)

Definition at line 837 of file gpu_py_shader.c.

References BPyGPUShader_Type, and shader().

Referenced by pygpu_shader__tp_new(), and pygpu_shader_from_builtin().

◆ PyDoc_STRVAR() [1/18]

PyDoc_STRVAR ( pygpu_shader__tp_doc  ,
".. class:: GPUShader(vertexcode, fragcode, geocode=None, libcode=None, defines=None)\n" "\n" " GPUShader combines multiple GLSL shaders into a program used for drawing.\n" " It must contain a vertex and fragment  shaders,
with an optional geometry shader.\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 
)

◆ PyDoc_STRVAR() [2/18]

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

◆ PyDoc_STRVAR() [3/18]

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() [4/18]

PyDoc_STRVAR ( pygpu_shader_calc_format_doc  ,
".. method:: calc_format()\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() [5/18]

PyDoc_STRVAR ( pygpu_shader_code_from_builtin_doc  ,
".. function:: code_from_builtin(pygpu_shader_name)\n" "\n" " Exposes the internal shader code for query.\n" "\n" " :param pygpu_shader_name: One of these builtin shader names:\n\n" " - ``2D_UNIFORM_COLOR``\n" " - ``2D_FLAT_COLOR``\n" " - ``2D_SMOOTH_COLOR``\n" " - ``2D_IMAGE``\n" " - ``3D_UNIFORM_COLOR``\n" " - ``3D_FLAT_COLOR``\n" " - ``3D_SMOOTH_COLOR``\n" " :type pygpu_shader_name: str\n" " :return:  Vertex,
fragment and geometry shader codes.\n" " :rtype:dict\n"   
)

◆ PyDoc_STRVAR() [6/18]

PyDoc_STRVAR ( pygpu_shader_from_builtin_doc  ,
".. function:: from_builtin(pygpu_shader_name)\n" "\n" " Shaders that are embedded in the blender internal code.\n" " They all read the uniform ``mat4 ModelViewProjectionMatrix``  ,
\n" " which can be edited by the :mod:`gpu.matrix` module.\n" " For more  details,
you can check the shader code with the\n" " :func:`gpu.shader.code_from_builtin` function.\n" "\n" " :param pygpu_shader_name:One of these builtin shader names:\n\n" " - ``2D_UNIFORM_COLOR``\n" " - ``2D_FLAT_COLOR``\n" " - ``2D_SMOOTH_COLOR``\n" " - ``2D_IMAGE``\n" " - ``3D_UNIFORM_COLOR``\n" " - ``3D_FLAT_COLOR``\n" " - ``3D_SMOOTH_COLOR``\n" " :type pygpu_shader_name:str\n" " :return:Shader object corresponding to the given name.\n" " :rtype::class:`bpy.types.GPUShader`\n"   
)

◆ PyDoc_STRVAR() [7/18]

PyDoc_STRVAR ( pygpu_shader_module__tp_doc  ,
"This module provides access to GPUShader internal functions.\n" "\n" ".. rubric:: Built-in shaders\n" "\n" "All built-in shaders have the ``mat4 ModelViewProjectionMatrix`` uniform.\n" "The value of it can only be modified using the :class:`gpu.matrix` module.\n" "\n" "2D_UNIFORM_COLOR\n" " :Attributes: vec3 pos\n" " :Uniforms: vec4 color\n" "2D_FLAT_COLOR\n" " :Attributes: vec3  pos,
vec4 color\n" " :Uniforms:none\n" "2D_SMOOTH_COLOR\n" " :Attributes:vec3  pos,
vec4 color\n" " :Uniforms:none\n" "2D_IMAGE\n" " :Attributes:vec3  pos,
vec2 texCoord\n" " :Uniforms:sampler2D image\n" "3D_UNIFORM_COLOR\n" " :Attributes:vec3 pos\n" " :Uniforms:vec4 color\n" "3D_FLAT_COLOR\n" " :Attributes:vec3  pos,
vec4 color\n" " :Uniforms:none\n" "3D_SMOOTH_COLOR\n" " :Attributes:vec3  pos,
vec4 color\n" " :Uniforms:none\n"   
)

◆ PyDoc_STRVAR() [8/18]

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() [9/18]

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

◆ PyDoc_STRVAR() [10/18]

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" " :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 texture: :class:`gpu.types.GPUUniformBuf`\n"   
)

◆ PyDoc_STRVAR() [11/18]

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

◆ PyDoc_STRVAR() [12/18]

PyDoc_STRVAR ( pygpu_shader_uniform_bool_doc  ,
".. method:: uniform_bool(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: sequence of bools\n"   
)

◆ PyDoc_STRVAR() [13/18]

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: single number or sequence of numbers\n"   
)

◆ PyDoc_STRVAR() [14/18]

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

◆ PyDoc_STRVAR() [15/18]

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: sequence of numbers\n"   
)

◆ PyDoc_STRVAR() [16/18]

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

◆ PyDoc_STRVAR() [17/18]

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 of floats\n" " :param 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" " :param count: Specifies the number of  elements[2][3][4],
vector or matrices that are to " "be modified.\n" " :type count:int\n"   
)

◆ PyDoc_STRVAR() [18/18]

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 632 of file gpu_py_shader.c.

References GPU_shader_free(), and self.

◆ pygpu_shader__tp_new()

static PyObject* pygpu_shader__tp_new ( PyTypeObject *  UNUSEDtype,
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 539 of file gpu_py_shader.c.

References GPU_shader_get_attribute(), NULL, and self.

◆ pygpu_shader_bind()

static PyObject* pygpu_shader_bind ( BPyGPUShader self)
static

Definition at line 121 of file gpu_py_shader.c.

References GPU_shader_bind(), and self.

◆ pygpu_shader_calc_format()

static PyObject* pygpu_shader_calc_format ( BPyGPUShader self,
PyObject *  UNUSEDarg 
)
static

Definition at line 563 of file gpu_py_shader.c.

◆ pygpu_shader_code_from_builtin()

static PyObject* pygpu_shader_code_from_builtin ( BPyGPUShader UNUSEDself,
PyObject *  arg 
)
static

◆ pygpu_shader_from_builtin()

static PyObject* pygpu_shader_from_builtin ( PyObject *  UNUSEDself,
PyObject *  arg 
)
static

◆ pygpu_shader_program_get()

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

Definition at line 622 of file gpu_py_shader.c.

References GPU_shader_get_program(), and self.

◆ pygpu_shader_unbind()

static PyObject* pygpu_shader_unbind ( BPyGPUShader UNUSEDself)
static

Definition at line 690 of file gpu_py_shader.c.

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 163 of file gpu_py_shader.c.

References GPU_shader_get_uniform_block(), NULL, and self.

◆ pygpu_shader_uniform_bool()

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

◆ pygpu_shader_uniform_float()

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

◆ pygpu_shader_uniform_from_name()

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

Definition at line 136 of file gpu_py_shader.c.

References NULL, 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

Definition at line 180 of file gpu_py_shader.c.

References buffer.

Referenced by pygpu_shader_uniform_vector_float(), and pygpu_shader_uniform_vector_int().

◆ pygpu_shader_uniform_vector_int()

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

Variable Documentation

◆ BPyGPUShader_Type

PyTypeObject BPyGPUShader_Type
Initial value:
= {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUShader",
.tp_basicsize = sizeof(BPyGPUShader),
.tp_dealloc = (destructor)pygpu_shader__tp_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = pygpu_shader__tp_doc,
.tp_methods = pygpu_shader__tp_methods,
}
static PyObject * pygpu_shader__tp_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
Definition: gpu_py_shader.c:78
static struct PyMethodDef pygpu_shader__tp_methods[]
static void pygpu_shader__tp_dealloc(BPyGPUShader *self)
static PyGetSetDef pygpu_shader__tp_getseters[]
struct BPyGPUShader BPyGPUShader

Definition at line 669 of file gpu_py_shader.c.

Referenced by bpygpu_types_init(), BPyGPUShader_CreatePyObject(), and pygpu_batch_draw().

◆ pygpu_shader__tp_getseters

PyGetSetDef pygpu_shader__tp_getseters[]
static
Initial value:
= {
{"program", (getter)pygpu_shader_program_get, (setter)NULL, pygpu_shader_program_doc, NULL},
}
static PyObject * pygpu_shader_program_get(BPyGPUShader *self, void *UNUSED(closure))

Definition at line 627 of file gpu_py_shader.c.

◆ pygpu_shader__tp_methods

struct PyMethodDef pygpu_shader__tp_methods[]
static

Definition at line 563 of file gpu_py_shader.c.

◆ pygpu_shader_builtin_items

const struct PyC_StringEnumItems pygpu_shader_builtin_items[]
static
Initial value:
= {
{GPU_SHADER_2D_UNIFORM_COLOR, "2D_UNIFORM_COLOR"},
{GPU_SHADER_2D_FLAT_COLOR, "2D_FLAT_COLOR"},
{GPU_SHADER_2D_SMOOTH_COLOR, "2D_SMOOTH_COLOR"},
{GPU_SHADER_2D_IMAGE, "2D_IMAGE"},
{GPU_SHADER_3D_UNIFORM_COLOR, "3D_UNIFORM_COLOR"},
{GPU_SHADER_3D_FLAT_COLOR, "3D_FLAT_COLOR"},
{GPU_SHADER_3D_SMOOTH_COLOR, "3D_SMOOTH_COLOR"},
{GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, "3D_POLYLINE_UNIFORM_COLOR"},
{0, NULL},
}
@ GPU_SHADER_3D_SMOOTH_COLOR
Definition: GPU_shader.h:215
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
Definition: GPU_shader.h:223
@ GPU_SHADER_2D_SMOOTH_COLOR
Definition: GPU_shader.h:185
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:171
@ GPU_SHADER_3D_UNIFORM_COLOR
Definition: GPU_shader.h:200
@ GPU_SHADER_3D_FLAT_COLOR
Definition: GPU_shader.h:208
@ GPU_SHADER_2D_IMAGE
Definition: GPU_shader.h:186
@ GPU_SHADER_2D_FLAT_COLOR
Definition: GPU_shader.h:178

Definition at line 1 of file gpu_py_shader.c.

Referenced by pygpu_shader_code_from_builtin(), and pygpu_shader_from_builtin().

◆ pygpu_shader_module__tp_methods

struct PyMethodDef pygpu_shader_module__tp_methods[]
static
Initial value:
= {
{"unbind", (PyCFunction)pygpu_shader_unbind, METH_NOARGS, pygpu_shader_unbind_doc},
{"from_builtin",
METH_O,
pygpu_shader_from_builtin_doc},
{"code_from_builtin",
METH_O,
pygpu_shader_code_from_builtin_doc},
{NULL, NULL, 0, NULL},
}
static PyObject * pygpu_shader_from_builtin(PyObject *UNUSED(self), PyObject *arg)
static PyObject * pygpu_shader_unbind(BPyGPUShader *UNUSED(self))
static PyObject * pygpu_shader_code_from_builtin(BPyGPUShader *UNUSED(self), PyObject *arg)

Definition at line 746 of file gpu_py_shader.c.

◆ pygpu_shader_module_def

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

Definition at line 824 of file gpu_py_shader.c.

Referenced by bpygpu_shader_init().