Blender V5.3
gpu_py_buffer.cc File Reference
#include <Python.h>
#include <algorithm>
#include "BLI_utildefines.hh"
#include "MEM_guardedalloc.h"
#include "GPU_texture.hh"
#include "../generic/py_capi_utils.hh"
#include "gpu_py.hh"
#include "gpu_py_buffer.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define PYGPU_BUFFER_PROTOCOL
#define MAX_DIMENSIONS   64

Functions

Utility Functions
static Py_ssize_t blender::pygpu_buffer_dimensions_tot_elem (const Py_ssize_t *shape, Py_ssize_t shape_len)
static bool blender::pygpu_buffer_dimensions_tot_len_compare (const Py_ssize_t *shape_a, const Py_ssize_t shape_a_len, const Py_ssize_t *shape_b, const Py_ssize_t shape_b_len)
static bool blender::pygpu_buffer_pyobj_as_shape (PyObject *shape_obj, Py_ssize_t r_shape[MAX_DIMENSIONS], Py_ssize_t *r_shape_len)
static const char * blender::pygpu_buffer_formatstr (eGPUDataFormat data_format)

BPyGPUBuffer API

static PyMethodDef blender::pygpu_buffer__tp_methods []
static PyGetSetDef blender::pygpu_buffer_getseters []
static PySequenceMethods blender::pygpu_buffer__tp_as_sequence
static PyMappingMethods blender::pygpu_buffer__tp_as_mapping
static PyBufferProcs blender::pygpu_buffer__tp_as_buffer
PyTypeObject blender::BPyGPU_BufferType
static BPyGPUBuffer * blender::pygpu_buffer_make_from_data (PyObject *parent, const eGPUDataFormat format, const int shape_len, const Py_ssize_t *shape, void *buf)
static PyObject * blender::pygpu_buffer__sq_item (BPyGPUBuffer *self, Py_ssize_t i)
static PyObject * blender::pygpu_buffer_to_list (BPyGPUBuffer *self)
 blender::PyDoc_STRVAR (pygpu_buffer_to_list_doc, ".. method:: to_list()\n" "\n" " Return the buffer as a list.\n" "\n" " :return: The buffer as a list.\n" " :rtype: list\n")
static PyObject * blender::pygpu_buffer_to_list_recursive (BPyGPUBuffer *self)
 blender::PyDoc_STRVAR (pygpu_buffer_dimensions_doc, "The size of the buffer for each dimension.\n" "\n" "Setting the dimensions is supported when the total number of elements is unchanged.\n" "\n" ":type: list[int]\n")
static PyObject * blender::pygpu_buffer_dimensions_get (BPyGPUBuffer *self, void *)
static int blender::pygpu_buffer_dimensions_set (BPyGPUBuffer *self, PyObject *value, void *)
static int blender::pygpu_buffer__tp_traverse (BPyGPUBuffer *self, visitproc visit, void *arg)
static int blender::pygpu_buffer__tp_clear (BPyGPUBuffer *self)
static void blender::pygpu_buffer__tp_dealloc (BPyGPUBuffer *self)
static PyObject * blender::pygpu_buffer__tp_repr (BPyGPUBuffer *self)
static int blender::pygpu_buffer__sq_ass_item (BPyGPUBuffer *self, Py_ssize_t i, PyObject *v)
static int blender::pygpu_buffer_ass_slice (BPyGPUBuffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq)
static PyObject * blender::pygpu_buffer__tp_new (PyTypeObject *, PyObject *args, PyObject *kwds)
static int blender::pygpu_buffer__tp_is_gc (BPyGPUBuffer *self)
static Py_ssize_t blender::pygpu_buffer__sq_length (BPyGPUBuffer *self)
static PyObject * blender::pygpu_buffer_slice (BPyGPUBuffer *self, Py_ssize_t begin, Py_ssize_t end)
static PyObject * blender::pygpu_buffer__mp_subscript (BPyGPUBuffer *self, PyObject *item)
static int blender::pygpu_buffer__mp_ass_subscript (BPyGPUBuffer *self, PyObject *item, PyObject *value)
static void blender::pygpu_buffer_strides_calc (const eGPUDataFormat format, const int shape_len, const Py_ssize_t *shape, Py_ssize_t *r_strides)
static int blender::pygpu_buffer__bf_getbuffer (BPyGPUBuffer *self, Py_buffer *view, int flags)
static void blender::pygpu_buffer__bf_releasebuffer (PyObject *, Py_buffer *view)
 blender::PyDoc_STRVAR (pygpu_buffer__tp_doc, ".. class:: Buffer\n" "\n" " For Python access to GPU functions requiring a pointer.\n" "\n" " .. method:: __init__(format, dimensions, data)\n" "\n" " :param format: Format type to interpret the buffer.\n" " ``UINT_24_8`` is deprecated, use ``FLOAT`` instead.\n" " :type format: " PYDOC_DATAFORMAT_LITERAL "\n" " :param dimensions: Array describing the dimensions.\n" " :type dimensions: int | Sequence[int]\n" " :param data: Optional data array.\n" " :type data: Buffer | Sequence[float] | Sequence[int]\n")
static size_t blender::pygpu_buffer_calc_size (const int format, const int shape_len, const Py_ssize_t *shape)
size_t blender::bpygpu_Buffer_size (BPyGPUBuffer *buffer)
BPyGPUBuffer * blender::BPyGPU_Buffer_CreatePyObject (const int format, const Py_ssize_t *shape, const int shape_len, void *buffer)

Detailed Description

This file defines the gpu.types.Buffer API.

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

Definition in file gpu_py_buffer.cc.

Macro Definition Documentation

◆ MAX_DIMENSIONS

◆ PYGPU_BUFFER_PROTOCOL

#define PYGPU_BUFFER_PROTOCOL

Definition at line 32 of file gpu_py_buffer.cc.