Blender  V2.93
gpu_py_buffer.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #pragma once
22 
23 extern PyTypeObject BPyGPU_BufferType;
24 
25 #define BPyGPU_Buffer_Check(v) (Py_TYPE(v) == &BPyGPU_BufferType)
26 
32 typedef struct BPyGPUBuffer {
33  PyObject_VAR_HEAD
34  PyObject *parent;
35 
36  int format;
37  int shape_len;
38  Py_ssize_t *shape;
39 
40  union {
41  char *as_byte;
42  int *as_int;
44  float *as_float;
45 
46  void *as_void;
47  } buf;
49 
52  const Py_ssize_t *shape,
53  const int shape_len,
54  void *buffer);
unsigned int uint
Definition: BLI_sys_types.h:83
BPyGPUBuffer * BPyGPU_Buffer_CreatePyObject(const int format, const Py_ssize_t *shape, const int shape_len, void *buffer)
PyTypeObject BPyGPU_BufferType
struct BPyGPUBuffer BPyGPUBuffer
size_t bpygpu_Buffer_size(BPyGPUBuffer *buffer)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
format
Definition: logImageCore.h:47
Py_ssize_t * shape
Definition: gpu_py_buffer.h:38
void * as_void
Definition: gpu_py_buffer.h:46
PyObject_VAR_HEAD PyObject * parent
Definition: gpu_py_buffer.h:34
float * as_float
Definition: gpu_py_buffer.h:44
union BPyGPUBuffer::@1119 buf
char * as_byte
Definition: gpu_py_buffer.h:41
uint * as_uint
Definition: gpu_py_buffer.h:43