|
Blender V5.0
|
#include <Python.h>#include "BLI_math_base.h"#include "BLI_string_utf8.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 (blender::gpu::Texture *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\n") | |
| static PyObject * | pygpu_texture_width_get (BPyGPUTexture *self, void *) |
| PyDoc_STRVAR (pygpu_texture_height_doc, "Height of the texture.\n" "\n" ":type: int\n") | |
| static PyObject * | pygpu_texture_height_get (BPyGPUTexture *self, void *) |
| PyDoc_STRVAR (pygpu_texture_format_doc, "Format of the texture.\n" "\n" ":type: str\n") | |
| 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`` & " "``10_11_11_REV``.\n" " ``UINT_24_8`` is deprecated, use ``FLOAT`` instead.\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`` (deprecated, use ``DEPTH32F_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``, (deprecated, use ``DEPTH_COMPONENT32F``),\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 data-block. 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 data-block.\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 utilities for textures.") | |
This file defines the texture functionalities of the 'gpu' module
Definition in file gpu_py_texture.cc.
| #define BPYGPU_TEXTURE_CHECK_OBJ | ( | bpygpu | ) |
Definition at line 102 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().
|
nodiscard |
Definition at line 741 of file gpu_py_texture.cc.
References BPyGPUTexture_Check, pygpu_texture_valid_check(), and UNLIKELY.
Referenced by pygpu_framebuffer_new_parse_arg().
|
nodiscard |
Definition at line 762 of file gpu_py_texture.cc.
References pygpu_texture_module_def.
Referenced by BPyInit_gpu().
|
static |
Definition at line 509 of file gpu_py_texture.cc.
References GPU_texture_free(), GPU_texture_py_reference_set(), and self.
|
nodiscard |
Definition at line 776 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, and self.
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 utilities 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`` | deprecated, use ``DEPTH32F_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`` | , | ||
| (deprecated, use ``DEPTH_COMPONENT32F``) | , | ||
| \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`` &" "``10_11_11_REV``.\n" " ``UINT_24_8`` is | deprecated, | ||
| use ``FLOAT`` instead.\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\n" | ) |
| PyDoc_STRVAR | ( | pygpu_texture_from_image_doc | , |
| ".. function:: from_image(image)\n" "\n" " Get GPUTexture corresponding to an Image data-block. 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 data-block.\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\n" | ) |
| 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\n" | ) |
|
static |
Definition at line 116 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, data, float, BPyGPUBuffer::format, GPU_context_active_get(), GPU_DATA_FLOAT, GPU_DEPTH24_STENCIL8_DEPRECATED, GPU_DEPTH_COMPONENT24_DEPRECATED, 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(), name, PY_ARG_PARSER_HEAD_COMPAT, PyC_AsArray(), PyC_ParseStringEnum(), pygpu_textureformat_items, size(), STRNCPY_UTF8, and PyC_StringEnum::value_found.
|
static |
Definition at line 363 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_DEPRECATED, GPU_texture_clear(), i, PY_ARG_PARSER_HEAD_COMPAT, PyC_AsArray(), PyC_ParseStringEnum(), self, and PyC_StringEnum::value_found.
|
static |
Definition at line 341 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 700 of file gpu_py_texture.cc.
References BKE_image_get_gpu_texture(), BKE_imageuser_default(), BPyGPUTexture_CreatePyObject(), and PyC_RNA_AsPointer().
|
static |
Definition at line 329 of file gpu_py_texture.cc.
References BPYGPU_TEXTURE_CHECK_OBJ, GPU_texture_height(), and self.
|
static |
Definition at line 443 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_texture_component_len(), GPU_texture_format(), GPU_texture_height(), GPU_texture_read(), GPU_texture_width(), and self.
|
static |
Definition at line 86 of file gpu_py_texture.cc.
References BPYGPU_USE_GPUOBJ_FREE_METHOD, BPyGPUTexture::tex, and UNLIKELY.
Referenced by bpygpu_ParseTexture().
|
static |
Definition at line 317 of file gpu_py_texture.cc.
References BPYGPU_TEXTURE_CHECK_OBJ, GPU_texture_width(), and self.
| PyTypeObject BPyGPUTexture_Type |
Definition at line 627 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 714 of file gpu_py_texture.cc.
|
static |
Definition at line 520 of file gpu_py_texture.cc.
|
static |
Definition at line 545 of file gpu_py_texture.cc.
|
static |
Definition at line 723 of file gpu_py_texture.cc.
Referenced by bpygpu_texture_init().
| const PyC_StringEnumItems pygpu_textureformat_items[] |
Definition at line 38 of file gpu_py_texture.cc.
Referenced by pygpu_shader_info_image(), pygpu_texture__tp_new(), and pygpu_texture_format_get().