25#define USE_PYGPU_SHADER_INFO_IMAGE_METHOD
35#ifdef USE_PYGPU_SHADER_INFO_IMAGE_METHOD
38# define PYDOC_QUALIFIERS \
39 " - ``NO_RESTRICT``\n" \
43 {int(Qualifier::no_restrict),
"NO_RESTRICT"},
44 {int(Qualifier::read),
"READ"},
45 {int(Qualifier::write),
"WRITE"},
50#define PYDOC_TYPE_LIST \
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 \
86 " - ``FLOAT_BUFFER``\n" \
88 " - ``FLOAT_1D_ARRAY``\n" \
90 " - ``FLOAT_2D_ARRAY``\n" \
92 " - ``FLOAT_CUBE``\n" \
93 " - ``FLOAT_CUBE_ARRAY``\n" \
94 " - ``INT_BUFFER``\n" \
96 " - ``INT_1D_ARRAY``\n" \
98 " - ``INT_2D_ARRAY``\n" \
100 " - ``INT_CUBE``\n" \
101 " - ``INT_CUBE_ARRAY``\n" \
102 " - ``UINT_BUFFER``\n" \
104 " - ``UINT_1D_ARRAY``\n" \
106 " - ``UINT_2D_ARRAY``\n" \
108 " - ``UINT_CUBE``\n" \
109 " - ``UINT_CUBE_ARRAY``\n" \
110 " - ``SHADOW_2D``\n" \
111 " - ``SHADOW_2D_ARRAY``\n" \
112 " - ``SHADOW_CUBE``\n" \
113 " - ``SHADOW_CUBE_ARRAY``\n" \
114 " - ``DEPTH_2D``\n" \
115 " - ``DEPTH_2D_ARRAY``\n" \
116 " - ``DEPTH_CUBE``\n" \
117 " - ``DEPTH_CUBE_ARRAY``\n"
119 {int(ImageType::FloatBuffer),
"FLOAT_BUFFER"},
120 {int(ImageType::Float1D),
"FLOAT_1D"},
121 {int(ImageType::Float1DArray),
"FLOAT_1D_ARRAY"},
122 {int(ImageType::Float2D),
"FLOAT_2D"},
123 {int(ImageType::Float2DArray),
"FLOAT_2D_ARRAY"},
124 {int(ImageType::Float3D),
"FLOAT_3D"},
125 {int(ImageType::FloatCube),
"FLOAT_CUBE"},
126 {int(ImageType::FloatCubeArray),
"FLOAT_CUBE_ARRAY"},
127 {int(ImageType::IntBuffer),
"INT_BUFFER"},
128 {int(ImageType::Int1D),
"INT_1D"},
129 {int(ImageType::Int1DArray),
"INT_1D_ARRAY"},
130 {int(ImageType::Int2D),
"INT_2D"},
131 {int(ImageType::Int2DArray),
"INT_2D_ARRAY"},
132 {int(ImageType::Int3D),
"INT_3D"},
133 {int(ImageType::IntCube),
"INT_CUBE"},
134 {int(ImageType::IntCubeArray),
"INT_CUBE_ARRAY"},
135 {int(ImageType::AtomicInt2D),
"INT_2D_ATOMIC"},
136 {int(ImageType::AtomicInt2DArray),
"INT_2D_ARRAY_ATOMIC"},
137 {int(ImageType::AtomicInt3D),
"INT_3D_ATOMIC"},
138 {int(ImageType::UintBuffer),
"UINT_BUFFER"},
139 {int(ImageType::Uint1D),
"UINT_1D"},
140 {int(ImageType::Uint1DArray),
"UINT_1D_ARRAY"},
141 {int(ImageType::Uint2D),
"UINT_2D"},
142 {int(ImageType::Uint2DArray),
"UINT_2D_ARRAY"},
143 {int(ImageType::Uint3D),
"UINT_3D"},
144 {int(ImageType::UintCube),
"UINT_CUBE"},
145 {int(ImageType::UintCubeArray),
"UINT_CUBE_ARRAY"},
146 {int(ImageType::AtomicUint2D),
"UINT_2D_ATOMIC"},
147 {int(ImageType::AtomicUint2DArray),
"UINT_2D_ARRAY_ATOMIC"},
148 {int(ImageType::AtomicUint3D),
"UINT_3D_ATOMIC"},
149 {int(ImageType::Shadow2D),
"SHADOW_2D"},
150 {int(ImageType::Shadow2DArray),
"SHADOW_2D_ARRAY"},
151 {int(ImageType::ShadowCube),
"SHADOW_CUBE"},
152 {int(ImageType::ShadowCubeArray),
"SHADOW_CUBE_ARRAY"},
153 {int(ImageType::Depth2D),
"DEPTH_2D"},
154 {int(ImageType::Depth2DArray),
"DEPTH_2D_ARRAY"},
155 {int(ImageType::DepthCube),
"DEPTH_CUBE"},
156 {int(ImageType::DepthCubeArray),
"DEPTH_CUBE_ARRAY"},
161 {int(DualBlend::NONE),
"NONE"},
162 {int(DualBlend::SRC_0),
"SRC_0"},
163 {int(DualBlend::SRC_1),
"SRC_1"},
168 {int(DepthWrite::UNCHANGED),
"UNCHANGED"},
169 {int(DepthWrite::ANY),
"ANY"},
170 {int(DepthWrite::GREATER),
"GREATER"},
171 {int(DepthWrite::LESS),
"LESS"},
175#define PYDOC_TEX_FORMAT_ITEMS \
179 " - ``RGBA32UI``\n" \
182 " - ``RGBA16UI``\n" \
206 " - ``R11F_G11F_B10F``\n" \
207 " - ``DEPTH32F_STENCIL8``\n" \
208 " - ``DEPTH24_STENCIL8`` (deprecated, use ``DEPTH32F_STENCIL8``)\n" \
209 " - ``SRGB8_A8``\n" \
211 " - ``SRGB8_A8_DXT1``\n" \
212 " - ``SRGB8_A8_DXT3``\n" \
213 " - ``SRGB8_A8_DXT5``\n" \
214 " - ``RGBA8_DXT1``\n" \
215 " - ``RGBA8_DXT3``\n" \
216 " - ``RGBA8_DXT5``\n" \
217 " - ``DEPTH_COMPONENT32F``\n" \
218 " - ``DEPTH_COMPONENT24`` (deprecated, use ``DEPTH_COMPONENT32F``)\n" \
219 " - ``DEPTH_COMPONENT16``\n"
239 const char *
name = PyUnicode_AsUTF8(py_name);
240 if (
name ==
nullptr) {
244#ifdef USE_GPU_PY_REFERENCES
245 PyList_Append(
self->references, py_name);
255 pygpu_interface_info_smooth_doc,
256 ".. method:: smooth(type, name)\n"
258 " Add an attribute with qualifier of type *smooth* to the interface block.\n"
260 " :arg type: One of these types:\n"
264 " :arg name: name of the attribute.\n"
265 " :type name: str\n");
281 pygpu_interface_info_flat_doc,
282 ".. method:: flat(type, name)\n"
284 " Add an attribute with qualifier of type ``flat`` to the interface block.\n"
286 " :arg type: One of these types:\n"
290 " :arg name: name of the attribute.\n"
291 " :type name: str\n");
307 pygpu_interface_info_no_perspective_doc,
308 ".. method:: no_perspective(type, name)\n"
310 " Add an attribute with qualifier of type ``no_perspective`` to the interface block.\n"
312 " :arg type: One of these types:\n"
316 " :arg name: name of the attribute.\n"
317 " :type name: str\n");
336 pygpu_interface_info_smooth_doc},
341 pygpu_interface_info_no_perspective_doc},
342 {
nullptr,
nullptr, 0,
nullptr},
353 pygpu_interface_info_name_doc,
354 "Name of the interface block.\n"
367 pygpu_interface_info_name_doc,
369 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
383 PyErr_SetString(PyExc_TypeError,
"no keywords are expected");
388 if (!PyArg_ParseTuple(args,
"s:GPUStageInterfaceInfo.__new__*", &
name)) {
393 GPUStageInterfaceInfo *interface_info =
reinterpret_cast<GPUStageInterfaceInfo *
>(
interface);
397#ifdef USE_GPU_PY_REFERENCES
398 PyObject *py_name = PyTuple_GET_ITEM(args, 0);
405#ifdef USE_GPU_PY_REFERENCES
429#ifdef USE_GPU_PY_REFERENCES
430 PyObject_GC_UnTrack(
self);
442 pygpu_interface_info__tp_doc,
443 ".. class:: GPUStageInterfaceInfo(name)\n"
445 " List of varyings between shader stages.\n"
447 " :arg name: Name of the interface block.\n"
448 " :type value: str\n");
450 PyVarObject_HEAD_INIT(
nullptr, 0)
451 "GPUStageInterfaceInfo",
470 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
474 pygpu_interface_info__tp_doc,
521 pygpu_shader_info_vertex_in_doc,
522 ".. method:: vertex_in(slot, type, name)\n"
524 " Add a vertex shader input attribute.\n"
526 " :arg slot: The attribute index.\n"
528 " :arg type: One of these types:\n"
532 " :arg name: name of the attribute.\n"
533 " :type name: str\n");
540 if (!PyArg_ParseTuple(args,
"iO&s:vertex_in", &slot,
PyC_ParseStringEnum, &pygpu_type, ¶m)) {
544#ifdef USE_GPU_PY_REFERENCES
545 PyObject *py_name = PyTuple_GET_ITEM(args, 2);
546 PyList_Append(
self->references, py_name);
556 pygpu_shader_info_vertex_out_doc,
557 ".. method:: vertex_out(interface)\n"
559 " Add a vertex shader output interface block.\n"
561 " :arg interface: Object describing the block.\n"
562 " :type interface: :class:`gpu.types.GPUStageInterfaceInfo`\n");
567 PyErr_Format(PyExc_TypeError,
"Expected a GPUStageInterfaceInfo, got %s", Py_TYPE(o)->tp_name);
571#ifdef USE_GPU_PY_REFERENCES
572 PyList_Append(
self->references, (PyObject *)o);
584 pygpu_shader_info_fragment_out_doc,
585 ".. method:: fragment_out(slot, type, name, *, blend='NONE')\n"
587 " Specify a fragment output corresponding to a framebuffer target slot.\n"
589 " :arg slot: The attribute index.\n"
591 " :arg type: One of these types:\n"
595 " :arg name: Name of the attribute.\n"
597 " :arg blend: Dual Source Blending Index. It can be 'NONE', 'SRC_0' or 'SRC_1'.\n"
598 " :type blend: str\n");
608 static const char *_keywords[] = {
"slot",
"type",
"name",
"blend",
nullptr};
609 static _PyArg_Parser _parser = {
620 if (!_PyArg_ParseTupleAndKeywordsFast(args,
633#ifdef USE_GPU_PY_REFERENCES
634 PyObject *py_name = PyTuple_GET_ITEM(args, 2);
635 PyList_Append(
self->references, py_name);
646 pygpu_shader_info_depth_write_doc,
647 ".. method:: depth_write(value)\n"
649 " Specify a depth write behavior when modifying gl_FragDepth.\n"
651 " There is a common optimization for GPUs that relies on an early depth\n"
652 " test to be run before the fragment shader so that the shader evaluation\n"
653 " can be skipped if the fragment ends up being discarded because it is occluded.\n"
655 " This optimization does not affect the final rendering, and is typically\n"
656 " possible when the fragment does not change the depth programmatically.\n"
657 " There are, however a class of operations on the depth in the shader which\n"
658 " could still be performed while allowing the early depth test to operate.\n"
660 " This function alters the behavior of the optimization to allow those operations\n"
661 " to be performed.\n"
663 " :arg value: Depth write value. "
664 "It can be 'UNCHANGED' (default), 'ANY', 'GREATER' or 'LESS'.\n"
665 " :UNCHANGED: disables depth write in a fragment shader and execution of the"
666 "fragments can be optimized away.\n"
667 " :ANY: enables depth write in a fragment shader for any fragments\n"
668 " :GREATER: enables depth write in a fragment shader for depth values that"
669 "are greater than the depth value in the output buffer.\n"
670 " :LESS: enables depth write in a fragment shader for depth values that"
671 "are less than the depth value in the output buffer.\n"
672 " :type blend: str\n");
688 pygpu_shader_info_uniform_buf_doc,
689 ".. method:: uniform_buf(slot, type_name, name)\n"
691 " Specify a uniform variable whose type can be one of those declared in "
692 ":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
694 " :arg slot: The uniform variable index.\n"
696 " :arg type_name: Name of the data type. "
697 "It can be a struct type defined in the source passed through the "
698 ":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
699 " :type type_name: str\n"
700 " :arg name: The uniform variable name.\n"
701 " :type name: str\n");
705 const char *type_name;
708 if (!PyArg_ParseTuple(args,
"iss:uniform_buf", &slot, &type_name, &
name)) {
712#ifdef USE_GPU_PY_REFERENCES
713 PyList_Append(
self->references, PyTuple_GET_ITEM(args, 1));
714 PyList_Append(
self->references, PyTuple_GET_ITEM(args, 2));
723#ifdef USE_PYGPU_SHADER_INFO_IMAGE_METHOD
726 pygpu_shader_info_image_doc,
727 ".. method:: image(slot, format, type, name, *, qualifiers={'NO_RESTRICT'})\n"
729 " Specify an image resource used for arbitrary load and store operations.\n"
731 " :arg slot: The image resource index.\n"
733 " :arg format: The GPUTexture format that is passed to the shader. Possible "
736 " :type format: str\n"
737 " :arg type: The data type describing how the image is to be read in the shader. "
738 "Possible values are:\n"
742 " :arg name: The image resource name.\n"
744 " :arg qualifiers: Set containing values that describe how the image resource is to be "
745 "read or written. Possible values are:\n"
748 " :type qualifiers: set[str]\n");
757 PyObject *py_qualifiers =
nullptr;
758 Qualifier qualifier = Qualifier::no_restrict;
760 static const char *_keywords[] = {
"slot",
"format",
"type",
"name",
"qualifiers",
nullptr};
761 static _PyArg_Parser _parser = {
773 if (!_PyArg_ParseTupleAndKeywordsFast(args,
789 pygpu_qualifiers, py_qualifiers, (
int *)&qualifier,
"shader_info.image") == -1)
795 pygpu_texformat.
value_found = int(blender::gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8);
797 PyExc_DeprecationWarning,
"'DEPTH24_STENCIL8' is deprecated. Use 'DEPTH32F_STENCIL8'.", 1);
800 pygpu_texformat.
value_found = int(blender::gpu::TextureFormat::SFLOAT_32_DEPTH);
801 PyErr_WarnEx(PyExc_DeprecationWarning,
802 "'DEPTH_COMPONENT24' is deprecated. Use 'DEPTH_COMPONENT32F'.",
806# ifdef USE_GPU_PY_REFERENCES
807 PyList_Append(
self->references, PyTuple_GET_ITEM(args, 3));
823 pygpu_shader_info_sampler_doc,
824 ".. method:: sampler(slot, type, name)\n"
826 " Specify an image texture sampler.\n"
828 " :arg slot: The image texture sampler index.\n"
830 " :arg type: The data type describing the format of each sampler unit. Possible values "
835 " :arg name: The image texture sampler name.\n"
836 " :type name: str\n");
843 if (!PyArg_ParseTuple(
849#ifdef USE_GPU_PY_REFERENCES
850 PyList_Append(
self->references, PyTuple_GET_ITEM(args, 2));
868 case Type::float3_10_10_10_2_t:
869 case Type::ushort2_t:
873 case Type::ushort3_t:
880 case Type::ushort4_t:
894 case Type::float3x3_t:
896 case Type::float4x4_t:
925 if (size_last && size_last !=
size) {
927 int pack = (
size == 8) ? 8 : 16;
928 if (size_last <
size) {
929 pad = pack - (size_last % pack);
932 pad = size_prev % pack;
935 else if (
size == 12) {
943 return size_prev + (size_prev % 16);
948 pygpu_shader_info_push_constant_doc,
949 ".. method:: push_constant(type, name, size=0)\n"
951 " Specify a global access constant.\n"
953 " :arg type: One of these types:\n"
957 " :arg name: Name of the constant.\n"
959 " :arg size: If not zero, indicates that the constant is an array with the specified size.\n"
960 " :type size: int\n");
966 const char *
name =
nullptr;
969 static const char *_keywords[] = {
"type",
"name",
"size",
nullptr};
970 static _PyArg_Parser _parser = {
980 if (!_PyArg_ParseTupleAndKeywordsFast(
986#ifdef USE_GPU_PY_REFERENCES
987 PyObject *py_name = PyTuple_GET_ITEM(args, 1);
988 PyList_Append(
self->references, py_name);
994#define VULKAN_LIMIT 128
997 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);
1006 pygpu_shader_info_vertex_source_doc,
1007 ".. method:: vertex_source(source)\n"
1009 " Vertex shader source code written in GLSL.\n"
1013 " .. code-block:: python\n"
1015 " \"void main {gl_Position = vec4(pos, 1.0);}\"\n"
1017 " :arg source: The vertex shader source code.\n"
1018 " :type source: str\n"
1020 " .. seealso:: `GLSL Cross Compilation "
1021 "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n");
1024 const char *vertex_source = PyUnicode_AsUTF8(o);
1025 if (vertex_source ==
nullptr) {
1026 PyErr_Format(PyExc_ValueError,
"expected a string, got %s", Py_TYPE(o)->tp_name);
1030#ifdef USE_GPU_PY_REFERENCES
1031 if (
self->vertex_source) {
1035 self->vertex_source = o;
1048 pygpu_shader_info_compute_source_doc,
1049 ".. method:: compute_source(source)\n"
1051 " compute shader source code written in GLSL.\n"
1055 " .. code-block:: python\n"
1057 " \"\"\"void main() {\n"
1058 " int2 index = int2(gl_GlobalInvocationID.xy);\n"
1059 " vec4 color = vec4(0.0, 0.0, 0.0, 1.0);\n"
1060 " imageStore(img_output, index, color);\n"
1063 " :arg source: The compute shader source code.\n"
1064 " :type source: str\n"
1066 " .. seealso:: `GLSL Cross Compilation "
1067 "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n");
1070 const char *compute_source = PyUnicode_AsUTF8(o);
1071 if (compute_source ==
nullptr) {
1072 PyErr_Format(PyExc_ValueError,
"expected a string, got %s", Py_TYPE(o)->tp_name);
1076#ifdef USE_GPU_PY_REFERENCES
1077 if (
self->compute_source) {
1081 self->compute_source = o;
1094 pygpu_shader_info_fragment_source_doc,
1095 ".. method:: fragment_source(source)\n"
1097 " Fragment shader source code written in GLSL.\n"
1101 " .. code-block:: python\n"
1103 " \"void main {fragColor = vec4(0.0, 0.0, 0.0, 1.0);}\"\n"
1105 " :arg source: The fragment shader source code.\n"
1106 " :type source: str\n"
1108 " .. seealso:: `GLSL Cross Compilation "
1109 "<https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__\n");
1112 const char *fragment_source = PyUnicode_AsUTF8(o);
1113 if (fragment_source ==
nullptr) {
1114 PyErr_Format(PyExc_ValueError,
"expected a string, got %s", Py_TYPE(o)->tp_name);
1118#ifdef USE_GPU_PY_REFERENCES
1119 if (
self->fragment_source) {
1123 self->fragment_source = o;
1136 pygpu_shader_info_typedef_source_doc,
1137 ".. method:: typedef_source(source)\n"
1139 " Source code included before resource declaration. "
1140 "Useful for defining structs used by Uniform Buffers.\n"
1144 " .. code-block:: python\n"
1146 " \"struct MyType {int foo; float bar;};\"\n"
1148 " :arg source: The source code defining types.\n"
1149 " :type source: str\n");
1152 const char *typedef_source = PyUnicode_AsUTF8(o);
1153 if (typedef_source ==
nullptr) {
1154 PyErr_Format(PyExc_ValueError,
"expected a string, got %s", Py_TYPE(o)->tp_name);
1158#ifdef USE_GPU_PY_REFERENCES
1159 if (
self->typedef_source) {
1163 self->typedef_source = o;
1180 pygpu_shader_info_define_doc,
1181 ".. method:: define(name, value)\n"
1183 " Add a preprocessing define directive. In GLSL it would be something like:\n"
1185 " .. code-block:: glsl\n"
1187 " #define name value\n"
1189 " :arg name: Token name.\n"
1190 " :type name: str\n"
1191 " :arg value: Text that replaces token occurrences.\n"
1192 " :type value: str\n");
1196 const char *value =
nullptr;
1198 if (!PyArg_ParseTuple(args,
"s|s:define", &
name, &value)) {
1202#ifdef USE_GPU_PY_REFERENCES
1203 PyList_Append(
self->references, PyTuple_GET_ITEM(args, 0));
1205 PyList_Append(
self->references, PyTuple_GET_ITEM(args, 1));
1222 pygpu_shader_info_local_group_size_doc,
1223 ".. method:: local_group_size(x, y=1, z=1)\n"
1225 " Specify the local group size for compute shaders.\n"
1227 " :arg x: The local group size in the x dimension.\n"
1229 " :arg y: The local group size in the y dimension. Optional. Defaults to 1.\n"
1231 " :arg z: The local group size in the z dimension. Optional. Defaults to 1.\n"
1235 int x = -1,
y = 1,
z = 1;
1237 if (!PyArg_ParseTuple(args,
"i|ii:local_group_size", &
x, &
y, &
z)) {
1251 pygpu_shader_info_vertex_in_doc},
1255 pygpu_shader_info_vertex_out_doc},
1259 pygpu_shader_info_depth_write_doc},
1262 METH_VARARGS | METH_KEYWORDS,
1263 pygpu_shader_info_fragment_out_doc},
1267 pygpu_shader_info_uniform_buf_doc},
1268#ifdef USE_PYGPU_SHADER_INFO_IMAGE_METHOD
1271 METH_VARARGS | METH_KEYWORDS,
1272 pygpu_shader_info_image_doc},
1277 pygpu_shader_info_sampler_doc},
1280 METH_VARARGS | METH_KEYWORDS,
1281 pygpu_shader_info_push_constant_doc},
1285 pygpu_shader_info_vertex_source_doc},
1289 pygpu_shader_info_fragment_source_doc},
1293 pygpu_shader_info_compute_source_doc},
1297 pygpu_shader_info_typedef_source_doc},
1299 {
"local_group_size",
1302 pygpu_shader_info_local_group_size_doc},
1303 {
nullptr,
nullptr, 0,
nullptr},
1314 if (PyTuple_Size(args) || kwds) {
1315 PyErr_SetString(PyExc_TypeError,
"no args or keywords are expected");
1320 GPUShaderCreateInfo *shader_info =
reinterpret_cast<GPUShaderCreateInfo *
>(info);
1325#ifdef USE_GPU_PY_REFERENCES
1355#ifdef USE_GPU_PY_REFERENCES
1356 PyObject_GC_UnTrack(
self);
1372 pygpu_shader_info__tp_doc,
1373 ".. class:: GPUShaderCreateInfo()\n"
1375 " Stores and describes types and variables that are used in shader sources.\n");
1377 PyVarObject_HEAD_INIT(
nullptr, 0)
1378 "GPUShaderCreateInfo",
1397 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
1401 pygpu_shader_info__tp_doc,
1450#ifdef USE_GPU_PY_REFERENCES
1452 self->references = PyList_New(0);
1459 return (PyObject *)
self;
1466#ifdef USE_GPU_PY_REFERENCES
1468 self->vertex_source =
nullptr;
1469 self->fragment_source =
nullptr;
1470 self->compute_source =
nullptr;
1471 self->typedef_source =
nullptr;
1472 self->references = PyList_New(0);
1478 self->constants_total_size = 0;
1480 return (PyObject *)
self;
KDTree *BLI_kdtree_nd_ new(unsigned int nodes_len_capacity)
int pad[32 - sizeof(int)]
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
#define USE_GPU_PY_REFERENCES
PyTypeObject BPyGPUStageInterfaceInfo_Type
const struct PyC_StringEnumItems pygpu_attrtype_items[]
PyTypeObject BPyGPUShaderCreateInfo_Type
#define BPyGPUStageInterfaceInfo_Check(v)
PyObject * BPyGPUShaderCreateInfo_CreatePyObject(GPUShaderCreateInfo *info)
static int pygpu_shader_info__tp_traverse(PyObject *self, visitproc visit, void *arg)
static PyObject * pygpu_shader_info__tp_new(PyTypeObject *, PyObject *args, PyObject *kwds)
static PyObject * pygpu_shader_info_vertex_out(BPyGPUShaderCreateInfo *self, BPyGPUStageInterfaceInfo *o)
static PyObject * pygpu_shader_info_uniform_buf(BPyGPUShaderCreateInfo *self, PyObject *args)
static PyObject * pygpu_interface_info__tp_new(PyTypeObject *, PyObject *args, PyObject *kwds)
static PyObject * pygpu_shader_info_compute_source(BPyGPUShaderCreateInfo *self, PyObject *o)
static int pygpu_interface_info__tp_clear(PyObject *self)
static int constant_type_size(Type type)
static PyObject * pygpu_interface_info_smooth(BPyGPUStageInterfaceInfo *self, PyObject *args)
static PyObject * pygpu_shader_info_local_group_size(BPyGPUShaderCreateInfo *self, PyObject *args)
static PyObject * pygpu_interface_info_no_perspective(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)
static PyObject * pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds)
static PyObject * pygpu_interface_info_flat(BPyGPUStageInterfaceInfo *self, PyObject *args)
static const PyC_StringEnumItems pygpu_imagetype_items[]
static PyObject * pygpu_shader_info_sampler(BPyGPUShaderCreateInfo *self, PyObject *args)
static int constants_calc_size(ShaderCreateInfo *info)
PyObject * BPyGPUStageInterfaceInfo_CreatePyObject(GPUStageInterfaceInfo *interface)
static void pygpu_shader_info__tp_dealloc(PyObject *self)
static PyGetSetDef pygpu_interface_info__tp_getseters[]
static const PyC_StringEnumItems pygpu_depth_write_items[]
static int pygpu_interface_info__tp_traverse(PyObject *self, visitproc visit, void *arg)
static PyObject * pygpu_shader_info_define(BPyGPUShaderCreateInfo *self, PyObject *args)
static PyObject * pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds)
static PyObject * pygpu_shader_info_image(BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds)
static const PyC_StringEnumItems pygpu_dualblend_items[]
const PyC_StringEnumItems pygpu_tex_format_items[]
static PyObject * pygpu_interface_info_name_get(BPyGPUStageInterfaceInfo *self, void *)
#define PYDOC_IMAGE_TYPES
static void pygpu_interface_info__tp_dealloc(PyObject *self)
static PyObject * pygpu_shader_info_typedef_source(BPyGPUShaderCreateInfo *self, PyObject *o)
static PyObject * pygpu_shader_info_vertex_in(BPyGPUShaderCreateInfo *self, PyObject *args)
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")
#define PYDOC_TEX_FORMAT_ITEMS
static PyMethodDef pygpu_shader_info__tp_methods[]
static const PyC_FlagSet pygpu_qualifiers[]
static PyObject * pygpu_shader_info_depth_write(BPyGPUShaderCreateInfo *self, PyObject *args)
static PyMethodDef pygpu_interface_info__tp_methods[]
static int pygpu_shader_info__tp_clear(PyObject *self)
static bool pygpu_interface_info_get_args(BPyGPUStageInterfaceInfo *self, PyObject *args, const char *format, Type *r_type, const char **r_name)
const PyC_StringEnumItems pygpu_textureformat_items[]
constexpr int GPU_DEPTH24_STENCIL8_DEPRECATED
constexpr int GPU_DEPTH_COMPONENT24_DEPRECATED
int PyC_ParseStringEnum(PyObject *o, void *p)
int PyC_FlagSet_ToBitfield(const PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix)
PyObject * PyC_UnicodeFromStdStr(const std::string &str)
header-only compatibility defines.
#define PY_ARG_PARSER_HEAD_COMPAT()
PyObject * compute_source
PyObject_VAR_HEAD GPUShaderCreateInfo * info
PyObject * fragment_source
PyObject_VAR_HEAD GPUStageInterfaceInfo * interface
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...
Self & compute_source(StringRefNull filename)
Self & fragment_source(StringRefNull filename)
std::string fragment_source_generated
Self & depth_write(DepthWrite value)
Self & vertex_in(int slot, Type type, StringRefNull name)
Self & push_constant(Type type, StringRefNull name, int array_size=0)
Self & typedef_source(StringRefNull filename)
Self & fragment_out(int slot, Type type, StringRefNull name, DualBlend blend=DualBlend::NONE, int raster_order_group=-1)
std::string vertex_source_generated
Self & vertex_out(StageInterfaceInfo &interface)
std::string typedef_source_generated
Self & vertex_source(StringRefNull filename)
Self & sampler(int slot, ImageType type, StringRefNull name, Frequency freq=Frequency::PASS, GPUSamplerState sampler=GPUSamplerState::internal_sampler())
Self & image(int slot, TextureFormat format, Qualifier qualifiers, ImageReadWriteType type, StringRefNull name, Frequency freq=Frequency::PASS)
Self & uniform_buf(int slot, StringRefNull type_name, StringRefNull name, Frequency freq=Frequency::PASS)
std::string compute_source_generated
Self & local_group_size(int local_size_x, int local_size_y=1, int local_size_z=1)
Self & define(StringRefNull name, StringRefNull value="")
Vector< StringRefNull > typedef_sources_
Vector< PushConst > push_constants_