Blender V5.0
blender::draw::overlay::Texture Class Reference

#include <DRW_gpu_wrapper.hh>

Inherits blender::NonCopyable.

Inherited by blender::draw::TextureFromPool, blender::draw::TextureRef, and blender::eevee::UtilityTexture.

Public Member Functions

 Texture (const char *name="gpu::Texture")
 Texture (const char *name, blender::gpu::TextureFormat format, eGPUTextureUsage usage, int extent, const float *data=nullptr, bool cubemap=false, int mip_len=1)
 Texture (const char *name, blender::gpu::TextureFormat format, eGPUTextureUsage usage, int extent, int layers, const float *data=nullptr, bool cubemap=false, int mip_len=1)
 Texture (const char *name, blender::gpu::TextureFormat format, eGPUTextureUsage usage, int2 extent, const float *data=nullptr, int mip_len=1)
 Texture (const char *name, blender::gpu::TextureFormat format, eGPUTextureUsage usage, int2 extent, int layers, const float *data=nullptr, int mip_len=1)
 Texture (const char *name, blender::gpu::TextureFormat format, eGPUTextureUsage usage, int3 extent, const float *data=nullptr, int mip_len=1)
 Texture (Texture &&other)=default
 ~Texture ()
gpu::Texturegpu_texture ()
 operator gpu::Texture * () const
gpu::Texture ** operator& ()
Textureptr ()
Textureoperator= (Texture &&a)
bool ensure_1d (blender::gpu::TextureFormat format, int extent, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
bool ensure_1d_array (blender::gpu::TextureFormat format, int extent, int layers, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
bool ensure_2d (blender::gpu::TextureFormat format, int2 extent, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
bool ensure_2d_array (blender::gpu::TextureFormat format, int2 extent, int layers, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
bool ensure_3d (blender::gpu::TextureFormat format, int3 extent, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
bool ensure_cube (blender::gpu::TextureFormat format, int extent, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, float *data=nullptr, int mip_len=1)
bool ensure_cube_array (blender::gpu::TextureFormat format, int extent, int layers, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
bool ensure_mip_views (bool cube_as_array=false)
gpu::Texturemip_view (int miplvl)
int mip_count () const
bool ensure_layer_views (bool cube_as_array=false)
gpu::Texturelayer_view (int layer)
gpu::Texturestencil_view (bool cube_as_array=false)
gpu::Texturelayer_range_view (int layer_start, int layer_len, bool cube_as_array=false)
bool is_valid () const
int width () const
int height () const
int depth () const
int pixel_count () const
bool is_depth () const
bool is_stencil () const
bool is_integer () const
bool is_cube () const
bool is_array () const
int3 size (int miplvl=0) const
void clear (float4 values)
void clear (uint4 values)
void clear (int4 values)
void debug_clear ()
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 Member Functions

void free_texture_views ()

Protected Attributes

gpu::Texturetx_ = nullptr
gpu::Texturestencil_view_ = nullptr
Vector< gpu::Texture *, 0 > mip_views_
Vector< gpu::Texture *, 0 > layer_views_
gpu::Texturelayer_range_view_ = nullptr
const char * name_

Detailed Description

Definition at line 525 of file DRW_gpu_wrapper.hh.

Constructor & Destructor Documentation

◆ Texture() [1/7]

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

Definition at line 535 of file DRW_gpu_wrapper.hh.

◆ Texture() [2/7]

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

Definition at line 537 of file DRW_gpu_wrapper.hh.

◆ Texture() [3/7]

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

Definition at line 549 of file DRW_gpu_wrapper.hh.

◆ Texture() [4/7]

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

Definition at line 562 of file DRW_gpu_wrapper.hh.

◆ Texture() [5/7]

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

Definition at line 573 of file DRW_gpu_wrapper.hh.

◆ Texture() [6/7]

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

Definition at line 585 of file DRW_gpu_wrapper.hh.

◆ Texture() [7/7]

blender::draw::Texture::Texture ( Texture && other)
default

◆ ~Texture()

Definition at line 597 of file DRW_gpu_wrapper.hh.

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 905 of file DRW_gpu_wrapper.hh.

◆ 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 921 of file DRW_gpu_wrapper.hh.

◆ 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 913 of file DRW_gpu_wrapper.hh.

◆ debug_clear()

Clear the texture to NaN for floats, or a to debug value for integers. (For debugging uninitialized data issues)

Definition at line 930 of file DRW_gpu_wrapper.hh.

◆ depth()

int blender::draw::Texture::depth ( ) const
inline

Definition at line 860 of file DRW_gpu_wrapper.hh.

◆ ensure_1d()

bool blender::draw::Texture::ensure_1d ( blender::gpu::TextureFormat format,
int extent,
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL,
const 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 652 of file DRW_gpu_wrapper.hh.

◆ ensure_1d_array()

bool blender::draw::Texture::ensure_1d_array ( blender::gpu::TextureFormat format,
int extent,
int layers,
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL,
const 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 665 of file DRW_gpu_wrapper.hh.

◆ ensure_2d()

bool blender::draw::Texture::ensure_2d ( blender::gpu::TextureFormat format,
int2 extent,
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL,
const 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 680 of file DRW_gpu_wrapper.hh.

◆ ensure_2d_array()

bool blender::draw::Texture::ensure_2d_array ( blender::gpu::TextureFormat format,
int2 extent,
int layers,
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL,
const 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 693 of file DRW_gpu_wrapper.hh.

◆ ensure_3d()

bool blender::draw::Texture::ensure_3d ( blender::gpu::TextureFormat format,
int3 extent,
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL,
const 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 708 of file DRW_gpu_wrapper.hh.

◆ ensure_cube()

bool blender::draw::Texture::ensure_cube ( blender::gpu::TextureFormat format,
int extent,
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL,
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 721 of file DRW_gpu_wrapper.hh.

◆ ensure_cube_array()

bool blender::draw::Texture::ensure_cube_array ( blender::gpu::TextureFormat format,
int extent,
int layers,
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL,
const 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 734 of file DRW_gpu_wrapper.hh.

◆ ensure_layer_views()

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

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

Definition at line 783 of file DRW_gpu_wrapper.hh.

◆ ensure_mip_views()

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

Ensure the availability of mipmap views. MIP view covers all layers of array textures.

Definition at line 748 of file DRW_gpu_wrapper.hh.

◆ filter_mode()

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

Definition at line 959 of file DRW_gpu_wrapper.hh.

◆ free()

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

Definition at line 967 of file DRW_gpu_wrapper.hh.

◆ free_texture_views()

Definition at line 987 of file DRW_gpu_wrapper.hh.

◆ gpu_texture()

Definition at line 602 of file DRW_gpu_wrapper.hh.

◆ height()

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

Definition at line 855 of file DRW_gpu_wrapper.hh.

◆ is_array()

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

Definition at line 890 of file DRW_gpu_wrapper.hh.

◆ is_cube()

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

Definition at line 885 of file DRW_gpu_wrapper.hh.

◆ is_depth()

bool blender::draw::Texture::is_depth ( ) const
inline

Definition at line 870 of file DRW_gpu_wrapper.hh.

◆ is_integer()

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

Definition at line 880 of file DRW_gpu_wrapper.hh.

◆ is_stencil()

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

Definition at line 875 of file DRW_gpu_wrapper.hh.

◆ is_valid()

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

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

Definition at line 845 of file DRW_gpu_wrapper.hh.

◆ layer_range_view()

gpu::Texture * blender::draw::Texture::layer_range_view ( int layer_start,
int layer_len,
bool cube_as_array = false )
inline

Layer range view cover only the given range. This can only be called to create one range. View is recreated if:

  • The source texture is recreated.
  • The layer_len is different from the last call to this function. IMPORTANT: It is not recreated if the layer_start is different from the last call. IMPORTANT: If this view is recreated any reference to it should be updated.

Definition at line 824 of file DRW_gpu_wrapper.hh.

◆ layer_view()

Definition at line 800 of file DRW_gpu_wrapper.hh.

◆ mip_count()

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

Definition at line 773 of file DRW_gpu_wrapper.hh.

◆ mip_view()

Definition at line 765 of file DRW_gpu_wrapper.hh.

◆ operator gpu::Texture *()

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

Definition at line 608 of file DRW_gpu_wrapper.hh.

◆ operator&()

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

Definition at line 615 of file DRW_gpu_wrapper.hh.

◆ operator=()

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

Definition at line 626 of file DRW_gpu_wrapper.hh.

◆ pixel_count()

Definition at line 865 of file DRW_gpu_wrapper.hh.

◆ ptr()

WORKAROUND: used when needing a ref to the Texture and not the gpu::Texture.

Definition at line 621 of file DRW_gpu_wrapper.hh.

◆ 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 954 of file DRW_gpu_wrapper.hh.

◆ size()

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

Definition at line 895 of file DRW_gpu_wrapper.hh.

◆ stencil_view()

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

Definition at line 805 of file DRW_gpu_wrapper.hh.

◆ swap()

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

Swap the content of the two textures.

Definition at line 976 of file DRW_gpu_wrapper.hh.

◆ width()

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

Definition at line 850 of file DRW_gpu_wrapper.hh.

Member Data Documentation

◆ layer_range_view_

◆ layer_views_

Definition at line 530 of file DRW_gpu_wrapper.hh.

◆ mip_views_

Definition at line 529 of file DRW_gpu_wrapper.hh.

◆ name_

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

Definition at line 532 of file DRW_gpu_wrapper.hh.

◆ stencil_view_

◆ tx_

Definition at line 527 of file DRW_gpu_wrapper.hh.


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