Blender V5.0
blender::gpu::Texture Class Referenceabstract

#include <gpu_texture_private.hh>

Inherited by blender::gpu::GLTexture, blender::gpu::MTLTexture, and blender::gpu::VKTexture.

Public Member Functions

virtual void generate_mipmap ()=0
virtual void copy_to (Texture *tex)=0
virtual void clear (eGPUDataFormat format, const void *data)=0
virtual void swizzle_set (const char swizzle_mask[4])=0
virtual void mip_range_set (int min, int max)=0
virtual void * read (int mip, eGPUDataFormat format)=0
virtual void update_sub (int mip, int offset[3], int extent[3], eGPUDataFormat format, const void *data)=0
virtual void update_sub (int offset[3], int extent[3], eGPUDataFormat format, GPUPixelBuffer *pixbuf)=0
int width_get () const
int height_get () const
int depth_get () const
eGPUTextureUsage usage_get () const
void mip_size_get (int mip, int r_size[3]) const
int mip_width_get (int mip) const
int mip_height_get (int mip) const
int mip_depth_get (int mip) const
int dimensions_count () const
int layer_count () const
int mip_count () const
TextureFormat format_get () const
GPUTextureFormatFlag format_flag_get () const
GPUTextureType type_get () const
GPUAttachmentType attachment_type (int slot) const
Creation & Deletion
 Texture (const char *name)
virtual ~Texture ()
bool init_1D (int w, int layers, int mip_len, TextureFormat format)
bool init_2D (int w, int h, int layers, int mip_len, TextureFormat format)
bool init_3D (int w, int h, int d, int mip_len, TextureFormat format)
bool init_cubemap (int w, int layers, int mip_len, TextureFormat format)
bool init_buffer (VertBuf *vbo, TextureFormat format)
bool init_view (Texture *src, TextureFormat format, GPUTextureType type, int mip_start, int mip_len, int layer_start, int layer_len, bool cube_as_array, bool use_stencil)
void usage_set (eGPUTextureUsage usage_flags)
Operation
void attach_to (FrameBuffer *fb, GPUAttachmentType type)
void detach_from (FrameBuffer *fb)
void update (eGPUDataFormat format, const void *data)

Public Attributes

GPUSamplerState sampler_state = GPUSamplerState::default_sampler()
int refcount = 1
int src_w = 0
int src_h = 0
void ** py_ref = nullptr

Protected Member Functions

virtual bool init_internal ()=0
virtual bool init_internal (VertBuf *vbo)=0
virtual bool init_internal (blender::gpu::Texture *src, int mip_offset, int layer_offset, bool use_stencil)=0

Protected Attributes

int w_
int h_
int d_
TextureFormat format_
GPUTextureFormatFlag format_flag_
GPUTextureType type_
eGPUTextureUsage gpu_image_usage_flags_
int mipmaps_ = -1
int mip_min_ = 0
int mip_max_ = 0
char name_ [DEBUG_NAME_LEN]
GPUAttachmentType fb_attachment_ [GPU_TEX_MAX_FBO_ATTACHED]
FrameBufferfb_ [GPU_TEX_MAX_FBO_ATTACHED]

Detailed Description

Implementation of Textures. Base class which is then specialized for each implementation (GL, VK, ...).

Definition at line 99 of file gpu_texture_private.hh.

Constructor & Destructor Documentation

◆ Texture()

◆ ~Texture()

blender::gpu::Texture::~Texture ( )
virtual

Definition at line 42 of file gpu_texture.cc.

References ARRAY_SIZE, fb_, fb_attachment_, i, and py_ref.

Member Function Documentation

◆ attach_to()

void blender::gpu::Texture::attach_to ( FrameBuffer * fb,
GPUAttachmentType type )

Definition at line 187 of file gpu_texture.cc.

References ARRAY_SIZE, BLI_assert_msg, fb(), fb_, fb_attachment_, and i.

◆ attachment_type()

◆ clear()

virtual void blender::gpu::Texture::clear ( eGPUDataFormat format,
const void * data )
pure virtual

◆ copy_to()

virtual void blender::gpu::Texture::copy_to ( Texture * tex)
pure virtual

◆ depth_get()

int blender::gpu::Texture::depth_get ( ) const
inline

Definition at line 189 of file gpu_texture_private.hh.

References d_.

Referenced by blender::gpu::VKTexture::update_sub().

◆ detach_from()

void blender::gpu::Texture::detach_from ( FrameBuffer * fb)

Definition at line 210 of file gpu_texture.cc.

References ARRAY_SIZE, BLI_assert_msg, fb(), fb_, fb_attachment_, and i.

Referenced by GPU_framebuffer_texture_detach().

◆ dimensions_count()

◆ format_flag_get()

GPUTextureFormatFlag blender::gpu::Texture::format_flag_get ( ) const
inline

◆ format_get()

◆ generate_mipmap()

virtual void blender::gpu::Texture::generate_mipmap ( )
pure virtual

◆ height_get()

int blender::gpu::Texture::height_get ( ) const
inline

◆ init_1D()

◆ init_2D()

◆ init_3D()

◆ init_buffer()

bool blender::gpu::Texture::init_buffer ( VertBuf * vbo,
TextureFormat format )

◆ init_cubemap()

◆ init_internal() [1/3]

virtual bool blender::gpu::Texture::init_internal ( )
protectedpure virtual

◆ init_internal() [2/3]

virtual bool blender::gpu::Texture::init_internal ( blender::gpu::Texture * src,
int mip_offset,
int layer_offset,
bool use_stencil )
protectedpure virtual

◆ init_internal() [3/3]

virtual bool blender::gpu::Texture::init_internal ( VertBuf * vbo)
protectedpure virtual

◆ init_view()

bool blender::gpu::Texture::init_view ( Texture * src,
TextureFormat format,
GPUTextureType type,
int mip_start,
int mip_len,
int layer_start,
int layer_len,
bool cube_as_array,
bool use_stencil )

◆ layer_count()

◆ mip_count()

int blender::gpu::Texture::mip_count ( ) const
inline

Definition at line 263 of file gpu_texture_private.hh.

References mipmaps_.

◆ mip_depth_get()

int blender::gpu::Texture::mip_depth_get ( int mip) const
inline

◆ mip_height_get()

int blender::gpu::Texture::mip_height_get ( int mip) const
inline

Definition at line 223 of file gpu_texture_private.hh.

References blender::gpu::GPU_TEXTURE_1D_ARRAY, h_, max_ii(), and type_.

◆ mip_range_set()

virtual void blender::gpu::Texture::mip_range_set ( int min,
int max )
pure virtual

◆ mip_size_get()

◆ mip_width_get()

int blender::gpu::Texture::mip_width_get ( int mip) const
inline

Definition at line 219 of file gpu_texture_private.hh.

References max_ii(), and w_.

◆ read()

virtual void * blender::gpu::Texture::read ( int mip,
eGPUDataFormat format )
pure virtual

◆ swizzle_set()

virtual void blender::gpu::Texture::swizzle_set ( const char swizzle_mask[4])
pure virtual

◆ type_get()

GPUTextureType blender::gpu::Texture::type_get ( ) const
inline

Definition at line 276 of file gpu_texture_private.hh.

References type_.

Referenced by blender::gpu::VKTexture::generate_mipmap(), and GPU_texture_create_view().

◆ update()

void blender::gpu::Texture::update ( eGPUDataFormat format,
const void * data )

Definition at line 222 of file gpu_texture.cc.

References data, mip_size_get(), and update_sub().

Referenced by gpu_texture_create(), and GPU_texture_update().

◆ update_sub() [1/2]

virtual void blender::gpu::Texture::update_sub ( int mip,
int offset[3],
int extent[3],
eGPUDataFormat format,
const void * data )
pure virtual

◆ update_sub() [2/2]

virtual void blender::gpu::Texture::update_sub ( int offset[3],
int extent[3],
eGPUDataFormat format,
GPUPixelBuffer * pixbuf )
pure virtual

◆ usage_get()

◆ usage_set()

void blender::gpu::Texture::usage_set ( eGPUTextureUsage usage_flags)

◆ width_get()

int blender::gpu::Texture::width_get ( ) const
inline

Member Data Documentation

◆ d_

◆ fb_

FrameBuffer* blender::gpu::Texture::fb_[GPU_TEX_MAX_FBO_ATTACHED]
protected

◆ fb_attachment_

GPUAttachmentType blender::gpu::Texture::fb_attachment_[GPU_TEX_MAX_FBO_ATTACHED]
protected

Frame-buffer references to update on deletion.

Definition at line 138 of file gpu_texture_private.hh.

Referenced by attach_to(), blender::gpu::GLTexture::check_feedback_loop(), detach_from(), and ~Texture().

◆ format_

◆ format_flag_

◆ gpu_image_usage_flags_

eGPUTextureUsage blender::gpu::Texture::gpu_image_usage_flags_
protected

◆ h_

◆ mip_max_

◆ mip_min_

◆ mipmaps_

◆ name_

◆ py_ref

void** blender::gpu::Texture::py_ref = nullptr

Reference of a pointer that needs to be cleaned when deallocating the texture. Points to BPyGPUTexture.tex

Definition at line 112 of file gpu_texture_private.hh.

Referenced by ~Texture().

◆ refcount

int blender::gpu::Texture::refcount = 1

Reference counter.

Definition at line 104 of file gpu_texture_private.hh.

Referenced by GPU_texture_free().

◆ sampler_state

◆ src_h

int blender::gpu::Texture::src_h = 0

Definition at line 106 of file gpu_texture_private.hh.

◆ src_w

int blender::gpu::Texture::src_w = 0

Width & Height (of source data), optional.

Definition at line 106 of file gpu_texture_private.hh.

◆ type_

◆ w_


The documentation for this class was generated from the following files: