Blender V5.0
gpu_py_shader_create_info.cc File Reference
#include <Python.h>
#include "BLI_utildefines.h"
#include "GPU_shader.hh"
#include "intern/gpu_shader_create_info.hh"
#include "../generic/py_capi_utils.hh"
#include "../generic/python_compat.hh"
#include "gpu_py_shader.hh"
#include "gpu_py_texture.hh"

Go to the source code of this file.

Classes

struct  ShaderCreateInfo
 Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correctly provided, this is all that is needed to create and compile a blender::gpu::Shader. More...
struct  StageInterfaceInfo

Macros

#define USE_PYGPU_SHADER_INFO_IMAGE_METHOD
#define PYDOC_QUALIFIERS
#define PYDOC_TYPE_LIST
#define PYDOC_IMAGE_TYPES
#define PYDOC_TEX_FORMAT_ITEMS
#define VULKAN_LIMIT   128

Enumerations

enum class  DepthWrite
enum class  DualBlend
enum class  Frequency
enum class  ImageType
enum class  Type
enum class  Qualifier

Functions

Public API
PyObject * BPyGPUStageInterfaceInfo_CreatePyObject (GPUStageInterfaceInfo *interface)
PyObject * BPyGPUShaderCreateInfo_CreatePyObject (GPUShaderCreateInfo *info)

Variables

static const PyC_FlagSet pygpu_qualifiers []
const PyC_StringEnumItems pygpu_attrtype_items []
static const PyC_StringEnumItems pygpu_imagetype_items []
static const PyC_StringEnumItems pygpu_dualblend_items []
static const PyC_StringEnumItems pygpu_depth_write_items []
const PyC_StringEnumItems pygpu_tex_format_items []

GPUStageInterfaceInfo Methods

static 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" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg 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" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg 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" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg 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\n")
static PyObject * pygpu_interface_info_name_get (BPyGPUStageInterfaceInfo *self, void *)

GPUStageInterfaceInfo Type

PyTypeObject BPyGPUStageInterfaceInfo_Type
static PyObject * pygpu_interface_info__tp_new (PyTypeObject *, PyObject *args, PyObject *kwds)
static int pygpu_interface_info__tp_traverse (PyObject *self, visitproc visit, void *arg)
static int pygpu_interface_info__tp_clear (PyObject *self)
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" " :arg name: Name of the interface block.\n" " :type value: str\n")

GPUShaderCreateInfo Methods

static 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" " :arg slot: The attribute index.\n" " :type slot: int\n" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg 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" " :arg 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" " :arg slot: The attribute index.\n" " :type slot: int\n" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg name: Name of the attribute.\n" " :type name: str\n" " :arg 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_depth_write_doc, ".. method:: depth_write(value)\n" "\n" " Specify a depth write behavior when modifying gl_FragDepth.\n" "\n" " There is a common optimization for GPUs that relies on an early depth\n" " test to be run before the fragment shader so that the shader evaluation\n" " can be skipped if the fragment ends up being discarded because it is occluded.\n" "\n" " This optimization does not affect the final rendering, and is typically\n" " possible when the fragment does not change the depth programmatically.\n" " There are, however a class of operations on the depth in the shader which\n" " could still be performed while allowing the early depth test to operate.\n" "\n" " This function alters the behavior of the optimization to allow those operations\n" " to be performed.\n" "\n" " :arg value: Depth write value. " "It can be 'UNCHANGED' (default), 'ANY', 'GREATER' or 'LESS'.\n" " :UNCHANGED: disables depth write in a fragment shader and execution of the" "fragments can be optimized away.\n" " :ANY: enables depth write in a fragment shader for any fragments\n" " :GREATER: enables depth write in a fragment shader for depth values that" "are greater than the depth value in the output buffer.\n" " :LESS: enables depth write in a fragment shader for depth values that" "are less than the depth value in the output buffer.\n" " :type blend: str\n")
static PyObject * pygpu_shader_info_depth_write (BPyGPUShaderCreateInfo *self, PyObject *args)
 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 " ":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n" "\n" " :arg slot: The uniform variable index.\n" " :type slot: int\n" " :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" " :type type_name: str\n" " :arg 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_image_doc, ".. method:: image(slot, format, type, name, *, qualifiers={'NO_RESTRICT'})\n" "\n" " Specify an image resource used for arbitrary load and store operations.\n" "\n" " :arg slot: The image resource index.\n" " :type slot: int\n" " :arg format: The GPUTexture format that is passed to the shader. Possible " "values are:\n" "\n" PYDOC_TEX_FORMAT_ITEMS " :type format: str\n" " :arg type: The data type describing how the image is to be read in the shader. " "Possible values are:\n" "\n" PYDOC_IMAGE_TYPES "\n" " :type type: str\n" " :arg name: The image resource name.\n" " :type name: str\n" " :arg qualifiers: Set containing values that describe how the image resource is to be " "read or written. Possible values are:\n" "" PYDOC_QUALIFIERS "" " :type qualifiers: set[str]\n")
static PyObject * pygpu_shader_info_image (BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds)
 PyDoc_STRVAR (pygpu_shader_info_sampler_doc, ".. method:: sampler(slot, type, name)\n" "\n" " Specify an image texture sampler.\n" "\n" " :arg slot: The image texture sampler index.\n" " :type slot: int\n" " :arg type: The data type describing the format of each sampler unit. Possible values " "are:\n" "\n" PYDOC_IMAGE_TYPES "\n" " :type type: str\n" " :arg 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" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg name: Name of the constant.\n" " :type name: str\n" " :arg size: If not zero, indicates that the constant is an array with the specified size.\n" " :type size: int\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" " :arg source: The vertex shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n")
static PyObject * pygpu_shader_info_vertex_source (BPyGPUShaderCreateInfo *self, PyObject *o)
 PyDoc_STRVAR (pygpu_shader_info_compute_source_doc, ".. method:: compute_source(source)\n" "\n" " compute shader source code written in GLSL.\n" "\n" " Example:\n" "\n" " .. code-block:: python\n" "\n" " \"\"\"void main() {\n" " int2 index = int2(gl_GlobalInvocationID.xy);\n" " vec4 color = vec4(0.0, 0.0, 0.0, 1.0);\n" " imageStore(img_output, index, color);\n" " }\"\"\"\n" "\n" " :arg source: The compute shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n")
static PyObject * pygpu_shader_info_compute_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" " :arg source: The fragment shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://developer.blender.org/docs/features/gpu/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" " :arg 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" " :arg name: Token name.\n" " :type name: str\n" " :arg value: Text that replaces token occurrences.\n" " :type value: str\n")
static PyObject * pygpu_shader_info_define (BPyGPUShaderCreateInfo *self, PyObject *args)
 PyDoc_STRVAR (pygpu_shader_info_local_group_size_doc, ".. method:: local_group_size(x, y=1, z=1)\n" "\n" " Specify the local group size for compute shaders.\n" "\n" " :arg x: The local group size in the x dimension.\n" " :type x: int\n" " :arg y: The local group size in the y dimension. Optional. Defaults to 1.\n" " :type y: int\n" " :arg z: The local group size in the z dimension. Optional. Defaults to 1.\n" " :type z: int\n")
static PyObject * pygpu_shader_info_local_group_size (BPyGPUShaderCreateInfo *self, PyObject *args)

GPUShaderCreateInfo Initialization

PyTypeObject BPyGPUShaderCreateInfo_Type
static PyObject * pygpu_shader_info__tp_new (PyTypeObject *, PyObject *args, PyObject *kwds)
static int pygpu_shader_info__tp_traverse (PyObject *self, visitproc visit, void *arg)
static int pygpu_shader_info__tp_clear (PyObject *self)
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")

Detailed Description

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

Definition in file gpu_py_shader_create_info.cc.

Macro Definition Documentation

◆ PYDOC_IMAGE_TYPES

#define PYDOC_IMAGE_TYPES

Definition at line 85 of file gpu_py_shader_create_info.cc.

Referenced by PyDoc_STRVAR(), and PyDoc_STRVAR().

◆ PYDOC_QUALIFIERS

#define PYDOC_QUALIFIERS
Value:
" - ``NO_RESTRICT``\n" \
" - ``READ``\n" \
" - ``WRITE``\n"

Definition at line 38 of file gpu_py_shader_create_info.cc.

Referenced by PyDoc_STRVAR().

◆ PYDOC_TEX_FORMAT_ITEMS

#define PYDOC_TEX_FORMAT_ITEMS

Definition at line 175 of file gpu_py_shader_create_info.cc.

Referenced by PyDoc_STRVAR().

◆ PYDOC_TYPE_LIST

#define PYDOC_TYPE_LIST
Value:
" - ``FLOAT``\n" \
" - ``VEC2``\n" \
" - ``VEC3``\n" \
" - ``VEC4``\n" \
" - ``MAT3``\n" \
" - ``MAT4``\n" \
" - ``UINT``\n" \
" - ``UVEC2``\n" \
" - ``UVEC3``\n" \
" - ``UVEC4``\n" \
" - ``INT``\n" \
" - ``IVEC2``\n" \
" - ``IVEC3``\n" \
" - ``IVEC4``\n" \
" - ``BOOL``\n"

Definition at line 50 of file gpu_py_shader_create_info.cc.

Referenced by PyDoc_STRVAR(), PyDoc_STRVAR(), PyDoc_STRVAR(), PyDoc_STRVAR(), PyDoc_STRVAR(), and PyDoc_STRVAR().

◆ USE_PYGPU_SHADER_INFO_IMAGE_METHOD

#define USE_PYGPU_SHADER_INFO_IMAGE_METHOD

Definition at line 25 of file gpu_py_shader_create_info.cc.

◆ VULKAN_LIMIT

#define VULKAN_LIMIT   128

Enumeration Type Documentation

◆ DepthWrite

◆ DualBlend

Dual Source Blending Index.

Definition at line 596 of file gpu_shader_create_info.hh.

◆ Frequency

Maps to different descriptor sets.

Definition at line 588 of file gpu_shader_create_info.hh.

◆ ImageType

Definition at line 503 of file gpu_shader_create_info.hh.

◆ Qualifier

Definition at line 576 of file gpu_shader_create_info.hh.

◆ Type

enum class blender::gpu::shader::Type : int8_t
strong

Definition at line 79 of file GPU_common_types.hh.

Function Documentation

◆ BPyGPUShaderCreateInfo_CreatePyObject()

PyObject * BPyGPUShaderCreateInfo_CreatePyObject ( GPUShaderCreateInfo * info)
nodiscard

Definition at line 1462 of file gpu_py_shader_create_info.cc.

References BPyGPUShaderCreateInfo_Type, and self.

Referenced by pygpu_shader_info__tp_new().

◆ BPyGPUStageInterfaceInfo_CreatePyObject()

PyObject * BPyGPUStageInterfaceInfo_CreatePyObject ( GPUStageInterfaceInfo * interface)
nodiscard

◆ constant_type_size()

int constant_type_size ( Type type)
static

Definition at line 859 of file gpu_py_shader_create_info.cc.

References BLI_assert.

Referenced by constants_calc_size().

◆ constants_calc_size()

◆ PyDoc_STRVAR() [1/20]

PyDoc_STRVAR ( pygpu_interface_info__tp_doc ,
".. class:: GPUStageInterfaceInfo(name)\n" "\n" " List of varyings between shader stages.\n" "\n" " :arg name: Name of the interface block.\n" " :type value: str\n"  )

◆ PyDoc_STRVAR() [2/20]

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" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg name: name of the attribute.\n" " :type name: str\n"  )

References PYDOC_TYPE_LIST.

◆ PyDoc_STRVAR() [3/20]

PyDoc_STRVAR ( pygpu_interface_info_name_doc ,
"Name of the interface block.\n" "\n" ":type: str\n"  )

◆ PyDoc_STRVAR() [4/20]

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" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg name: name of the attribute.\n" " :type name: str\n"  )

References PYDOC_TYPE_LIST.

◆ PyDoc_STRVAR() [5/20]

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" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg name: name of the attribute.\n" " :type name: str\n"  )

References PYDOC_TYPE_LIST.

◆ PyDoc_STRVAR() [6/20]

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

PyDoc_STRVAR ( pygpu_shader_info_compute_source_doc ,
".. method:: compute_source(source)\n" "\n" " compute shader source code written in GLSL.\n" "\n" " Example:\n" "\n" " .. code-block:: python\n" "\n" " \"\"\"void main() {\n" " int2 index = int2(gl_GlobalInvocationID.xy);\n" " vec4 color = vec4(0.0, 0.0, 0.0, 1.0);\n" " imageStore(img_output, index, color);\n" " }\"\"\"\n" "\n" " :arg source: The compute shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n"  )

◆ PyDoc_STRVAR() [8/20]

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" " :arg name: Token name.\n" " :type name: str\n" " :arg value: Text that replaces token occurrences.\n" " :type value: str\n"  )

◆ PyDoc_STRVAR() [9/20]

PyDoc_STRVAR ( pygpu_shader_info_depth_write_doc ,
".. method:: depth_write(value)\n" "\n" " Specify a depth write behavior when modifying gl_FragDepth.\n" "\n" " There is a common optimization for GPUs that relies on an early depth\n" " test to be run before the fragment shader so that the shader evaluation\n" " can be skipped if the fragment ends up being discarded because it is occluded.\n" "\n" " This optimization does not affect the final rendering,
and is typically\n" " possible when the fragment does not change the depth programmatically.\n" " There are,
however a class of operations on the depth in the shader which\n" " could still be performed while allowing the early depth test to operate.\n" "\n" " This function alters the behavior of the optimization to allow those operations\n" " to be performed.\n" "\n" " :arg value:Depth write value. " "It can be 'UNCHANGED' default,
'ANY' ,
'GREATER' or 'LESS'.\n" " :UNCHANGED:disables depth write in a fragment shader and execution of the" "fragments can be optimized away.\n" " :ANY:enables depth write in a fragment shader for any fragments\n" " :GREATER:enables depth write in a fragment shader for depth values that" "are greater than the depth value in the output buffer.\n" " :LESS:enables depth write in a fragment shader for depth values that" "are less than the depth value in the output buffer.\n" " :type blend:str\n"  )

◆ PyDoc_STRVAR() [10/20]

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" " :arg slot: The attribute index.\n" " :type slot: int\n" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg name: Name of the attribute.\n" " :type name: str\n" " :arg blend: Dual Source Blending Index. It can be 'NONE' ,
'SRC_0' or 'SRC_1'.\n" " :type blend:str\n"  )

References PYDOC_TYPE_LIST.

◆ PyDoc_STRVAR() [11/20]

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" " :arg source: The fragment shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n"  )

◆ PyDoc_STRVAR() [12/20]

PyDoc_STRVAR ( pygpu_shader_info_image_doc ,
".. method:: image(slot, format, type, name, *, qualifiers={'NO_RESTRICT'})\n" "\n" " Specify an image resource used for arbitrary load and store operations.\n" "\n" " :arg slot: The image resource index.\n" " :type slot: int\n" " :arg format: The GPUTexture format that is passed to the shader. Possible " "values are:\n" "\n" PYDOC_TEX_FORMAT_ITEMS " :type format: str\n" " :arg type: The data type describing how the image is to be read in the shader. " "Possible values are:\n" "\n" PYDOC_IMAGE_TYPES "\n" " :type type: str\n" " :arg name: The image resource name.\n" " :type name: str\n" " :arg qualifiers: Set containing values that describe how the image resource is to be " "read or written. Possible values are:\n" "" PYDOC_QUALIFIERS "" " :type qualifiers: set\n" [str] )

◆ PyDoc_STRVAR() [13/20]

PyDoc_STRVAR ( pygpu_shader_info_local_group_size_doc ,
".. method:: local_group_size(x, y=1, z=1)\n" "\n" " Specify the local group size for compute shaders.\n" "\n" " :arg x: The local group size in the x dimension.\n" " :type x: int\n" " :arg y: The local group size in the y dimension. Optional. Defaults to 1.\n" " :type y: int\n" " :arg z: The local group size in the z dimension. Optional. Defaults to 1.\n" " :type z: int\n"  )

◆ PyDoc_STRVAR() [14/20]

PyDoc_STRVAR ( pygpu_shader_info_push_constant_doc ,
".. method:: push_constant(type, name, size=0)\n" "\n" " Specify a global access constant.\n" "\n" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg name: Name of the constant.\n" " :type name: str\n" " :arg size: If not zero,
indicates that the constant is an array with the specified size.\n" " :type size:int\n"  )

References PYDOC_TYPE_LIST.

◆ PyDoc_STRVAR() [15/20]

PyDoc_STRVAR ( pygpu_shader_info_sampler_doc ,
".. method:: sampler(slot, type, name)\n" "\n" " Specify an image texture sampler.\n" "\n" " :arg slot: The image texture sampler index.\n" " :type slot: int\n" " :arg type: The data type describing the format of each sampler unit. Possible values " "are:\n" "\n" PYDOC_IMAGE_TYPES "\n" " :type type: str\n" " :arg name: The image texture sampler name.\n" " :type name: str\n"  )

References PYDOC_IMAGE_TYPES.

◆ PyDoc_STRVAR() [16/20]

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" " :arg source: The source code defining types.\n" " :type source: str\n"  )

◆ PyDoc_STRVAR() [17/20]

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 " ":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n" "\n" " :arg slot: The uniform variable index.\n" " :type slot: int\n" " :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" " :type type_name: str\n" " :arg name: The uniform variable name.\n" " :type name: str\n"  )

◆ PyDoc_STRVAR() [18/20]

PyDoc_STRVAR ( pygpu_shader_info_vertex_in_doc ,
".. method:: vertex_in(slot, type, name)\n" "\n" " Add a vertex shader input attribute.\n" "\n" " :arg slot: The attribute index.\n" " :type slot: int\n" " :arg type: One of these types:\n" "\n" PYDOC_TYPE_LIST "\n" " :type type: str\n" " :arg name: name of the attribute.\n" " :type name: str\n"  )

References PYDOC_TYPE_LIST.

◆ PyDoc_STRVAR() [19/20]

PyDoc_STRVAR ( pygpu_shader_info_vertex_out_doc ,
".. method:: vertex_out(interface)\n" "\n" " Add a vertex shader output interface block.\n" "\n" " :arg interface: Object describing the block.\n" " :type interface: :class:`gpu.types.GPUStageInterfaceInfo`\n"  )

◆ PyDoc_STRVAR() [20/20]

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" " :arg source: The vertex shader source code.\n" " :type source: str\n" "\n" " .. seealso:: `GLSL Cross Compilation " "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n"  )

◆ pygpu_interface_info__tp_clear()

int pygpu_interface_info__tp_clear ( PyObject * self)
static

◆ pygpu_interface_info__tp_dealloc()

void pygpu_interface_info__tp_dealloc ( PyObject * self)
static

◆ pygpu_interface_info__tp_new()

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

◆ pygpu_interface_info__tp_traverse()

int pygpu_interface_info__tp_traverse ( PyObject * self,
visitproc visit,
void * arg )
static

Definition at line 407 of file gpu_py_shader_create_info.cc.

References BPyGPUStageInterfaceInfo::references, and self.

◆ pygpu_interface_info_flat()

PyObject * pygpu_interface_info_flat ( BPyGPUStageInterfaceInfo * self,
PyObject * args )
static

Definition at line 292 of file gpu_py_shader_create_info.cc.

References interface, name, pygpu_interface_info_get_args(), and self.

◆ pygpu_interface_info_get_args()

bool pygpu_interface_info_get_args ( BPyGPUStageInterfaceInfo * self,
PyObject * args,
const char * format,
Type * r_type,
const char ** r_name )
static

◆ pygpu_interface_info_name_get()

PyObject * pygpu_interface_info_name_get ( BPyGPUStageInterfaceInfo * self,
void *  )
static

Definition at line 357 of file gpu_py_shader_create_info.cc.

References interface, PyC_UnicodeFromStdStr(), and self.

◆ pygpu_interface_info_no_perspective()

PyObject * pygpu_interface_info_no_perspective ( BPyGPUStageInterfaceInfo * self,
PyObject * args )
static

Definition at line 318 of file gpu_py_shader_create_info.cc.

References interface, name, pygpu_interface_info_get_args(), and self.

◆ pygpu_interface_info_smooth()

PyObject * pygpu_interface_info_smooth ( BPyGPUStageInterfaceInfo * self,
PyObject * args )
static

Definition at line 266 of file gpu_py_shader_create_info.cc.

References interface, name, pygpu_interface_info_get_args(), and self.

◆ pygpu_shader_info__tp_clear()

◆ pygpu_shader_info__tp_dealloc()

◆ pygpu_shader_info__tp_new()

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

◆ pygpu_shader_info__tp_traverse()

int pygpu_shader_info__tp_traverse ( PyObject * self,
visitproc visit,
void * arg )
static

◆ pygpu_shader_info_compute_source()

PyObject * pygpu_shader_info_compute_source ( BPyGPUShaderCreateInfo * self,
PyObject * o )
static

◆ pygpu_shader_info_define()

PyObject * pygpu_shader_info_define ( BPyGPUShaderCreateInfo * self,
PyObject * args )
static

◆ pygpu_shader_info_depth_write()

PyObject * pygpu_shader_info_depth_write ( BPyGPUShaderCreateInfo * self,
PyObject * args )
static

◆ pygpu_shader_info_fragment_out()

PyObject * pygpu_shader_info_fragment_out ( BPyGPUShaderCreateInfo * self,
PyObject * args,
PyObject * kwds )
static

◆ pygpu_shader_info_fragment_source()

PyObject * pygpu_shader_info_fragment_source ( BPyGPUShaderCreateInfo * self,
PyObject * o )
static

◆ pygpu_shader_info_image()

◆ pygpu_shader_info_local_group_size()

PyObject * pygpu_shader_info_local_group_size ( BPyGPUShaderCreateInfo * self,
PyObject * args )
static

◆ pygpu_shader_info_push_constant()

◆ pygpu_shader_info_sampler()

PyObject * pygpu_shader_info_sampler ( BPyGPUShaderCreateInfo * self,
PyObject * args )
static

◆ pygpu_shader_info_typedef_source()

◆ pygpu_shader_info_uniform_buf()

PyObject * pygpu_shader_info_uniform_buf ( BPyGPUShaderCreateInfo * self,
PyObject * args )
static

◆ pygpu_shader_info_vertex_in()

PyObject * pygpu_shader_info_vertex_in ( BPyGPUShaderCreateInfo * self,
PyObject * args )
static

◆ pygpu_shader_info_vertex_out()

◆ pygpu_shader_info_vertex_source()

PyObject * pygpu_shader_info_vertex_source ( BPyGPUShaderCreateInfo * self,
PyObject * o )
static

Variable Documentation

◆ BPyGPUShaderCreateInfo_Type

PyTypeObject BPyGPUShaderCreateInfo_Type

◆ BPyGPUStageInterfaceInfo_Type

PyTypeObject BPyGPUStageInterfaceInfo_Type

◆ pygpu_attrtype_items

const PyC_StringEnumItems pygpu_attrtype_items[]
Initial value:
= {
{int(Type::float_t), "FLOAT"},
{int(Type::float2_t), "VEC2"},
{int(Type::float3_t), "VEC3"},
{int(Type::float4_t), "VEC4"},
{int(Type::float3x3_t), "MAT3"},
{int(Type::float4x4_t), "MAT4"},
{int(Type::uint_t), "UINT"},
{int(Type::uint2_t), "UVEC2"},
{int(Type::uint3_t), "UVEC3"},
{int(Type::uint4_t), "UVEC4"},
{int(Type::int_t), "INT"},
{int(Type::int2_t), "IVEC2"},
{int(Type::int3_t), "IVEC3"},
{int(Type::int4_t), "IVEC4"},
{int(Type::bool_t), "BOOL"},
{0, nullptr},
}

Definition at line 66 of file gpu_py_shader_create_info.cc.

Referenced by pygpu_interface_info_get_args(), pygpu_shader_attrs_info_get(), pygpu_shader_info_fragment_out(), pygpu_shader_info_push_constant(), and pygpu_shader_info_vertex_in().

◆ pygpu_depth_write_items

const PyC_StringEnumItems pygpu_depth_write_items[]
static
Initial value:
= {
{int(DepthWrite::UNCHANGED), "UNCHANGED"},
{int(DepthWrite::ANY), "ANY"},
{int(DepthWrite::GREATER), "GREATER"},
{int(DepthWrite::LESS), "LESS"},
{0, nullptr},
}

Definition at line 167 of file gpu_py_shader_create_info.cc.

Referenced by pygpu_shader_info_depth_write().

◆ pygpu_dualblend_items

const PyC_StringEnumItems pygpu_dualblend_items[]
static
Initial value:
= {
{int(DualBlend::NONE), "NONE"},
{int(DualBlend::SRC_0), "SRC_0"},
{int(DualBlend::SRC_1), "SRC_1"},
{0, nullptr},
}

Definition at line 160 of file gpu_py_shader_create_info.cc.

Referenced by pygpu_shader_info_fragment_out().

◆ pygpu_imagetype_items

const PyC_StringEnumItems pygpu_imagetype_items[]
static

◆ pygpu_interface_info__tp_getseters

PyGetSetDef pygpu_interface_info__tp_getseters[]
static
Initial value:
= {
{"name",
(setter) nullptr,
pygpu_interface_info_name_doc,
nullptr},
{nullptr, nullptr, nullptr, nullptr, nullptr}
}
static PyObject * pygpu_interface_info_name_get(BPyGPUStageInterfaceInfo *self, void *)

Definition at line 363 of file gpu_py_shader_create_info.cc.

◆ pygpu_interface_info__tp_methods

PyMethodDef pygpu_interface_info__tp_methods[]
static
Initial value:
= {
{"smooth",
METH_VARARGS,
pygpu_interface_info_smooth_doc},
{"flat", (PyCFunction)pygpu_interface_info_flat, METH_VARARGS, pygpu_interface_info_flat_doc},
{"no_perspective",
METH_VARARGS,
pygpu_interface_info_no_perspective_doc},
{nullptr, nullptr, 0, nullptr},
}
static PyObject * pygpu_interface_info_smooth(BPyGPUStageInterfaceInfo *self, PyObject *args)
static PyObject * pygpu_interface_info_no_perspective(BPyGPUStageInterfaceInfo *self, PyObject *args)
static PyObject * pygpu_interface_info_flat(BPyGPUStageInterfaceInfo *self, PyObject *args)

Definition at line 332 of file gpu_py_shader_create_info.cc.

◆ pygpu_qualifiers

const PyC_FlagSet pygpu_qualifiers[]
static
Initial value:
= {
{int(Qualifier::no_restrict), "NO_RESTRICT"},
{int(Qualifier::read), "READ"},
{int(Qualifier::write), "WRITE"},
{0, nullptr},
}

Definition at line 42 of file gpu_py_shader_create_info.cc.

Referenced by pygpu_shader_info_image().

◆ pygpu_shader_info__tp_methods

PyMethodDef pygpu_shader_info__tp_methods[]
static

Definition at line 1247 of file gpu_py_shader_create_info.cc.

◆ pygpu_tex_format_items

const PyC_StringEnumItems pygpu_tex_format_items[]
extern