|
Blender V5.3
|
#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_ |
Definition at line 180 of file mtl_texture.hh.
| blender::gpu::gpu::MTLTexture::MTLTexture | ( | const char * | name | ) |
Definition at line 65 of file mtl_texture.mm.
References blender::gpu::Texture::Texture().
| blender::gpu::gpu::MTLTexture::MTLTexture | ( | const char * | name, |
| TextureFormat | format, | ||
| GPUTextureType | type, | ||
| id< MTLTexture > | metal_texture ) |
|
override |
Definition at line 98 of file mtl_texture.mm.
References blender::gpu::MTLContext::get(), MTLContext, blender::gpu::Context::state_manager, and blender::gpu::StateManager::texture_unbind().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 1367 of file mtl_texture.mm.
References blender::gpu::Texture::attachment_type(), blender::BLI_assert(), BLI_assert_msg, clear(), blender::data, ELEM, blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::fb(), blender::gpu::Texture::format_get(), blender::gpu::MTLContext::get(), blender::GPU_framebuffer_active_get(), blender::GPU_framebuffer_bind(), blender::gpu::GPU_TEXTURE_1D, blender::gpu::GPU_TEXTURE_1D_ARRAY, blender::gpu::MTLContext::main_command_buffer, MTL_LOG_ERROR, MTLContext, blender::gpu::Texture::source_texture_, blender::gpu::to_component_len(), and blender::gpu::Texture::type_.
Referenced by clear().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 1302 of file mtl_texture.mm.
References blender::BLI_assert(), blender::gpu::Texture::d_, blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::Texture::format_, blender::gpu::MTLContext::get(), get_metal_handle_base(), blender::gpu::GPU_TEXTURE_2D_ARRAY, blender::gpu::GPU_TEXTURE_3D, blender::gpu::GPU_TEXTURE_ARRAY, blender::gpu::GPU_TEXTURE_CUBE_ARRAY, blender::gpu::Texture::h_, blender::gpu::MTLContext::main_command_buffer, blender::gpu::Texture::mip_size_get(), MTLContext, blender::gpu::Texture::Texture(), blender::gpu::Texture::type_, and blender::gpu::Texture::w_.
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 1253 of file mtl_texture.mm.
References blender::BLI_assert(), BLI_assert_msg, blender::gpu::MTLContext::device, blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::Texture::format_, blender::gpu::Texture::format_flag_, blender::G, blender::G_DEBUG_GPU, blender::gpu::MTLContext::get(), blender::gpu::GPU_FORMAT_COMPRESSED, blender::gpu::MTLContext::main_command_buffer, blender::gpu::Texture::mipmaps_, MTL_LOG_ERROR, MTL_LOG_WARNING, and MTLContext.
| id< MTLTexture > blender::gpu::gpu::MTLTexture::get_metal_handle | ( | ) |
Definition at line 246 of file mtl_texture.mm.
References blender::BLI_assert(), BLI_assert_msg, init_internal(), and MTL_LOG_DEBUG.
Referenced by blender::gpu::ensure_texture_bindings().
| id< MTLTexture > blender::gpu::gpu::MTLTexture::get_metal_handle_base | ( | ) |
Definition at line 299 of file mtl_texture.mm.
References blender::BLI_assert(), and BLI_assert_msg.
Referenced by blender::gpu::MTLFrameBuffer::bake_render_pass_descriptor(), copy_to(), blender::gpu::ensure_texture_bindings(), get_non_srgb_handle(), and xr_blit.
|
inline |
Definition at line 298 of file mtl_texture.hh.
References blender::gpu::Texture::name_.
Referenced by init_internal(), and blender::gpu::MTLContext::texture_bind().
| id< MTLTexture > blender::gpu::MTLTexture::get_non_srgb_handle | ( | ) |
Definition at line 2520 of file mtl_texture.mm.
References blender::BLI_assert(), and get_metal_handle_base().
Referenced by blender::gpu::MTLFrameBuffer::bake_render_pass_descriptor().
| MTLSamplerState blender::gpu::gpu::MTLTexture::get_sampler_state | ( | ) |
Definition at line 486 of file mtl_texture.mm.
References blender::gpu::Texture::sampler_state, and blender::gpu::MTLSamplerState::state.
Referenced by blender::gpu::MTLStateManager::texture_bind().
| MTLStorageBuf * blender::gpu::gpu::MTLTexture::get_storagebuf | ( | ) |
Definition at line 2493 of file mtl_texture.mm.
References blender::BLI_assert(), BLI_assert_msg, length(), blender::gpu::MTLStorageBuf::MTLStorageBuf(), and MTLStorageBuf.
Referenced by blender::gpu::bind_atomic_workaround_buffer().
|
inline |
Definition at line 321 of file mtl_texture.hh.
Referenced by blender::gpu::bind_atomic_workaround_buffer().
Definition at line 311 of file mtl_texture.hh.
Referenced by blender::gpu::MTLVertBuf::bind_as_texture().
|
inline |
Definition at line 303 of file mtl_texture.hh.
Referenced by blender::gpu::ensure_texture_bindings().
|
overrideprotectedvirtual |
Implements blender::gpu::Texture.
Definition at line 1981 of file mtl_texture.mm.
References blender::gpu::Texture::d_, blender::GPU_max_texture_3d_size(), blender::gpu::GPU_TEXTURE_3D, blender::gpu::Texture::h_, blender::gpu::Texture::type_, and blender::gpu::Texture::w_.
Referenced by get_metal_handle().
|
overrideprotectedvirtual |
Implements blender::gpu::Texture.
Definition at line 2096 of file mtl_texture.mm.
References blender::BLI_assert(), ELEM, blender::gpu::Texture::format_, and blender::GPU_texture_usage().
|
overrideprotectedvirtual |
Implements blender::gpu::Texture.
Definition at line 1993 of file mtl_texture.mm.
References blender::gpu::MTLVertBuf::bind(), blender::BLI_assert(), BLI_assert_msg, blender::ceil_to_multiple_ul(), blender::gpu::MTLContext::device, blender::gpu::MTLVertBuf::flag_used(), blender::gpu::Texture::format_, blender::gpu::MTLContext::get(), blender::gpu::get_mtl_format_bytesize(), get_name(), blender::gpu::GPU_TEXTURE_BUFFER, blender::gpu::gpu_texture_format_to_metal(), blender::GPU_vertbuf_get_format(), blender::bke::subdiv::init(), blender::gpu::Texture::mipmaps_, MTL_LOG_WARNING, MTLContext, blender::gpu::Texture::type_, blender::gpu::VertBuf::vertex_len, and blender::gpu::Texture::w_.
| bool blender::gpu::MTLTexture::is_format_srgb | ( | ) |
Definition at line 2515 of file mtl_texture.mm.
References blender::gpu::Texture::format_.
Referenced by blender::gpu::MTLFrameBuffer::bake_render_pass_descriptor().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 1499 of file mtl_texture.mm.
References blender::BLI_assert(), blender::data, blender::gpu::Texture::format_, blender::gpu::Texture::format_flag_, blender::gpu::GPU_FORMAT_COMPRESSED, blender::gpu::Texture::mip_size_get(), blender::gpu::Texture::mipmaps_, MTL_LOG_WARNING, blender::gpu::Texture::read_size_get(), blender::gpu::to_component_len(), and blender::gpu::validate_data_format().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 1452 of file mtl_texture.mm.
References blender::gpu::swizzle_to_mtl().
| bool blender::gpu::gpu::MTLTexture::texture_is_baked | ( | ) |
Definition at line 2139 of file mtl_texture.mm.
|
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.
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 1169 of file mtl_texture.mm.
References blender::BLI_assert(), blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::Texture::format_, blender::gpu::MTLContext::get(), blender::gpu::MTLPixelBuffer::get_metal_buffer(), blender::gpu::GPU_TEXTURE_2D, blender::gpu::MTLContext::main_command_buffer, MTLContext, blender::gpu::to_bytesize(), blender::gpu::to_component_len(), blender::gpu::Texture::type_, blender::gpu::unwrap(), and blender::gpu::validate_data_format().
|
friend |
Definition at line 181 of file mtl_texture.hh.
References MTLContext.
Referenced by clear(), copy_to(), generate_mipmap(), init_internal(), MTLContext, update_sub(), update_sub(), and ~MTLTexture().
|
friend |
Definition at line 183 of file mtl_texture.hh.
References MTLFrameBuffer.
Referenced by MTLFrameBuffer.
|
friend |
Definition at line 182 of file mtl_texture.hh.
References MTLStateManager.
Referenced by MTLStateManager.
|
friend |
Definition at line 184 of file mtl_texture.hh.
References MTLStorageBuf.
Referenced by get_storagebuf(), and MTLStorageBuf.
|
friend |
Definition at line 185 of file mtl_texture.hh.
References MTLTexturePool, and xr_blit.
Referenced by MTLTexturePool.
|
friend |
Definition at line 2105 of file mtl_context.mm.
References blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::MTLContext::get(), blender::gpu::MTLFrameBuffer::get_color_attachment(), blender::gpu::MTLContext::get_current_framebuffer(), get_metal_handle_base(), blender::gpu::MTLContext::main_command_buffer, blender::gpu::MTLAttachment::texture, and xr_blit.
Referenced by MTLTexturePool, and xr_blit.