Blender  V3.3
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
blender::draw::Texture Class Reference

#include <DRW_gpu_wrapper.hh>

Inheritance diagram for blender::draw::Texture:
blender::NonCopyable blender::draw::TextureFromPool

Public Member Functions

 Texture (const char *name="gpu::Texture")
 
 Texture (const char *name, eGPUTextureFormat format, int extent, float *data=nullptr, bool cubemap=false, int mip_len=1)
 
 Texture (const char *name, eGPUTextureFormat format, int extent, int layers, float *data=nullptr, bool cubemap=false, int mip_len=1)
 
 Texture (const char *name, eGPUTextureFormat format, int2 extent, float *data=nullptr, int mip_len=1)
 
 Texture (const char *name, eGPUTextureFormat format, int2 extent, int layers, float *data=nullptr, int mip_len=1)
 
 Texture (const char *name, eGPUTextureFormat format, int3 extent, float *data=nullptr, int mip_len=1)
 
 ~Texture ()
 
 operator GPUTexture * () const
 
GPUTexture ** operator& ()
 
Textureoperator= (Texture &&a)
 
bool ensure_1d (eGPUTextureFormat format, int extent, float *data=nullptr, int mip_len=1)
 
bool ensure_1d_array (eGPUTextureFormat format, int extent, int layers, float *data=nullptr, int mip_len=1)
 
bool ensure_2d (eGPUTextureFormat format, int2 extent, float *data=nullptr, int mip_len=1)
 
bool ensure_2d_array (eGPUTextureFormat format, int2 extent, int layers, float *data=nullptr, int mip_len=1)
 
bool ensure_3d (eGPUTextureFormat format, int3 extent, float *data=nullptr, int mip_len=1)
 
bool ensure_cube (eGPUTextureFormat format, int extent, float *data=nullptr, int mip_len=1)
 
bool ensure_cube_array (eGPUTextureFormat format, int extent, int layers, float *data=nullptr, int mip_len=1)
 
bool ensure_mip_views (bool cube_as_array=false)
 
GPUTexturemip_view (int miplvl)
 
bool ensure_layer_views (bool cube_as_array=false)
 
GPUTexturelayer_view (int layer)
 
GPUTexturestencil_view (bool cube_as_array=false)
 
bool is_valid (void) const
 
int width (void) const
 
int height (void) const
 
bool depth (void) const
 
bool is_stencil (void) const
 
bool is_integer (void) const
 
bool is_cube (void) const
 
bool is_array (void) const
 
int3 size (int miplvl=0) const
 
void clear (float4 values)
 
void clear (uint4 values)
 
void clear (int4 values)
 
template<typename T >
Tread (eGPUDataFormat format, int miplvl=0)
 
void filter_mode (bool do_filter)
 
void free ()
 

Static Public Member Functions

static void swap (Texture &a, Texture &b)
 

Protected Attributes

GPUTexturetx_ = nullptr
 
GPUTexturestencil_view_ = nullptr
 
Vector< GPUTexture *, 0 > mip_views_
 
Vector< GPUTexture *, 0 > layer_views_
 
const char * name_
 

Detailed Description

Definition at line 377 of file DRW_gpu_wrapper.hh.

Constructor & Destructor Documentation

◆ Texture() [1/6]

blender::draw::Texture::Texture ( const char *  name = "gpu::Texture")
inline

Definition at line 386 of file DRW_gpu_wrapper.hh.

◆ Texture() [2/6]

blender::draw::Texture::Texture ( const char *  name,
eGPUTextureFormat  format,
int  extent,
float data = nullptr,
bool  cubemap = false,
int  mip_len = 1 
)
inline

Definition at line 390 of file DRW_gpu_wrapper.hh.

References data, and tx_.

◆ Texture() [3/6]

blender::draw::Texture::Texture ( const char *  name,
eGPUTextureFormat  format,
int  extent,
int  layers,
float data = nullptr,
bool  cubemap = false,
int  mip_len = 1 
)
inline

Definition at line 401 of file DRW_gpu_wrapper.hh.

References data, and tx_.

◆ Texture() [4/6]

blender::draw::Texture::Texture ( const char *  name,
eGPUTextureFormat  format,
int2  extent,
float data = nullptr,
int  mip_len = 1 
)
inline

Definition at line 413 of file DRW_gpu_wrapper.hh.

References data, tx_, and UNPACK2.

◆ Texture() [5/6]

blender::draw::Texture::Texture ( const char *  name,
eGPUTextureFormat  format,
int2  extent,
int  layers,
float data = nullptr,
int  mip_len = 1 
)
inline

Definition at line 423 of file DRW_gpu_wrapper.hh.

References data, tx_, and UNPACK2.

◆ Texture() [6/6]

blender::draw::Texture::Texture ( const char *  name,
eGPUTextureFormat  format,
int3  extent,
float data = nullptr,
int  mip_len = 1 
)
inline

Definition at line 434 of file DRW_gpu_wrapper.hh.

References data, tx_, and UNPACK3.

◆ ~Texture()

blender::draw::Texture::~Texture ( )
inline

Definition at line 444 of file DRW_gpu_wrapper.hh.

References free().

Member Function Documentation

◆ clear() [1/3]

void blender::draw::Texture::clear ( float4  values)
inline

Clear the entirety of the texture using one pixel worth of data.

Definition at line 654 of file DRW_gpu_wrapper.hh.

References GPU_DATA_FLOAT, GPU_texture_clear(), and tx_.

◆ clear() [2/3]

void blender::draw::Texture::clear ( int4  values)
inline

Clear the entirety of the texture using one pixel worth of data.

Definition at line 670 of file DRW_gpu_wrapper.hh.

References GPU_DATA_INT, GPU_texture_clear(), and tx_.

◆ clear() [3/3]

void blender::draw::Texture::clear ( uint4  values)
inline

Clear the entirety of the texture using one pixel worth of data.

Definition at line 662 of file DRW_gpu_wrapper.hh.

References GPU_DATA_UINT, GPU_texture_clear(), and tx_.

◆ depth()

bool blender::draw::Texture::depth ( void  ) const
inline

Definition at line 619 of file DRW_gpu_wrapper.hh.

References GPU_texture_depth(), and tx_.

◆ ensure_1d()

bool blender::draw::Texture::ensure_1d ( eGPUTextureFormat  format,
int  extent,
float data = nullptr,
int  mip_len = 1 
)
inline

Ensure the texture has the correct properties. Recreating it if needed. Return true if a texture has been created.

Definition at line 476 of file DRW_gpu_wrapper.hh.

References data.

◆ ensure_1d_array()

bool blender::draw::Texture::ensure_1d_array ( eGPUTextureFormat  format,
int  extent,
int  layers,
float data = nullptr,
int  mip_len = 1 
)
inline

Ensure the texture has the correct properties. Recreating it if needed. Return true if a texture has been created.

Definition at line 485 of file DRW_gpu_wrapper.hh.

References data.

◆ ensure_2d()

bool blender::draw::Texture::ensure_2d ( eGPUTextureFormat  format,
int2  extent,
float data = nullptr,
int  mip_len = 1 
)
inline

Ensure the texture has the correct properties. Recreating it if needed. Return true if a texture has been created.

Definition at line 495 of file DRW_gpu_wrapper.hh.

References data, and UNPACK2.

◆ ensure_2d_array()

bool blender::draw::Texture::ensure_2d_array ( eGPUTextureFormat  format,
int2  extent,
int  layers,
float data = nullptr,
int  mip_len = 1 
)
inline

Ensure the texture has the correct properties. Recreating it if needed. Return true if a texture has been created.

Definition at line 504 of file DRW_gpu_wrapper.hh.

References data, and UNPACK2.

◆ ensure_3d()

bool blender::draw::Texture::ensure_3d ( eGPUTextureFormat  format,
int3  extent,
float data = nullptr,
int  mip_len = 1 
)
inline

Ensure the texture has the correct properties. Recreating it if needed. Return true if a texture has been created.

Definition at line 514 of file DRW_gpu_wrapper.hh.

References data, and UNPACK3.

◆ ensure_cube()

bool blender::draw::Texture::ensure_cube ( eGPUTextureFormat  format,
int  extent,
float data = nullptr,
int  mip_len = 1 
)
inline

Ensure the texture has the correct properties. Recreating it if needed. Return true if a texture has been created.

Definition at line 523 of file DRW_gpu_wrapper.hh.

References data.

◆ ensure_cube_array()

bool blender::draw::Texture::ensure_cube_array ( eGPUTextureFormat  format,
int  extent,
int  layers,
float data = nullptr,
int  mip_len = 1 
)
inline

Ensure the texture has the correct properties. Recreating it if needed. Return true if a texture has been created.

Definition at line 532 of file DRW_gpu_wrapper.hh.

References data.

◆ ensure_layer_views()

bool blender::draw::Texture::ensure_layer_views ( bool  cube_as_array = false)
inline

Ensure the availability of mipmap views. Layer views covers all layers of array textures. Returns true if the views were (re)created.

Definition at line 569 of file DRW_gpu_wrapper.hh.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), GPU_texture_create_view(), GPU_texture_format(), GPU_TEXTURE_FREE_SAFE, GPU_texture_layer_count(), layer_views_, name_, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), tx_, and view.

◆ ensure_mip_views()

bool blender::draw::Texture::ensure_mip_views ( bool  cube_as_array = false)
inline

◆ filter_mode()

void blender::draw::Texture::filter_mode ( bool  do_filter)
inline

Definition at line 684 of file DRW_gpu_wrapper.hh.

References GPU_texture_filter_mode(), and tx_.

◆ free()

void blender::draw::Texture::free ( )
inline

Free the internal texture but not the #draw::Texture itself.

Definition at line 692 of file DRW_gpu_wrapper.hh.

References blender::Vector< T, InlineBufferCapacity, Allocator >::clear(), GPU_TEXTURE_FREE_SAFE, layer_views_, mip_views_, stencil_view_, tx_, and view.

Referenced by ~Texture().

◆ height()

int blender::draw::Texture::height ( void  ) const
inline

Definition at line 614 of file DRW_gpu_wrapper.hh.

References GPU_texture_height(), and tx_.

◆ is_array()

bool blender::draw::Texture::is_array ( void  ) const
inline

Definition at line 639 of file DRW_gpu_wrapper.hh.

References GPU_texture_array(), and tx_.

◆ is_cube()

bool blender::draw::Texture::is_cube ( void  ) const
inline

Definition at line 634 of file DRW_gpu_wrapper.hh.

References GPU_texture_cube(), and tx_.

◆ is_integer()

bool blender::draw::Texture::is_integer ( void  ) const
inline

Definition at line 629 of file DRW_gpu_wrapper.hh.

References GPU_texture_integer(), and tx_.

◆ is_stencil()

bool blender::draw::Texture::is_stencil ( void  ) const
inline

Definition at line 624 of file DRW_gpu_wrapper.hh.

References GPU_texture_stencil(), and tx_.

◆ is_valid()

bool blender::draw::Texture::is_valid ( void  ) const
inline

Returns true if the texture has been allocated or acquired from the pool.

Definition at line 604 of file DRW_gpu_wrapper.hh.

References tx_.

◆ layer_view()

GPUTexture* blender::draw::Texture::layer_view ( int  layer)
inline

Definition at line 586 of file DRW_gpu_wrapper.hh.

References layer_views_.

◆ mip_view()

GPUTexture* blender::draw::Texture::mip_view ( int  miplvl)
inline

Definition at line 559 of file DRW_gpu_wrapper.hh.

References mip_views_.

◆ operator GPUTexture *()

blender::draw::Texture::operator GPUTexture * ( ) const
inline

Definition at line 450 of file DRW_gpu_wrapper.hh.

References BLI_assert, and tx_.

◆ operator&()

GPUTexture** blender::draw::Texture::operator& ( )
inline

Definition at line 457 of file DRW_gpu_wrapper.hh.

References tx_.

◆ operator=()

Texture& blender::draw::Texture::operator= ( Texture &&  a)
inline

Definition at line 462 of file DRW_gpu_wrapper.hh.

References Freestyle::a.

◆ read()

template<typename T >
T* blender::draw::Texture::read ( eGPUDataFormat  format,
int  miplvl = 0 
)
inline

Returns a buffer containing the texture data for the specified miplvl. The memory block needs to be manually freed by MEM_freeN().

Definition at line 679 of file DRW_gpu_wrapper.hh.

References GPU_texture_read(), T, and tx_.

◆ size()

int3 blender::draw::Texture::size ( int  miplvl = 0) const
inline

Definition at line 644 of file DRW_gpu_wrapper.hh.

References GPU_texture_get_mipmap_size(), and tx_.

◆ stencil_view()

GPUTexture* blender::draw::Texture::stencil_view ( bool  cube_as_array = false)
inline

◆ swap()

static void blender::draw::Texture::swap ( Texture a,
Texture b 
)
inlinestatic

Swap the content of the two textures.

Definition at line 708 of file DRW_gpu_wrapper.hh.

References Freestyle::a, usdtokens::b(), and SWAP.

◆ width()

int blender::draw::Texture::width ( void  ) const
inline

Definition at line 609 of file DRW_gpu_wrapper.hh.

References GPU_texture_width(), and tx_.

Member Data Documentation

◆ layer_views_

Vector<GPUTexture *, 0> blender::draw::Texture::layer_views_
protected

Definition at line 382 of file DRW_gpu_wrapper.hh.

Referenced by ensure_layer_views(), free(), and layer_view().

◆ mip_views_

Vector<GPUTexture *, 0> blender::draw::Texture::mip_views_
protected

Definition at line 381 of file DRW_gpu_wrapper.hh.

Referenced by ensure_mip_views(), free(), and mip_view().

◆ name_

const char* blender::draw::Texture::name_
protected

Definition at line 383 of file DRW_gpu_wrapper.hh.

Referenced by ensure_layer_views(), ensure_mip_views(), and stencil_view().

◆ stencil_view_

GPUTexture* blender::draw::Texture::stencil_view_ = nullptr
protected

Definition at line 380 of file DRW_gpu_wrapper.hh.

Referenced by free(), and stencil_view().

◆ tx_

GPUTexture* blender::draw::Texture::tx_ = nullptr
protected

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