27#define USE_PYGPU_SHADER_INFO_IMAGE_METHOD
33using gpu::shader::ShaderCreateInfo;
34using gpu::shader::StageInterfaceInfo;
37#ifdef USE_PYGPU_SHADER_INFO_IMAGE_METHOD
40# define PYDOC_QUALIFIERS_LITERAL "Literal['NO_RESTRICT', 'READ', 'WRITE']"
42 {int(Qualifier::no_restrict),
"NO_RESTRICT"},
43 {int(Qualifier::read),
"READ"},
44 {int(Qualifier::write),
"WRITE"},
49#define PYDOC_TYPE_LITERAL \
67 {int(Type::float_t),
"FLOAT"},
68 {int(Type::float2_t),
"VEC2"},
69 {int(Type::float3_t),
"VEC3"},
70 {int(Type::float4_t),
"VEC4"},
71 {int(Type::float3x3_t),
"MAT3"},
72 {int(Type::float4x4_t),
"MAT4"},
73 {int(Type::uint_t),
"UINT"},
74 {int(Type::uint2_t),
"UVEC2"},
75 {int(Type::uint3_t),
"UVEC3"},
76 {int(Type::uint4_t),
"UVEC4"},
77 {int(Type::int_t),
"INT"},
78 {int(Type::int2_t),
"IVEC2"},
79 {int(Type::int3_t),
"IVEC3"},
80 {int(Type::int4_t),
"IVEC4"},
81 {int(Type::bool_t),
"BOOL"},
85#define PYDOC_IMAGE_TYPES_LITERAL \
89 "'FLOAT_1D_ARRAY', " \
91 "'FLOAT_2D_ARRAY', " \
94 "'FLOAT_CUBE_ARRAY', " \
102 "'INT_CUBE_ARRAY', " \
105 "'UINT_1D_ARRAY', " \
107 "'UINT_2D_ARRAY', " \
110 "'UINT_CUBE_ARRAY', " \
112 "'SHADOW_2D_ARRAY', " \
114 "'SHADOW_CUBE_ARRAY', " \
116 "'DEPTH_2D_ARRAY', " \
118 "'DEPTH_CUBE_ARRAY']"
120 {int(ImageType::FloatBuffer),
"FLOAT_BUFFER"},
121 {int(ImageType::Float1D),
"FLOAT_1D"},
122 {int(ImageType::Float1DArray),
"FLOAT_1D_ARRAY"},
123 {int(ImageType::Float2D),
"FLOAT_2D"},
124 {int(ImageType::Float2DArray),
"FLOAT_2D_ARRAY"},
125 {int(ImageType::Float3D),
"FLOAT_3D"},
126 {int(ImageType::FloatCube),
"FLOAT_CUBE"},
127 {int(ImageType::FloatCubeArray),
"FLOAT_CUBE_ARRAY"},
128 {int(ImageType::IntBuffer),
"INT_BUFFER"},
129 {int(ImageType::Int1D),
"INT_1D"},
130 {int(ImageType::Int1DArray),
"INT_1D_ARRAY"},
131 {int(ImageType::Int2D),
"INT_2D"},
132 {int(ImageType::Int2DArray),
"INT_2D_ARRAY"},
133 {int(ImageType::Int3D),
"INT_3D"},
134 {int(ImageType::IntCube),
"INT_CUBE"},
135 {int(ImageType::IntCubeArray),
"INT_CUBE_ARRAY"},
136 {int(ImageType::AtomicInt2D),
"INT_2D_ATOMIC"},
137 {int(ImageType::AtomicInt2DArray),
"INT_2D_ARRAY_ATOMIC"},
138 {int(ImageType::AtomicInt3D),
"INT_3D_ATOMIC"},
139 {int(ImageType::UintBuffer),
"UINT_BUFFER"},
140 {int(ImageType::Uint1D),
"UINT_1D"},
141 {int(ImageType::Uint1DArray),
"UINT_1D_ARRAY"},
142 {int(ImageType::Uint2D),
"UINT_2D"},
143 {int(ImageType::Uint2DArray),
"UINT_2D_ARRAY"},
144 {int(ImageType::Uint3D),
"UINT_3D"},
145 {int(ImageType::UintCube),
"UINT_CUBE"},
146 {int(ImageType::UintCubeArray),
"UINT_CUBE_ARRAY"},
147 {int(ImageType::AtomicUint2D),
"UINT_2D_ATOMIC"},
148 {int(ImageType::AtomicUint2DArray),
"UINT_2D_ARRAY_ATOMIC"},
149 {int(ImageType::AtomicUint3D),
"UINT_3D_ATOMIC"},
150 {int(ImageType::Shadow2D),
"SHADOW_2D"},
151 {int(ImageType::Shadow2DArray),
"SHADOW_2D_ARRAY"},
152 {int(ImageType::ShadowCube),
"SHADOW_CUBE"},
153 {int(ImageType::ShadowCubeArray),
"SHADOW_CUBE_ARRAY"},
154 {int(ImageType::Depth2D),
"DEPTH_2D"},
155 {int(ImageType::Depth2DArray),
"DEPTH_2D_ARRAY"},
156 {int(ImageType::DepthCube),
"DEPTH_CUBE"},
157 {int(ImageType::DepthCubeArray),
"DEPTH_CUBE_ARRAY"},
162 {int(DualBlend::NONE),
"NONE"},
163 {int(DualBlend::SRC_0),
"SRC_0"},
164 {int(DualBlend::SRC_1),
"SRC_1"},
169 {int(DepthWrite::UNCHANGED),
"UNCHANGED"},
170 {int(DepthWrite::ANY),
"ANY"},
171 {int(DepthWrite::GREATER),
"GREATER"},
172 {int(DepthWrite::LESS),
"LESS"},
176#define PYDOC_TEX_FORMAT_LITERAL \
208 "'R11F_G11F_B10F', " \
209 "'DEPTH32F_STENCIL8', " \
210 "'DEPTH24_STENCIL8', " \
213 "'SRGB8_A8_DXT1', " \
214 "'SRGB8_A8_DXT3', " \
215 "'SRGB8_A8_DXT5', " \
219 "'DEPTH_COMPONENT32F', " \
220 "'DEPTH_COMPONENT24', " \
221 "'DEPTH_COMPONENT16']"
241 const char *name = PyUnicode_AsUTF8(py_name);
242 if (name ==
nullptr) {
246#ifdef USE_GPU_PY_REFERENCES
257 pygpu_interface_info_smooth_doc,
258 ".. method:: smooth(type, name)\n"
260 " Add an attribute with qualifier of type *smooth* to the interface block.\n"
262 " :param type: The data type of the attribute.\n"
265 " :param name: name of the attribute.\n"
266 " :type name: str\n");
283 interface->
smooth(type, name);
289 pygpu_interface_info_flat_doc,
290 ".. method:: flat(type, name)\n"
292 " Add an attribute with qualifier of type ``flat`` to the interface block.\n"
294 " :param type: The data type of the attribute.\n"
297 " :param name: name of the attribute.\n"
298 " :type name: str\n");
315 interface->
flat(type, name);
321 pygpu_interface_info_no_perspective_doc,
322 ".. method:: no_perspective(type, name)\n"
324 " Add an attribute with qualifier of type ``no_perspective`` to the interface block.\n"
326 " :param type: The data type of the attribute.\n"
329 " :param name: name of the attribute.\n"
330 " :type name: str\n");
356 pygpu_interface_info_smooth_doc},
360 pygpu_interface_info_flat_doc},
364 pygpu_interface_info_no_perspective_doc},
365 {
nullptr,
nullptr, 0,
nullptr},
376 pygpu_interface_info_name_doc,
377 "Name of the interface block.\n"
389 static_cast<setter
>(
nullptr),
390 pygpu_interface_info_name_doc,
392 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
406 PyErr_SetString(PyExc_TypeError,
"no keywords are expected");
411 if (!PyArg_ParseTuple(args,
413 ":GPUStageInterfaceInfo.__new__*",
420 GPUStageInterfaceInfo *interface_info =
reinterpret_cast<GPUStageInterfaceInfo *
>(interface);
424#ifdef USE_GPU_PY_REFERENCES
425 PyObject *py_name = PyTuple_GET_ITEM(args, 0);
432#ifdef USE_GPU_PY_REFERENCES
456#ifdef USE_GPU_PY_REFERENCES
457 PyObject_GC_UnTrack(self);
464 Py_TYPE(self)->tp_free(self);
469 pygpu_interface_info__tp_doc,
470 ".. class:: GPUStageInterfaceInfo\n"
472 " List of varyings between shader stages.\n"
474 " .. method:: __init__(name)\n"
476 " :param name: Name of the interface block.\n"
477 " :type name: str\n");
479 PyVarObject_HEAD_INIT(
nullptr, 0)
480 "GPUStageInterfaceInfo",
499 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
503 pygpu_interface_info__tp_doc,
550 pygpu_shader_info_vertex_in_doc,
551 ".. method:: vertex_in(slot, type, name)\n"
553 " Add a vertex shader input attribute.\n"
555 " :param slot: The attribute index.\n"
557 " :param type: The data type of the attribute.\n"
560 " :param name: name of the attribute.\n"
561 " :type name: str\n");
568 if (!PyArg_ParseTuple(args,
581#ifdef USE_GPU_PY_REFERENCES
582 PyObject *py_name = PyTuple_GET_ITEM(args, 2);
593 pygpu_shader_info_vertex_out_doc,
594 ".. method:: vertex_out(interface)\n"
596 " Add a vertex shader output interface block.\n"
598 " :param interface: Object describing the block.\n"
599 " :type interface: :class:`gpu.types.GPUStageInterfaceInfo`\n");
604 PyErr_Format(PyExc_TypeError,
"Expected a GPUStageInterfaceInfo, got %s", Py_TYPE(o)->tp_name);
608#ifdef USE_GPU_PY_REFERENCES
609 PyList_Append(self->
references,
reinterpret_cast<PyObject *
>(o));
621 pygpu_shader_info_fragment_out_doc,
622 ".. method:: fragment_out(slot, type, name, *, blend='NONE')\n"
624 " Specify a fragment output corresponding to a framebuffer target slot.\n"
626 " :param slot: The attribute index.\n"
628 " :param type: The data type of the output.\n"
631 " :param name: Name of the attribute.\n"
633 " :param blend: Dual Source Blending Index.\n"
634 " :type blend: Literal['NONE', 'SRC_0', 'SRC_1']\n");
644 static const char *_keywords[] = {
"slot",
"type",
"name",
"blend",
nullptr};
645 static _PyArg_Parser _parser = {
655 if (!_PyArg_ParseTupleAndKeywordsFast(args,
667 const char *name = PyUnicode_AsUTF8(py_name);
668 if (name ==
nullptr) [[unlikely]] {
672#ifdef USE_GPU_PY_REFERENCES
684 pygpu_shader_info_depth_write_doc,
685 ".. method:: depth_write(value)\n"
687 " Specify a depth write behavior when modifying gl_FragDepth.\n"
689 " There is a common optimization for GPUs that relies on an early depth\n"
690 " test to be run before the fragment shader so that the shader evaluation\n"
691 " can be skipped if the fragment ends up being discarded because it is occluded.\n"
693 " This optimization does not affect the final rendering, and is typically\n"
694 " possible when the fragment does not change the depth programmatically.\n"
695 " There is, however, a class of operations on the depth in the shader which\n"
696 " could still be performed while allowing the early depth test to operate.\n"
698 " This function alters the behavior of the optimization to allow those operations\n"
699 " to be performed.\n"
701 " :param value: Depth write value.\n"
702 " :UNCHANGED: disables depth write in a fragment shader and execution of the "
703 "fragments can be optimized away.\n"
704 " :ANY: enables depth write in a fragment shader for any fragments\n"
705 " :GREATER: enables depth write in a fragment shader for depth values that "
706 "are greater than the depth value in the output buffer.\n"
707 " :LESS: enables depth write in a fragment shader for depth values that "
708 "are less than the depth value in the output buffer.\n"
709 " :type value: Literal['UNCHANGED', 'ANY', 'GREATER', 'LESS']\n");
725 pygpu_shader_info_uniform_buf_doc,
726 ".. method:: uniform_buf(slot, type_name, name)\n"
728 " Specify a uniform variable whose type can be one of those declared in "
729 ":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
731 " :param slot: The uniform variable index.\n"
733 " :param type_name: Name of the data type. "
734 "It can be a struct type defined in the source passed through the "
735 ":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
736 " :type type_name: str\n"
737 " :param name: The uniform variable name.\n"
738 " :type name: str\n");
742 const char *type_name;
745 if (!PyArg_ParseTuple(args,
757#ifdef USE_GPU_PY_REFERENCES
758 PyList_Append(self->
references, PyTuple_GET_ITEM(args, 1));
759 PyList_Append(self->
references, PyTuple_GET_ITEM(args, 2));
770 pygpu_shader_info_storage_buf_doc,
771 ".. method:: storage_buf(slot, type_name, name, *, qualifiers={'READ', 'WRITE'})\n"
773 " Specify a storage buffer variable whose type can be one of those declared in "
774 ":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
776 " :param slot: The storage buffer variable index.\n"
778 " :param type_name: Name of the data type. "
779 "It can be a struct type defined in the source passed through the "
780 ":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
781 " :type type_name: str\n"
782 " :param name: The storage buffer variable name.\n"
784 " :param qualifiers: Set containing values that describe how the storage buffer is to be "
792 PyObject *py_type_name;
794 PyObject *py_qualifiers =
nullptr;
795 Qualifier qualifier = Qualifier::read_write;
797 static const char *_keywords[] = {
"slot",
"type_name",
"name",
"qualifiers",
nullptr};
798 static _PyArg_Parser _parser = {
808 if (!_PyArg_ParseTupleAndKeywordsFast(
809 args, kwds, &_parser, &slot, &py_type_name, &py_name, &py_qualifiers))
813 const char *type_name = PyUnicode_AsUTF8(py_type_name);
814 if (type_name ==
nullptr) [[unlikely]] {
817 const char *name = PyUnicode_AsUTF8(py_name);
818 if (name ==
nullptr) [[unlikely]] {
824 reinterpret_cast<int *
>(&qualifier),
825 "shader_info.storage_buf") == -1)
830#ifdef USE_GPU_PY_REFERENCES
831 PyList_Append(self->
references, py_type_name);
836 info->
storage_buf(slot, qualifier, type_name, name);
841#ifdef USE_PYGPU_SHADER_INFO_IMAGE_METHOD
844 pygpu_shader_info_image_doc,
845 ".. method:: image(slot, format, type, name, *, qualifiers={'NO_RESTRICT'})\n"
847 " Specify an image resource used for arbitrary load and store operations.\n"
849 " :param slot: The image resource index.\n"
851 " :param format: The GPUTexture format that is passed to the shader.\n"
854 " :param type: The data type describing how the image is to be read in the shader.\n"
857 " :param name: The image resource name.\n"
859 " :param qualifiers: Set containing values that describe how the image resource is to be "
870 PyObject *py_qualifiers =
nullptr;
871 Qualifier qualifier = Qualifier::no_restrict;
873 static const char *_keywords[] = {
"slot",
"format",
"type",
"name",
"qualifiers",
nullptr};
874 static _PyArg_Parser _parser = {
885 if (!_PyArg_ParseTupleAndKeywordsFast(args,
898 const char *name = PyUnicode_AsUTF8(py_name);
899 if (name ==
nullptr) [[unlikely]] {
905 reinterpret_cast<int *
>(&qualifier),
906 "shader_info.image") == -1)
912 pygpu_texformat.
value_found = int(gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8);
914 PyExc_DeprecationWarning,
"'DEPTH24_STENCIL8' is deprecated. Use 'DEPTH32F_STENCIL8'.", 1);
917 pygpu_texformat.
value_found = int(gpu::TextureFormat::SFLOAT_32_DEPTH);
918 PyErr_WarnEx(PyExc_DeprecationWarning,
919 "'DEPTH_COMPONENT24' is deprecated. Use 'DEPTH_COMPONENT32F'.",
923# ifdef USE_GPU_PY_REFERENCES
940 pygpu_shader_info_sampler_doc,
941 ".. method:: sampler(slot, type, name)\n"
943 " Specify an image texture sampler.\n"
945 " :param slot: The image texture sampler index.\n"
947 " :param type: The data type describing the format of each sampler unit.\n"
950 " :param name: The image texture sampler name.\n"
951 " :type name: str\n");
958 if (!PyArg_ParseTuple(args,
971#ifdef USE_GPU_PY_REFERENCES
972 PyList_Append(self->
references, PyTuple_GET_ITEM(args, 2));
990 case Type::float3_10_10_10_2_t:
991 case Type::ushort2_t:
995 case Type::ushort3_t:
1002 case Type::ushort4_t:
1003 case Type::short4_t:
1006 case Type::float3_t:
1011 case Type::float4_t:
1016 case Type::float3x3_t:
1018 case Type::float4x4_t:
1025 case Type::uchar2_t:
1027 case Type::ushort_t:
1031 case Type::uchar3_t:
1047 if (size_last && size_last != size) {
1049 int pack = (size == 8) ? 8 : 16;
1050 if (size_last < size) {
1051 pad = pack - (size_last % pack);
1054 pad = size_prev % pack;
1057 else if (size == 12) {
1062 size_prev +=
pad + size * std::max(1,
uniform.array_size);
1065 return size_prev + (size_prev % 16);
1070 pygpu_shader_info_push_constant_doc,
1071 ".. method:: push_constant(type, name, size=0)\n"
1073 " Specify a global access constant.\n"
1075 " :param type: The data type of the constant.\n"
1078 " :param name: Name of the constant.\n"
1079 " :type name: str\n"
1080 " :param size: If not zero, indicates that the constant is an array "
1081 "with the specified size.\n"
1082 " :type size: int\n");
1088 PyObject *py_name =
nullptr;
1091 static const char *_keywords[] = {
"type",
"name",
"size",
nullptr};
1092 static _PyArg_Parser _parser = {
1101 if (!_PyArg_ParseTupleAndKeywordsFast(
1106 const char *name = PyUnicode_AsUTF8(py_name);
1107 if (name ==
nullptr) [[unlikely]] {
1111#ifdef USE_GPU_PY_REFERENCES
1118#define VULKAN_LIMIT 128
1121 printf(
"Push constants have a minimum supported size of " STRINGIFY(
VULKAN_LIMIT)
" bytes, however the constants added so far already reach %d bytes. Consider using UBO.\n", size);
1130 pygpu_shader_info_vertex_source_doc,
1131 ".. method:: vertex_source(source)\n"
1133 " Vertex shader source code written in GLSL.\n"
1137 " .. code-block:: python\n"
1139 " \"void main() {gl_Position = vec4(pos, 1.0);}\"\n"
1141 " :param source: The vertex shader source code.\n"
1142 " :type source: str\n"
1144 " .. seealso:: `GLSL Cross Compilation "
1145 "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n");
1148 const char *vertex_source = PyUnicode_AsUTF8(o);
1149 if (vertex_source ==
nullptr) {
1150 PyErr_Format(PyExc_ValueError,
"expected a string, got %s", Py_TYPE(o)->tp_name);
1154#ifdef USE_GPU_PY_REFERENCES
1172 pygpu_shader_info_compute_source_doc,
1173 ".. method:: compute_source(source)\n"
1175 " compute shader source code written in GLSL.\n"
1179 " .. code-block:: python\n"
1181 " \"\"\"void main() {\n"
1182 " int2 index = int2(gl_GlobalInvocationID.xy);\n"
1183 " vec4 color = vec4(0.0, 0.0, 0.0, 1.0);\n"
1184 " imageStore(img_output, index, color);\n"
1187 " :param source: The compute shader source code.\n"
1188 " :type source: str\n"
1190 " .. seealso:: `GLSL Cross Compilation "
1191 "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n");
1194 const char *compute_source = PyUnicode_AsUTF8(o);
1195 if (compute_source ==
nullptr) {
1196 PyErr_Format(PyExc_ValueError,
"expected a string, got %s", Py_TYPE(o)->tp_name);
1200#ifdef USE_GPU_PY_REFERENCES
1218 pygpu_shader_info_fragment_source_doc,
1219 ".. method:: fragment_source(source)\n"
1221 " Fragment shader source code written in GLSL.\n"
1225 " .. code-block:: python\n"
1227 " \"void main() {fragColor = vec4(0.0, 0.0, 0.0, 1.0);}\"\n"
1229 " :param source: The fragment shader source code.\n"
1230 " :type source: str\n"
1232 " .. seealso:: `GLSL Cross Compilation "
1233 "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n");
1236 const char *fragment_source = PyUnicode_AsUTF8(o);
1237 if (fragment_source ==
nullptr) {
1238 PyErr_Format(PyExc_ValueError,
"expected a string, got %s", Py_TYPE(o)->tp_name);
1242#ifdef USE_GPU_PY_REFERENCES
1260 pygpu_shader_info_typedef_source_doc,
1261 ".. method:: typedef_source(source)\n"
1263 " Source code included before resource declaration. "
1264 "Useful for defining structs used by Uniform Buffers.\n"
1268 " .. code-block:: python\n"
1270 " \"struct MyType {int foo; float bar;};\"\n"
1272 " :param source: The source code defining types.\n"
1273 " :type source: str\n");
1276 const char *typedef_source = PyUnicode_AsUTF8(o);
1277 if (typedef_source ==
nullptr) {
1278 PyErr_Format(PyExc_ValueError,
"expected a string, got %s", Py_TYPE(o)->tp_name);
1282#ifdef USE_GPU_PY_REFERENCES
1304 pygpu_shader_info_define_doc,
1305 ".. method:: define(name, value)\n"
1307 " Add a preprocessing define directive. In GLSL it would be something like:\n"
1309 " .. code-block:: glsl\n"
1311 " #define name value\n"
1313 " :param name: Token name.\n"
1314 " :type name: str\n"
1315 " :param value: Text that replaces token occurrences.\n"
1316 " :type value: str\n");
1320 const char *value =
nullptr;
1322 if (!PyArg_ParseTuple(args,
1333#ifdef USE_GPU_PY_REFERENCES
1334 PyList_Append(self->
references, PyTuple_GET_ITEM(args, 0));
1336 PyList_Append(self->
references, PyTuple_GET_ITEM(args, 1));
1342 info->
define(name, value);
1353 pygpu_shader_info_local_group_size_doc,
1354 ".. method:: local_group_size(x, y=1, z=1)\n"
1356 " Specify the local group size for compute shaders.\n"
1358 " :param x: The local group size in the x dimension.\n"
1360 " :param y: The local group size in the y dimension. Optional. Defaults to 1.\n"
1362 " :param z: The local group size in the z dimension. Optional. Defaults to 1.\n"
1366 int x = -1,
y = 1,
z = 1;
1368 if (!PyArg_ParseTuple(args,
1373 ":local_group_size",
1391 pygpu_shader_info_vertex_in_doc},
1395 pygpu_shader_info_vertex_out_doc},
1399 pygpu_shader_info_depth_write_doc},
1402 METH_VARARGS | METH_KEYWORDS,
1403 pygpu_shader_info_fragment_out_doc},
1407 pygpu_shader_info_uniform_buf_doc},
1410 METH_VARARGS | METH_KEYWORDS,
1411 pygpu_shader_info_storage_buf_doc},
1412#ifdef USE_PYGPU_SHADER_INFO_IMAGE_METHOD
1415 METH_VARARGS | METH_KEYWORDS,
1416 pygpu_shader_info_image_doc},
1421 pygpu_shader_info_sampler_doc},
1424 METH_VARARGS | METH_KEYWORDS,
1425 pygpu_shader_info_push_constant_doc},
1429 pygpu_shader_info_vertex_source_doc},
1433 pygpu_shader_info_fragment_source_doc},
1437 pygpu_shader_info_compute_source_doc},
1441 pygpu_shader_info_typedef_source_doc},
1445 pygpu_shader_info_define_doc},
1446 {
"local_group_size",
1449 pygpu_shader_info_local_group_size_doc},
1450 {
nullptr,
nullptr, 0,
nullptr},
1461 if (PyTuple_Size(args) || kwds) {
1462 PyErr_SetString(PyExc_TypeError,
"no args or keywords are expected");
1467 GPUShaderCreateInfo *shader_info =
reinterpret_cast<GPUShaderCreateInfo *
>(info);
1472#ifdef USE_GPU_PY_REFERENCES
1504#ifdef USE_GPU_PY_REFERENCES
1505 PyObject_GC_UnTrack(self);
1509 Py_TYPE(self)->tp_free(self);
1514 pygpu_shader_info__tp_doc,
1515 ".. class:: GPUShaderCreateInfo()\n"
1517 " Stores and describes types and variables that are used in shader sources.\n");
1519 PyVarObject_HEAD_INIT(
nullptr, 0)
1520 "GPUShaderCreateInfo",
1539 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
1543 pygpu_shader_info__tp_doc,
1592#ifdef USE_GPU_PY_REFERENCES
1602 return reinterpret_cast<PyObject *
>(self);
1609#ifdef USE_GPU_PY_REFERENCES
1624 return reinterpret_cast<PyObject *
>(self);
int pad[32 - sizeof(int)]
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
#define USE_GPU_PY_REFERENCES
#define BPyGPUStageInterfaceInfo_Check(v)
#define PYDOC_TYPE_LITERAL
#define PYDOC_QUALIFIERS_LITERAL
#define PYDOC_IMAGE_TYPES_LITERAL
#define PYDOC_TEX_FORMAT_LITERAL
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static PyObject * pygpu_shader_info_depth_write(BPyGPUShaderCreateInfo *self, PyObject *args)
static PyObject * pygpu_shader_info_define(BPyGPUShaderCreateInfo *self, PyObject *args)
int PyC_FlagSet_ToBitfield(const PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix)
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 PyObject * pygpu_shader_info_storage_buf(BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds)
static PyObject * pygpu_shader_info_typedef_source(BPyGPUShaderCreateInfo *self, PyObject *o)
static const PyC_StringEnumItems pygpu_depth_write_items[]
static PyObject * pygpu_shader_info_vertex_in(BPyGPUShaderCreateInfo *self, PyObject *args)
static PyObject * pygpu_shader_info_vertex_out(BPyGPUShaderCreateInfo *self, BPyGPUStageInterfaceInfo *o)
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)
static PyObject * pygpu_shader_info_sampler(BPyGPUShaderCreateInfo *self, PyObject *args)
static const PyC_StringEnumItems pygpu_dualblend_items[]
PyDoc_STRVAR(bpy_bm_new_doc, ".. function:: new(*, use_operators=True)\n" "\n" " :param use_operators: Support calling operators in :mod:`bmesh.ops` (uses some " "extra memory per vert/edge/face).\n" " :type use_operators: bool\n" " :return: Return a new, empty BMesh.\n" " :rtype: :class:`bmesh.types.BMesh`\n")
PyTypeObject BPyGPUStageInterfaceInfo_Type
static PyObject * pygpu_interface_info_no_perspective(BPyGPUStageInterfaceInfo *self, PyObject *args)
constexpr int GPU_DEPTH24_STENCIL8_DEPRECATED
static int pygpu_shader_info__tp_clear(PyObject *self)
static const PyC_StringEnumItems pygpu_imagetype_items[]
static PyObject * pygpu_shader_info_local_group_size(BPyGPUShaderCreateInfo *self, PyObject *args)
static PyObject * pygpu_interface_info_flat(BPyGPUStageInterfaceInfo *self, PyObject *args)
static PyGetSetDef pygpu_interface_info__tp_getseters[]
static int constant_type_size(Type type)
static int constants_calc_size(ShaderCreateInfo *info)
static PyObject * pygpu_interface_info__tp_new(PyTypeObject *, PyObject *args, PyObject *kwds)
static PyMethodDef pygpu_shader_info__tp_methods[]
static PyObject * pygpu_shader_info_image(BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds)
const struct PyC_StringEnumItems pygpu_attrtype_items[]
static int pygpu_interface_info__tp_traverse(PyObject *self, visitproc visit, void *arg)
static PyObject * pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds)
const PyC_StringEnumItems pygpu_tex_format_items[]
const PyC_StringEnumItems pygpu_textureformat_items[]
constexpr int GPU_DEPTH_COMPONENT24_DEPRECATED
static int pygpu_interface_info__tp_clear(PyObject *self)
static void pygpu_interface_info__tp_dealloc(PyObject *self)
static PyObject * pygpu_shader_info_compute_source(BPyGPUShaderCreateInfo *self, PyObject *o)
static PyObject * pygpu_shader_info_uniform_buf(BPyGPUShaderCreateInfo *self, PyObject *args)
static const PyC_FlagSet pygpu_qualifiers[]
PyObject * PyC_UnicodeFromStdStr(const std::string &str)
int PyC_ParseStringEnum(PyObject *o, void *p)
static PyObject * pygpu_interface_info_smooth(BPyGPUStageInterfaceInfo *self, PyObject *args)
static PyObject * pygpu_shader_info_vertex_source(BPyGPUShaderCreateInfo *self, PyObject *o)
static PyObject * pygpu_shader_info_fragment_source(BPyGPUShaderCreateInfo *self, PyObject *o)
PyTypeObject BPyGPUShaderCreateInfo_Type
PyObject * BPyGPUStageInterfaceInfo_CreatePyObject(GPUStageInterfaceInfo *interface)
static void pygpu_shader_info__tp_dealloc(PyObject *self)
static PyObject * pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds)
static PyObject * pygpu_interface_info_name_get(BPyGPUStageInterfaceInfo *self, void *)
PyObject * BPyGPUShaderCreateInfo_CreatePyObject(GPUShaderCreateInfo *info)
header-only compatibility defines.
PyObject * fragment_source
PyObject * compute_source
size_t constants_total_size
PyObject_HEAD GPUShaderCreateInfo * info
PyObject * typedef_source
PyObject_HEAD GPUStageInterfaceInfo * interface
ShaderCreateInfo(const char *name)
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...
Self & uniform_buf(int slot, StringRefNull type_name, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
Self & image(int slot, TextureFormat format, Qualifier qualifiers, ImageReadWriteType type, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
Self & compute_source(StringRefNull filename)
Vector< StringRefNull, 0 > typedef_sources_
Self & fragment_source(StringRefNull filename)
std::string fragment_source_generated
Self & depth_write(DepthWrite value)
Self & vertex_in(int slot, Type type, StringRefNull name, ConditionFn cond=nullptr)
Self & fragment_out(int slot, Type type, StringRefNull name, DualBlend blend=DualBlend::NONE, int raster_order_group=-1, ConditionFn cond=nullptr)
Self & typedef_source(StringRefNull filename)
Vector< PushConst, 0 > push_constants_
Self & storage_buf(int slot, Qualifier qualifiers, StringRefNull type_name, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
std::string vertex_source_generated
std::string typedef_source_generated
Self & vertex_source(StringRefNull filename)
std::string compute_source_generated
Self & local_group_size(int local_size_x, int local_size_y=1, int local_size_z=1)
Self & vertex_out(StageInterfaceInfo &interface, ConditionFn cond=nullptr)
Self & sampler(int slot, ImageType type, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
Self & define(StringRefNull name, StringRefNull value="")
Self & push_constant(Type type, StringRefNull name, int array_size=0, ConditionFn cond=nullptr)
Self & smooth(Type type, StringRefNull _name)
Self & no_perspective(Type type, StringRefNull _name)
Self & flat(Type type, StringRefNull _name)