Blender V5.3
blender::gpu::MTLTexture Class Reference

#include <mtl_texture.hh>

Inherits blender::gpu::Texture.

Public Member Functions

const char * get_name ()
bool has_custom_swizzle ()
id< MTLBuffer > get_vertex_buffer () const
const int * get_texture_metadata_ptr () const
SRGB Handling
bool is_format_srgb ()
id< MTLTexture > get_non_srgb_handle ()
Alias resource access to buffer backed content using Storage Buffer.
MTLStorageBuf * get_storagebuf ()
Public Member Functions inherited from blender::gpu::Texture
int width_get () const
int height_get () const
int depth_get () const
eGPUTextureUsage usage_get () const
bool is_texture_view () const
void mip_size_get (int mip, int r_size[3]) const
int3 mip_size_get (int mip) 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
IndexRange mip_map_range () const
IndexRange layer_range () const
TextureFormat format_get () const
GPUTextureFormatFlag format_flag_get () const
GPUTextureType type_get () const
GPUAttachmentType attachment_type (int slot) const
 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)
void attach_to (FrameBuffer *fb, GPUAttachmentType type)
void detach_from (FrameBuffer *fb)
void update (eGPUDataFormat format, const void *data)
size_t read_size_get (int mip, eGPUDataFormat format) const

Friends

class MTLContext
class MTLStateManager
class MTLFrameBuffer
class MTLStorageBuf
class MTLTexturePool
void xr_blit (id< MTLTexture > metal_xr_texture, int ofsx, int ofsy, int width, int height)

Creation & Deletion

 MTLTexture (const char *name)
 MTLTexture (const char *name, TextureFormat format, GPUTextureType type, id< MTLTexture > metal_texture)
 ~MTLTexture () override

Operations

void update_sub (int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data, const uint unpack_row_length) override
void update_sub (int offset[3], int extent[3], eGPUDataFormat format, GPUPixelBuffer *pixbuf) override
void generate_mipmap () override
void copy_to (Texture *dst, IndexRange mip_levels) override
void clear (const double4 data) override
void swizzle_set (const char swizzle_mask[4]) override
void read (int mip, eGPUDataFormat type, void *data) override
id< MTLTexture > get_metal_handle ()
id< MTLTexture > get_metal_handle_base ()
MTLSamplerState get_sampler_state ()
bool init_internal () override
bool init_internal (VertBuf *vbo) override
bool init_internal (gpu::Texture *src, bool use_stencil) override

METAL Resource creation and management

bool texture_is_baked ()

Additional Inherited Members

Public Attributes inherited from blender::gpu::Texture
GPUSamplerState sampler_state = GPUSamplerState::default_sampler()
int refcount = 1
int src_w = 0
int src_h = 0
void ** py_ref = nullptr
Protected Attributes inherited from blender::gpu::Texture
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
Texture * source_texture_ = nullptr
int view_layer_start_ = 0
std::string name_
Map< FrameBuffer *, GPUAttachmentType > fb_attachments_

Detailed Description

Definition at line 180 of file mtl_texture.hh.

Constructor & Destructor Documentation

◆ MTLTexture() [1/2]

blender::gpu::gpu::MTLTexture::MTLTexture ( const char * name)

Definition at line 65 of file mtl_texture.mm.

References blender::gpu::Texture::Texture().

◆ MTLTexture() [2/2]

◆ ~MTLTexture()

blender::gpu::gpu::MTLTexture::~MTLTexture ( )
override

Member Function Documentation

◆ clear()

◆ copy_to()

◆ generate_mipmap()

◆ get_metal_handle()

id< MTLTexture > blender::gpu::gpu::MTLTexture::get_metal_handle ( )

◆ get_metal_handle_base()

id< MTLTexture > blender::gpu::gpu::MTLTexture::get_metal_handle_base ( )

◆ get_name()

const char * blender::gpu::MTLTexture::get_name ( )
inline

◆ get_non_srgb_handle()

id< MTLTexture > blender::gpu::MTLTexture::get_non_srgb_handle ( )

◆ get_sampler_state()

MTLSamplerState blender::gpu::gpu::MTLTexture::get_sampler_state ( )

◆ get_storagebuf()

MTLStorageBuf * blender::gpu::gpu::MTLTexture::get_storagebuf ( )

◆ get_texture_metadata_ptr()

const int * blender::gpu::MTLTexture::get_texture_metadata_ptr ( ) const
inline

Definition at line 321 of file mtl_texture.hh.

Referenced by blender::gpu::bind_atomic_workaround_buffer().

◆ get_vertex_buffer()

id< MTLBuffer > blender::gpu::MTLTexture::get_vertex_buffer ( ) const
inline

Definition at line 311 of file mtl_texture.hh.

Referenced by blender::gpu::MTLVertBuf::bind_as_texture().

◆ has_custom_swizzle()

bool blender::gpu::MTLTexture::has_custom_swizzle ( )
inline

Definition at line 303 of file mtl_texture.hh.

Referenced by blender::gpu::ensure_texture_bindings().

◆ init_internal() [1/3]

bool blender::gpu::gpu::MTLTexture::init_internal ( )
overrideprotectedvirtual

◆ init_internal() [2/3]

bool blender::gpu::gpu::MTLTexture::init_internal ( gpu::Texture * src,
bool use_stencil )
overrideprotectedvirtual

◆ init_internal() [3/3]

◆ is_format_srgb()

bool blender::gpu::MTLTexture::is_format_srgb ( )

◆ read()

◆ swizzle_set()

void blender::gpu::gpu::MTLTexture::swizzle_set ( const char swizzle_mask[4])
overridevirtual

Implements blender::gpu::Texture.

Definition at line 1452 of file mtl_texture.mm.

References blender::gpu::swizzle_to_mtl().

◆ texture_is_baked()

bool blender::gpu::gpu::MTLTexture::texture_is_baked ( )

Definition at line 2139 of file mtl_texture.mm.

◆ update_sub() [1/2]

void blender::gpu::gpu::MTLTexture::update_sub ( int mip,
int offset[3],
int extent[3],
eGPUDataFormat type,
const void * data,
const uint unpack_row_length )
overridevirtual

Implements blender::gpu::Texture.

Definition at line 494 of file mtl_texture.mm.

References blender::gpu::MTLBufferPool::allocate_with_data(), blender::gpu::MTLComputeState::bind_compute_buffer(), blender::gpu::MTLComputeState::bind_compute_bytes(), blender::gpu::MTLComputeState::bind_compute_texture(), blender::gpu::MTLComputeState::bind_pso(), blender::BLI_assert(), BLI_assert_msg, BLI_assert_unreachable, blender::gpu::Texture::d_, blender::data, blender::MutableSpan< T >::data(), blender::Span< T >::data(), blender::gpu::MTLContext::device, blender::gpu::Texture::dimensions_count(), blender::divide_ceil_u(), ELEM, blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::MTLCommandBufferManager::ensure_begin_compute_encoder(), blender::math::float_to_half_make_finite_array(), blender::gpu::Texture::format_, blender::gpu::Texture::format_flag_, blender::gpu::MTLBuffer::free(), blender::gpu::MTLContext::get(), blender::gpu::MTLCommandBufferManager::get_compute_state(), blender::gpu::MTLContext::get_global_memory_manager(), blender::gpu::MTLBuffer::get_metal_buffer(), blender::gpu::get_mtl_format_bytesize(), blender::gpu::get_mtl_format_num_components(), blender::GPU_DATA_10_11_11_REV, blender::GPU_DATA_2_10_10_10_REV, blender::GPU_DATA_FLOAT, blender::GPU_DATA_HALF_FLOAT, blender::GPU_DATA_UINT_24_8_DEPRECATED, blender::gpu::GPU_FORMAT_COMPRESSED, blender::gpu::GPU_FORMAT_DEPTH, blender::gpu::GPU_TEXTURE_1D, blender::gpu::GPU_TEXTURE_1D_ARRAY, blender::gpu::GPU_TEXTURE_2D, blender::gpu::GPU_TEXTURE_2D_ARRAY, blender::gpu::GPU_TEXTURE_3D, blender::gpu::GPU_TEXTURE_ARRAY, blender::gpu::GPU_TEXTURE_BUFFER, blender::gpu::GPU_TEXTURE_CUBE, blender::gpu::GPU_TEXTURE_CUBE_ARRAY, blender::gpu::gpu_texture_format_to_metal(), blender::GPU_TEXTURE_USAGE_FORMAT_VIEW, blender::GPU_TEXTURE_USAGE_SHADER_WRITE, blender::gpu::Texture::h_, blender::IndexRange::IndexRange(), blender::gpu::is_half_float(), blender::gpu::MTLContext::main_command_buffer, blender::max_ii(), blender::max_ulul(), blender::MEM_new_uninitialized_aligned(), blender::gpu::Texture::mip_max_, blender::gpu::Texture::mip_min_, blender::gpu::mtl_format_get_writeable_view_format(), MTL_LOG_ERROR, MTL_LOG_WARNING, MTLContext, blender::gpu::Texture::name_, blender::threading::parallel_for(), blender::IndexRange::size(), blender::MutableSpan< T >::slice(), blender::Span< T >::slice(), blender::gpu::MTLCommandBufferManager::submit(), blender::gpu::tex_data_format_to_msl_texture_template_type(), blender::gpu::tex_data_format_to_msl_type_str(), blender::gpu::to_block_size(), blender::gpu::to_bytesize(), blender::gpu::to_component_len(), blender::gpu::Texture::type_, blender::gpu::Texture::w_, and y.

◆ update_sub() [2/2]

◆ MTLContext

friend class MTLContext
friend

◆ MTLFrameBuffer

friend class MTLFrameBuffer
friend

Definition at line 183 of file mtl_texture.hh.

References MTLFrameBuffer.

Referenced by MTLFrameBuffer.

◆ MTLStateManager

friend class MTLStateManager
friend

Definition at line 182 of file mtl_texture.hh.

References MTLStateManager.

Referenced by MTLStateManager.

◆ MTLStorageBuf

friend class MTLStorageBuf
friend

Definition at line 184 of file mtl_texture.hh.

References MTLStorageBuf.

Referenced by get_storagebuf(), and MTLStorageBuf.

◆ MTLTexturePool

friend class MTLTexturePool
friend

Definition at line 185 of file mtl_texture.hh.

References MTLTexturePool, and xr_blit.

Referenced by MTLTexturePool.

◆ xr_blit


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