|
Blender V4.3
|
#include <Python.h>#include "BLI_string.h"#include "DNA_image_types.h"#include "GPU_context.hh"#include "GPU_texture.hh"#include "BKE_image.hh"#include "../generic/py_capi_utils.hh"#include "../generic/python_compat.hh"#include "gpu_py.hh"#include "gpu_py_buffer.hh"#include "gpu_py_texture.hh"Go to the source code of this file.
Functions | |
Local API | |
| int | bpygpu_ParseTexture (PyObject *o, void *p) |
| PyObject * | bpygpu_texture_init () |
Public API | |
| PyObject * | BPyGPUTexture_CreatePyObject (GPUTexture *tex, bool shared_reference) |
GPUTexture Common Utilities | |
| #define | BPYGPU_TEXTURE_CHECK_OBJ(bpygpu) |
| const PyC_StringEnumItems | pygpu_textureformat_items [] |
| static int | pygpu_texture_valid_check (BPyGPUTexture *bpygpu_tex) |
GPUTexture Type | |
| static PyGetSetDef | pygpu_texture__tp_getseters [] |
| static PyMethodDef | pygpu_texture__tp_methods [] |
| PyTypeObject | BPyGPUTexture_Type |
| static PyObject * | pygpu_texture__tp_new (PyTypeObject *, 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 *) |
| PyDoc_STRVAR (pygpu_texture_height_doc, "Height of the texture.\n" "\n" ":type: int") | |
| static PyObject * | pygpu_texture_height_get (BPyGPUTexture *self, void *) |
| PyDoc_STRVAR (pygpu_texture_format_doc, "Format of the texture.\n" "\n" ":type: str") | |
| static PyObject * | pygpu_texture_format_get (BPyGPUTexture *self, void *) |
| 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" " :arg 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 format: str\n" " :arg value: Sequence each representing the value to fill. Sizes 1..4 are supported.\n" " :type value: Sequence[float]\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: int | Sequence[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 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 *, 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.cc.
| #define BPYGPU_TEXTURE_CHECK_OBJ | ( | bpygpu | ) |
Definition at line 101 of file gpu_py_texture.cc.
Referenced by pygpu_texture_clear(), pygpu_texture_format_get(), pygpu_texture_height_get(), pygpu_texture_read(), and pygpu_texture_width_get().
| int bpygpu_ParseTexture | ( | PyObject * | o, |
| void * | p ) |
Definition at line 709 of file gpu_py_texture.cc.
References BPyGPUTexture_Check, pygpu_texture_valid_check(), tex, and UNLIKELY.
Referenced by pygpu_framebuffer_new_parse_arg().
| PyObject * bpygpu_texture_init | ( | ) |
Definition at line 730 of file gpu_py_texture.cc.
References pygpu_texture_module_def.
Referenced by BPyInit_gpu().
|
static |
Definition at line 488 of file gpu_py_texture.cc.
References GPU_texture_free(), GPU_texture_py_reference_set(), and self.
| PyObject * BPyGPUTexture_CreatePyObject | ( | GPUTexture * | tex, |
| bool | shared_reference ) |
Definition at line 744 of file gpu_py_texture.cc.
References BLI_assert, BPyGPUTexture_Type, GPU_texture_py_reference_get(), GPU_texture_py_reference_set(), GPU_texture_ref(), offsetof, POINTER_OFFSET, self, and tex.
Referenced by pygpu_offscreen_texture_color_get(), pygpu_texture__tp_new(), and pygpu_texture_from_image().
| 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:int|Sequence\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` | [int], | ||
| \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" " :arg 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 format:str\n" " :arg value:Sequence each representing the value to fill. Sizes 1..4 are supported.\n" " :type value:Sequence\n" | [float] ) |
| 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 115 of file gpu_py_texture.cc.
References BPyGPUBuffer::as_void, bpygpu_Buffer_size(), BPyGPU_BufferType, BPYGPU_IS_INIT_OR_ERROR_OBJ, BPyGPUTexture_CreatePyObject(), BPyGPUBuffer::buf, 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(), GPU_TEXTURE_USAGE_GENERAL, len, max_ii(), PY_ARG_PARSER_HEAD_COMPAT, PyC_AsArray(), PyC_ParseStringEnum(), pygpu_textureformat_items, STRNCPY, tex, and PyC_StringEnum::value_found.
|
static |
Definition at line 342 of file gpu_py_texture.cc.
References bpygpu_dataformat_items, BPYGPU_TEXTURE_CHECK_OBJ, ELEM, GPU_DATA_10_11_11_REV, GPU_DATA_FLOAT, GPU_DATA_UBYTE, GPU_DATA_UINT_24_8, GPU_texture_clear(), PY_ARG_PARSER_HEAD_COMPAT, PyC_AsArray(), PyC_ParseStringEnum(), self, and PyC_StringEnum::value_found.
|
static |
Definition at line 323 of file gpu_py_texture.cc.
References BPYGPU_TEXTURE_CHECK_OBJ, GPU_texture_format(), PyC_StringEnum_FindIDFromValue(), pygpu_textureformat_items, and self.
|
static |
Definition at line 668 of file gpu_py_texture.cc.
References BKE_image_get_gpu_texture(), BKE_imageuser_default(), BPyGPUTexture_CreatePyObject(), PyC_RNA_AsPointer(), and tex.
|
static |
Definition at line 311 of file gpu_py_texture.cc.
References BPYGPU_TEXTURE_CHECK_OBJ, GPU_texture_height(), and self.
|
static |
Definition at line 418 of file gpu_py_texture.cc.
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 85 of file gpu_py_texture.cc.
References BPYGPU_USE_GPUOBJ_FREE_METHOD, BPyGPUTexture::tex, and UNLIKELY.
Referenced by bpygpu_ParseTexture().
|
static |
Definition at line 299 of file gpu_py_texture.cc.
References BPYGPU_TEXTURE_CHECK_OBJ, GPU_texture_width(), and self.
| PyTypeObject BPyGPUTexture_Type |
Definition at line 596 of file gpu_py_texture.cc.
Referenced by bpygpu_types_init(), BPyGPUTexture_CreatePyObject(), pygpu_shader_image(), and pygpu_shader_uniform_sampler().
|
static |
Definition at line 682 of file gpu_py_texture.cc.
|
static |
Definition at line 499 of file gpu_py_texture.cc.
|
static |
Definition at line 519 of file gpu_py_texture.cc.
|
static |
Definition at line 691 of file gpu_py_texture.cc.
Referenced by bpygpu_texture_init().
| const PyC_StringEnumItems pygpu_textureformat_items[] |
Definition at line 37 of file gpu_py_texture.cc.
Referenced by pygpu_shader_info_image(), pygpu_texture__tp_new(), and pygpu_texture_format_get().