Blender
V3.3
|
#include <Python.h>
#include "BLI_string.h"
#include "DNA_image_types.h"
#include "GPU_context.h"
#include "GPU_texture.h"
#include "BKE_image.h"
#include "../generic/py_capi_utils.h"
#include "gpu_py.h"
#include "gpu_py_buffer.h"
#include "gpu_py_texture.h"
Go to the source code of this file.
Functions | |
Local API | |
int | bpygpu_ParseTexture (PyObject *o, void *p) |
PyObject * | bpygpu_texture_init (void) |
Public API | |
PyObject * | BPyGPUTexture_CreatePyObject (GPUTexture *tex, bool shared_reference) |
GPUTexture Common Utilities | |
#define | BPYGPU_TEXTURE_CHECK_OBJ(bpygpu) |
static const struct PyC_StringEnumItems | pygpu_textureformat_items [] |
static int | pygpu_texture_valid_check (BPyGPUTexture *bpygpu_tex) |
GPUTexture Type | |
static PyGetSetDef | pygpu_texture__tp_getseters [] |
static struct PyMethodDef | pygpu_texture__tp_methods [] |
PyTypeObject | BPyGPUTexture_Type |
static PyObject * | pygpu_texture__tp_new (PyTypeObject *UNUSED(self), PyObject *args, PyObject *kwds) |
PyDoc_STRVAR (pygpu_texture_width_doc, "Width of the texture.\n\n:type: `int`") | |
static PyObject * | pygpu_texture_width_get (BPyGPUTexture *self, void *UNUSED(type)) |
PyDoc_STRVAR (pygpu_texture_height_doc, "Height of the texture.\n\n:type: `int`") | |
static PyObject * | pygpu_texture_height_get (BPyGPUTexture *self, void *UNUSED(type)) |
PyDoc_STRVAR (pygpu_texture_format_doc, "Format of the texture.\n\n:type: `str`") | |
static PyObject * | pygpu_texture_format_get (BPyGPUTexture *self, void *UNUSED(type)) |
PyDoc_STRVAR (pygpu_texture_clear_doc, ".. method:: clear(format='FLOAT', value=(0.0, 0.0, 0.0, 1.0))\n" "\n" " Fill texture with specific value.\n" "\n" " :param format: The format that describes the content of a single item.\n" " Possible values are `FLOAT`, `INT`, `UINT`, `UBYTE`, `UINT_24_8` and `10_11_11_REV`.\n" " :type type: str\n" " :arg value: sequence each representing the value to fill.\n" " :type value: sequence of 1, 2, 3 or 4 values\n") | |
static PyObject * | pygpu_texture_clear (BPyGPUTexture *self, PyObject *args, PyObject *kwds) |
PyDoc_STRVAR (pygpu_texture_read_doc, ".. method:: read()\n" "\n" " Creates a buffer with the value of all pixels.\n" "\n") | |
static PyObject * | pygpu_texture_read (BPyGPUTexture *self) |
static void | BPyGPUTexture__tp_dealloc (BPyGPUTexture *self) |
PyDoc_STRVAR (pygpu_texture__tp_doc, ".. class:: GPUTexture(size, layers=0, is_cubemap=False, format='RGBA8', data=None)\n" "\n" " This object gives access to off GPU textures.\n" "\n" " :arg size: Dimensions of the texture 1D, 2D, 3D or cubemap.\n" " :type size: tuple or int\n" " :arg layers: Number of layers in texture array or number of cubemaps in cubemap array\n" " :type layers: int\n" " :arg is_cubemap: Indicates the creation of a cubemap texture.\n" " :type is_cubemap: int\n" " :arg format: Internal data format inside GPU memory. Possible values are:\n" " `RGBA8UI`,\n" " `RGBA8I`,\n" " `RGBA8`,\n" " `RGBA32UI`,\n" " `RGBA32I`,\n" " `RGBA32F`,\n" " `RGBA16UI`,\n" " `RGBA16I`,\n" " `RGBA16F`,\n" " `RGBA16`,\n" " `RG8UI`,\n" " `RG8I`,\n" " `RG8`,\n" " `RG32UI`,\n" " `RG32I`,\n" " `RG32F`,\n" " `RG16UI`,\n" " `RG16I`,\n" " `RG16F`,\n" " `RG16`,\n" " `R8UI`,\n" " `R8I`,\n" " `R8`,\n" " `R32UI`,\n" " `R32I`,\n" " `R32F`,\n" " `R16UI`,\n" " `R16I`,\n" " `R16F`,\n" " `R16`,\n" " `R11F_G11F_B10F`,\n" " `DEPTH32F_STENCIL8`,\n" " `DEPTH24_STENCIL8`,\n" " `SRGB8_A8`,\n" " `RGB16F`,\n" " `SRGB8_A8_DXT1`,\n" " `SRGB8_A8_DXT3`,\n" " `SRGB8_A8_DXT5`,\n" " `RGBA8_DXT1`,\n" " `RGBA8_DXT3`,\n" " `RGBA8_DXT5`,\n" " `DEPTH_COMPONENT32F`,\n" " `DEPTH_COMPONENT24`,\n" " `DEPTH_COMPONENT16`,\n" " :type format: str\n" " :arg data: Buffer object to fill the texture.\n" " :type data: :class:`gpu.types.Buffer`\n") | |
GPU Texture module | |
static struct PyMethodDef | pygpu_texture__m_methods [] |
static PyModuleDef | pygpu_texture_module_def |
PyDoc_STRVAR (pygpu_texture_from_image_doc, ".. function:: from_image(image)\n" "\n" " Get GPUTexture corresponding to an Image datablock. The GPUTexture memory is " "shared with Blender.\n" " Note: Colors read from the texture will be in scene linear color space and have " "premultiplied or straight alpha matching the image alpha mode.\n" "\n" " :arg image: The Image datablock.\n" " :type image: :class:`bpy.types.Image`\n" " :return: The GPUTexture used by the image.\n" " :rtype: :class:`gpu.types.GPUTexture`\n") | |
static PyObject * | pygpu_texture_from_image (PyObject *UNUSED(self), PyObject *arg) |
PyDoc_STRVAR (pygpu_texture__m_doc, "This module provides utils for textures.") | |
This file defines the texture functionalities of the 'gpu' module
bpygpu_
for local API.BPyGPU
for public API. Definition in file gpu_py_texture.c.
#define BPYGPU_TEXTURE_CHECK_OBJ | ( | bpygpu | ) |
Definition at line 98 of file gpu_py_texture.c.
int bpygpu_ParseTexture | ( | PyObject * | o, |
void * | p | ||
) |
Definition at line 579 of file gpu_py_texture.c.
References BPyGPUTexture_Check, NULL, pygpu_texture_valid_check(), tex, and UNLIKELY.
Referenced by pygpu_framebuffer_new_parse_arg().
PyObject* bpygpu_texture_init | ( | void | ) |
Definition at line 600 of file gpu_py_texture.c.
References pygpu_texture_module_def.
Referenced by BPyInit_gpu().
|
static |
Definition at line 427 of file gpu_py_texture.c.
References GPU_texture_free(), GPU_texture_py_reference_set(), NULL, and self.
PyObject* BPyGPUTexture_CreatePyObject | ( | GPUTexture * | tex, |
bool | shared_reference | ||
) |
Definition at line 614 of file gpu_py_texture.c.
References BLI_assert, BPyGPUTexture_Type, GPU_texture_py_reference_get(), GPU_texture_py_reference_set(), GPU_texture_ref(), NULL, POINTER_OFFSET, self, and tex.
Referenced by pygpu_offscreen_texture_color_get(), and pygpu_texture__tp_new().
PyDoc_STRVAR | ( | pygpu_texture__m_doc | , |
"This module provides utils for textures." | |||
) |
PyDoc_STRVAR | ( | pygpu_texture__tp_doc | , |
".. class:: GPUTexture(size, layers=0, is_cubemap=False, format='RGBA8', data=None)\n" "\n" " This object gives access to off GPU textures.\n" "\n" " :arg size: Dimensions of the texture | 1D, | ||
2D | , | ||
3D or cubemap.\n" " :type size:tuple or int\n" " :arg layers:Number of layers in texture array or number of cubemaps in cubemap array\n" " :type layers:int\n" " :arg is_cubemap:Indicates the creation of a cubemap texture.\n" " :type is_cubemap:int\n" " :arg format:Internal data format inside GPU memory. Possible values are:\n" " `RGBA8UI` | , | ||
\n" " `RGBA8I` | , | ||
\n" " `RGBA8` | , | ||
\n" " `RGBA32UI` | , | ||
\n" " `RGBA32I` | , | ||
\n" " `RGBA32F` | , | ||
\n" " `RGBA16UI` | , | ||
\n" " `RGBA16I` | , | ||
\n" " `RGBA16F` | , | ||
\n" " `RGBA16` | , | ||
\n" " `RG8UI` | , | ||
\n" " `RG8I` | , | ||
\n" " `RG8` | , | ||
\n" " `RG32UI` | , | ||
\n" " `RG32I` | , | ||
\n" " `RG32F` | , | ||
\n" " `RG16UI` | , | ||
\n" " `RG16I` | , | ||
\n" " `RG16F` | , | ||
\n" " `RG16` | , | ||
\n" " `R8UI` | , | ||
\n" " `R8I` | , | ||
\n" " `R8` | , | ||
\n" " `R32UI` | , | ||
\n" " `R32I` | , | ||
\n" " `R32F` | , | ||
\n" " `R16UI` | , | ||
\n" " `R16I` | , | ||
\n" " `R16F` | , | ||
\n" " `R16` | , | ||
\n" " `R11F_G11F_B10F` | , | ||
\n" " `DEPTH32F_STENCIL8` | , | ||
\n" " `DEPTH24_STENCIL8` | , | ||
\n" " `SRGB8_A8` | , | ||
\n" " `RGB16F` | , | ||
\n" " `SRGB8_A8_DXT1` | , | ||
\n" " `SRGB8_A8_DXT3` | , | ||
\n" " `SRGB8_A8_DXT5` | , | ||
\n" " `RGBA8_DXT1` | , | ||
\n" " `RGBA8_DXT3` | , | ||
\n" " `RGBA8_DXT5` | , | ||
\n" " `DEPTH_COMPONENT32F` | , | ||
\n" " `DEPTH_COMPONENT24` | , | ||
\n" " `DEPTH_COMPONENT16` | , | ||
\n" " :type format:str\n" " :arg data:Buffer object to fill the texture.\n" " :type data::class:`gpu.types.Buffer`\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_texture_clear_doc | , |
".. method:: clear(format='FLOAT', value=(0.0, 0.0, 0.0, 1.0))\n" "\n" " Fill texture with specific value.\n" "\n" " :param format: The format that describes the content of a single item.\n" " Possible values are `FLOAT` | , | ||
`INT` | , | ||
`UINT` | , | ||
`UBYTE` | , | ||
`UINT_24_8` and `10_11_11_REV`.\n" " :type type:str\n" " :arg value:sequence each representing the value to fill.\n" " :type value:sequence of | 1, | ||
2 | , | ||
3 or 4 values\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_texture_format_doc | , |
"Format of the texture.\n\n:type: `str`" | |||
) |
PyDoc_STRVAR | ( | pygpu_texture_from_image_doc | , |
".. function:: from_image(image)\n" "\n" " Get GPUTexture corresponding to an Image datablock. The GPUTexture memory is " "shared with Blender.\n" " Note: Colors read from the texture will be in scene linear color space and have " "premultiplied or straight alpha matching the image alpha mode.\n" "\n" " :arg image: The Image datablock.\n" " :type image: :class:`bpy.types.Image`\n" " :return: The GPUTexture used by the image.\n" " :rtype: :class:`gpu.types.GPUTexture`\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_texture_height_doc | , |
"Height of the texture.\n\n:type: `int`" | |||
) |
PyDoc_STRVAR | ( | pygpu_texture_read_doc | , |
".. method:: read()\n" "\n" " Creates a buffer with the value of all pixels.\n" "\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_texture_width_doc | , |
"Width of the texture.\n\n:type: `int`" | |||
) |
|
static |
Definition at line 112 of file gpu_py_texture.c.
References BPyGPUBuffer::as_void, bpygpu_Buffer_size(), BPyGPU_BufferType, BPYGPU_IS_INIT_OR_ERROR_OBJ, BPyGPUTexture_CreatePyObject(), BPyGPUBuffer::buf, data, float(), BPyGPUBuffer::format, GPU_context_active_get(), GPU_DATA_FLOAT, GPU_RGBA8, GPU_texture_component_len(), GPU_texture_create_1d(), GPU_texture_create_1d_array(), GPU_texture_create_2d(), GPU_texture_create_2d_array(), GPU_texture_create_3d(), GPU_texture_create_cube(), GPU_texture_create_cube_array(), len, max_ii(), NULL, PyC_AsArray(), PyC_ParseStringEnum(), pygpu_textureformat_items, size(), STRNCPY, tex, and PyC_StringEnum::value_found.
|
static |
Definition at line 288 of file gpu_py_texture.c.
References bpygpu_dataformat_items, BPYGPU_TEXTURE_CHECK_OBJ, Freestyle::c, ELEM, GPU_DATA_10_11_11_REV, GPU_DATA_FLOAT, GPU_DATA_UBYTE, GPU_DATA_UINT_24_8, GPU_texture_clear(), NULL, PyC_AsArray(), PyC_ParseStringEnum(), self, and PyC_StringEnum::value_found.
|
static |
Definition at line 270 of file gpu_py_texture.c.
References BPYGPU_TEXTURE_CHECK_OBJ, GPU_texture_format(), PyC_StringEnum_FindIDFromValue(), pygpu_textureformat_items, and self.
|
static |
Definition at line 546 of file gpu_py_texture.c.
|
static |
Definition at line 263 of file gpu_py_texture.c.
References BPYGPU_TEXTURE_CHECK_OBJ, GPU_texture_height(), and self.
|
static |
Definition at line 359 of file gpu_py_texture.c.
References BPyGPU_Buffer_CreatePyObject(), BPYGPU_TEXTURE_CHECK_OBJ, GPU_DATA_10_11_11_REV, GPU_DATA_FLOAT, GPU_DATA_INT, GPU_DATA_UBYTE, GPU_DATA_UINT, GPU_DATA_UINT_24_8, GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8, GPU_DEPTH_COMPONENT16, GPU_DEPTH_COMPONENT24, GPU_DEPTH_COMPONENT32F, GPU_R11F_G11F_B10F, GPU_R16I, GPU_R16UI, GPU_R32UI, GPU_R8, GPU_R8UI, GPU_RG16I, GPU_RG16UI, GPU_RG8, GPU_RGBA8, GPU_RGBA8UI, GPU_SRGB8_A8, GPU_texture_component_len(), GPU_texture_format(), GPU_texture_height(), GPU_texture_read(), GPU_texture_width(), and self.
|
static |
Definition at line 82 of file gpu_py_texture.c.
References BPYGPU_USE_GPUOBJ_FREE_METHOD, NULL, BPyGPUTexture::tex, and UNLIKELY.
Referenced by bpygpu_ParseTexture().
|
static |
Definition at line 256 of file gpu_py_texture.c.
References BPYGPU_TEXTURE_CHECK_OBJ, GPU_texture_width(), and self.
PyTypeObject BPyGPUTexture_Type |
Definition at line 517 of file gpu_py_texture.c.
Referenced by bpygpu_types_init(), BPyGPUTexture_CreatePyObject(), and pygpu_shader_uniform_sampler().
|
static |
Definition at line 546 of file gpu_py_texture.c.
|
static |
Definition at line 438 of file gpu_py_texture.c.
|
static |
Definition at line 438 of file gpu_py_texture.c.
|
static |
Definition at line 566 of file gpu_py_texture.c.
Referenced by bpygpu_texture_init().
|
static |
Definition at line 1 of file gpu_py_texture.c.
Referenced by pygpu_texture__tp_new(), and pygpu_texture_format_get().