55 if (PyTuple_GET_SIZE(args) || (kwds && PyDict_Size(kwds))) {
56 PyErr_SetString(PyExc_ValueError,
"This function takes no arguments");
68 const uint sizes[] = {1, 1, 2, 2, 4, 4, 4};
69 return len * sizes[type];
74 pygpu_vertformat_attr_add_doc,
75 ".. method:: attr_add(id, comp_type, len, fetch_mode)\n"
77 " Add a new attribute to the format.\n"
79 " :arg id: Name the attribute. Often ``position``, ``normal``, ...\n"
81 " :arg comp_type: The data type that will be used store the value in memory.\n"
82 " Possible values are ``I8``, ``U8``, ``I16``, ``U16``, ``I32``, ``U32``, ``F32`` & "
84 " :type comp_type: str\n"
85 " :arg len: How many individual values the attribute consists of\n"
86 " (e.g. 2 for uv coordinates).\n"
88 " :arg fetch_mode: How values from memory will be converted when used in the shader.\n"
89 " This is mainly useful for memory optimizations when you want to store values with\n"
90 " reduced precision. E.g. you can store a float in only 1 byte but it will be\n"
91 " converted to a normal 4 byte float when used.\n"
92 " Possible values are ``FLOAT``, ``INT`` or ``INT_TO_FLOAT_UNIT``.\n"
93 " :type fetch_mode: str\n");
106 static const char *_keywords[] = {
"id",
"comp_type",
"len",
"fetch_mode",
nullptr};
107 static _PyArg_Parser _parser = {
118 if (!_PyArg_ParseTupleAndKeywordsFast(args,
136 PyExc_DeprecationWarning,
137 "Using GPUVertFormat.attr_add(...) with component count greater than 4 is deprecated. "
138 "Use several attributes for each matrix columns instead.",
143 PyErr_WarnEx(PyExc_DeprecationWarning,
144 "Using GPUVertFormat.attr_add(...) with a format that is not 4 bytes aligned is "
145 "deprecated. Add padding components and/or higher precision integers.",
150 &
self->fmt,
id, comp_type_enum,
len, fetch_mode_enum);
152 return PyLong_FromLong(
attr_id);
157# pragma clang diagnostic push
158# pragma clang diagnostic ignored "-Wcast-function-type"
160# pragma GCC diagnostic push
161# pragma GCC diagnostic ignored "-Wcast-function-type"
168 METH_VARARGS | METH_KEYWORDS,
169 pygpu_vertformat_attr_add_doc},
170 {
nullptr,
nullptr, 0,
nullptr},
175# pragma clang diagnostic pop
177# pragma GCC diagnostic pop
188 pygpu_vertformat__tp_doc,
189 ".. class:: GPUVertFormat()\n"
191 " This object contains information about the structure of a vertex buffer.\n");
193 PyVarObject_HEAD_INIT(
nullptr, 0)
213 pygpu_vertformat__tp_doc,
259 memset(&
self->fmt, 0,
sizeof(
self->fmt));
262 return (PyObject *)
self;
struct @021025263243242147216143265077100330027142264337::@240232116316110053135047106323056371161236243121 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()