59 if (PyTuple_GET_SIZE(args) || (kwds && PyDict_Size(kwds))) {
60 PyErr_SetString(PyExc_ValueError,
"This function takes no arguments");
72 const uint sizes[] = {1, 1, 2, 2, 4, 4, 4};
73 return len * sizes[type];
78 pygpu_vertformat_attr_add_doc,
79 ".. method:: attr_add(id, comp_type, len, fetch_mode)\n"
81 " Add a new attribute to the format.\n"
83 " :arg id: Name the attribute. Often `position`, `normal`, ...\n"
85 " :arg comp_type: The data type that will be used store the value in memory.\n"
86 " Possible values are `I8`, `U8`, `I16`, `U16`, `I32`, `U32`, `F32` and `I10`.\n"
87 " :type comp_type: str\n"
88 " :arg len: How many individual values the attribute consists of\n"
89 " (e.g. 2 for uv coordinates).\n"
91 " :arg fetch_mode: How values from memory will be converted when used in the shader.\n"
92 " This is mainly useful for memory optimizations when you want to store values with\n"
93 " reduced precision. E.g. you can store a float in only 1 byte but it will be\n"
94 " converted to a normal 4 byte float when used.\n"
95 " Possible values are `FLOAT`, `INT`, `INT_TO_FLOAT_UNIT` and `INT_TO_FLOAT`.\n"
96 " :type fetch_mode: str\n");
109 static const char *_keywords[] = {
"id",
"comp_type",
"len",
"fetch_mode",
nullptr};
110 static _PyArg_Parser _parser = {
121 if (!_PyArg_ParseTupleAndKeywordsFast(args,
139 PyExc_DeprecationWarning,
140 "Using GPUVertFormat.attr_add(...) with component count greater than 4 is deprecated. "
141 "Use several attributes for each matrix columns instead.",
146 PyErr_WarnEx(PyExc_DeprecationWarning,
147 "Using GPUVertFormat.attr_add(...) with a format that is not 4 bytes aligned is "
148 "deprecated. Add padding components and/or higher precision integers.",
157 PyErr_Format(PyExc_RuntimeError,
158 "GPUVertFormat.attr_add(...) fetch_mode set to INT_TO_FLOAT but component type "
165 PyExc_DeprecationWarning,
166 "Using GPUVertFormat.attr_add(...) with fetch_mode set to INT_TO_FLOAT is deprecated. "
167 "Use 'F32' component type with fetch_mode 'FLOAT' instead.",
173 self->fmt.attrs[
attr_id].python_int_to_float = int_to_float;
175 return PyLong_FromLong(
attr_id);
180# pragma clang diagnostic push
181# pragma clang diagnostic ignored "-Wcast-function-type"
183# pragma GCC diagnostic push
184# pragma GCC diagnostic ignored "-Wcast-function-type"
191 METH_VARARGS | METH_KEYWORDS,
192 pygpu_vertformat_attr_add_doc},
193 {
nullptr,
nullptr, 0,
nullptr},
198# pragma clang diagnostic pop
200# pragma GCC diagnostic pop
211 pygpu_vertformat__tp_doc,
212 ".. class:: GPUVertFormat()\n"
214 " This object contains information about the structure of a vertex buffer.\n");
216 PyVarObject_HEAD_INIT(
nullptr, 0)
236 pygpu_vertformat__tp_doc,
282 memset(&
self->fmt, 0,
sizeof(
self->fmt));
285 return (PyObject *)
self;
struct @064345207361167251075330302113175271221317160336::@201157344026354305110036153026103256267276205234 attr_id
#define BPYGPU_IS_INIT_OR_ERROR_OBJ
int PyC_ParseStringEnum(PyObject *o, void *p)
header-only compatibility defines.
#define PY_ARG_PARSER_HEAD_COMPAT()