|
Blender V5.3
|
#include <gl_texture.hh>
Inherits blender::gpu::Texture.
Public Member Functions | |
| void | check_feedback_loop () |
| 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 | GLStateManager |
| class | GLFrameBuffer |
| class | GLTexturePool |
Sampler objects | |
| static void | samplers_init () |
| static void | samplers_free () |
| static GLuint | get_sampler (const GPUSamplerState &sampler_state) |
Creation & Deletion | |
| GLTexture (const char *name) | |
| ~GLTexture () | |
| bool | init_internal () override |
| bool | init_internal (VertBuf *vbo) override |
| bool | init_internal (gpu::Texture *src, bool use_stencil) override |
Operations | |
| void | update_sub (int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data, const uint unpack_row_length=0) 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 | read (int mip, eGPUDataFormat type, void *data) override |
Getters & setters | |
| void | swizzle_set (const char swizzle_mask[4]) override |
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 21 of file gl_texture.hh.
| blender::gpu::GLTexture::GLTexture | ( | const char * | name | ) |
Definition at line 37 of file gl_texture.cc.
References blender::BLI_assert(), blender::gpu::GLContext::get(), and blender::gpu::Texture::Texture().
Referenced by copy_to(), GLTexturePool, init_internal(), read(), and blender::gpu::GLBackend::texture_alloc().
| blender::gpu::GLTexture::~GLTexture | ( | ) |
| void blender::gpu::GLTexture::check_feedback_loop | ( | ) |
Definition at line 841 of file gl_texture.cc.
References blender::gpu::Context::active_fb, blender::fb(), blender::gpu::Texture::fb_attachments_, blender::gpu::Context::get(), blender::gpu::GLContext::get(), GLFrameBuffer, blender::gpu::GLShader::is_compute(), blender::GPUAttachment::mip, blender::gpu::Texture::mip_max_, blender::gpu::Texture::mip_min_, blender::gpu::Texture::name_, blender::gpu::debug::raise_gl_error(), blender::gpu::Context::shader, SNPRINTF, and blender::GPUAttachment::tex.
Referenced by GLTexturePool, blender::gpu::GLStateManager::image_bind(), and blender::gpu::GLStateManager::texture_bind().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 419 of file gl_texture.cc.
References blender::gpu::Texture::attachment_type(), blender::data, blender::fb(), blender::GPU_framebuffer_active_get(), blender::GPU_framebuffer_bind(), and blender::gpu::Texture::mipmaps_.
Referenced by GLTexturePool.
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 441 of file gl_texture.cc.
References blender::BLI_assert(), blender::gpu::Texture::d_, blender::gpu::Texture::format_, GLTexture(), blender::gpu::GPU_TEXTURE_1D, blender::gpu::GPU_TEXTURE_ARRAY, blender::gpu::Texture::h_, blender::gpu::Texture::mip_min_, blender::gpu::Texture::mip_size_get(), blender::gpu::Texture::source_texture_, blender::gpu::Texture::Texture(), blender::gpu::Texture::type_, UNPACK3, blender::gpu::Texture::view_layer_start_, and blender::gpu::Texture::w_.
Referenced by GLTexturePool.
|
overridevirtual |
This will create the mipmap images and populate them with filtered data from base level.
Implements blender::gpu::Texture.
Definition at line 394 of file gl_texture.cc.
References blender::gpu::GLContext::direct_state_access_support, blender::gpu::Texture::format_flag_, blender::gpu::GPU_FORMAT_COMPRESSED, blender::gpu::GPU_FORMAT_DEPTH, blender::gpu::GLContext::state_manager_active_get(), and blender::gpu::GLStateManager::texture_bind_temp().
Referenced by GLTexturePool.
|
static |
Get the handle of the OpenGL sampler that corresponds to the given sampler state. The sampler is retrieved from the cached samplers computed in the samplers_init() method.
Definition at line 723 of file gl_texture.cc.
References blender::BLI_assert(), blender::GPUSamplerState::custom_type, blender::GPUSamplerState::extend_x, blender::GPUSamplerState::extend_yz, blender::GPUSamplerState::filtering, blender::GPU_SAMPLER_STATE_TYPE_CUSTOM, blender::GPU_SAMPLER_STATE_TYPE_INTERNAL, blender::gpu::Texture::sampler_state, and blender::GPUSamplerState::type.
Referenced by GLTexturePool, and blender::gpu::GLStateManager::texture_bind().
|
overrideprotectedvirtual |
Return true on success.
Implements blender::gpu::Texture.
Definition at line 58 of file gl_texture.cc.
References blender::gpu::Texture::d_, blender::gpu::Texture::dimensions_count(), blender::gpu::GLContext::direct_state_access_support, blender::gpu::Texture::format_, blender::gpu::GPU_TEXTURE_CUBE, blender::gpu::Texture::h_, blender::gpu::Texture::mipmaps_, blender::gpu::Texture::name_, blender::gpu::debug::object_label(), blender::gpu::GLContext::state_manager_active_get(), blender::gpu::GLStateManager::texture_bind_temp(), blender::gpu::to_gl_internal_format(), blender::gpu::to_gl_target(), blender::gpu::Texture::type_, and blender::gpu::Texture::w_.
Referenced by GLTexturePool.
|
overrideprotectedvirtual |
Return true on success.
Implements blender::gpu::Texture.
Definition at line 121 of file gl_texture.cc.
References ELEM, blender::gpu::Texture::format_, GLTexture(), blender::gpu::Texture::layer_count(), blender::gpu::Texture::mip_min_, blender::gpu::Texture::mipmaps_, blender::gpu::Texture::name_, blender::gpu::debug::object_label(), blender::gpu::to_gl_internal_format(), blender::gpu::to_gl_target(), blender::gpu::Texture::type_, and blender::gpu::Texture::view_layer_start_.
|
overrideprotectedvirtual |
Return true on success.
Implements blender::gpu::Texture.
Definition at line 99 of file gl_texture.cc.
References blender::gpu::GLContext::direct_state_access_support, blender::gpu::Texture::format_, blender::gpu::Texture::name_, blender::gpu::debug::object_label(), blender::gpu::GLContext::state_manager_active_get(), blender::gpu::GLStateManager::texture_bind_temp(), blender::gpu::to_gl_internal_format(), blender::gpu::to_gl_target(), and blender::gpu::Texture::type_.
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 483 of file gl_texture.cc.
References blender::BLI_assert(), blender::data, blender::gpu::Texture::format_, blender::gpu::Texture::format_flag_, blender::gpu::Texture::format_get(), GLTexture(), blender::gpu::GPU_FORMAT_COMPRESSED, blender::gpu::GPU_TEXTURE_1D, blender::gpu::Texture::is_texture_view(), blender::gpu::Texture::mip_min_, blender::gpu::Texture::mip_size_get(), blender::gpu::Texture::mipmaps_, blender::gpu::Texture::read_size_get(), blender::gpu::Texture::source_texture_, blender::gpu::to_gl(), blender::gpu::to_gl_data_format(), blender::gpu::Texture::type_, blender::gpu::validate_data_format(), and blender::gpu::Texture::view_layer_start_.
Referenced by GLTexturePool.
|
static |
Free the samplers cache generated in samplers_init() method.
Definition at line 717 of file gl_texture.cc.
References GPU_SAMPLER_CUSTOM_TYPES_COUNT.
Referenced by blender::gpu::GLBackend::delete_resources(), and GLTexturePool.
|
static |
Pre-generate, setup all possible samplers and cache them in the samplers_state_cache_ and custom_samplers_state_cache_ arrays. This is done to avoid the runtime cost associated with setting up a sampler at draw time.
Definition at line 632 of file gl_texture.cc.
References blender::GPU_SAMPLER_CUSTOM_COMPARE, blender::GPU_SAMPLER_CUSTOM_ICON, GPU_SAMPLER_CUSTOM_TYPES_COUNT, GPU_SAMPLER_EXTEND_MODES_COUNT, blender::GPU_SAMPLER_FILTERING_LINEAR, blender::GPU_SAMPLER_FILTERING_MIPMAP, blender::min_ff(), blender::gpu::debug::object_label(), sampler, blender::gpu::Texture::sampler_state, blender::gpu::GLContext::texture_filter_anisotropic_support, blender::gpu::to_gl(), and blender::GPUSamplerState::to_string().
Referenced by blender::gpu::GLBackend::GLBackend(), and GLTexturePool.
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 534 of file gl_texture.cc.
References blender::gpu::GLContext::direct_state_access_support, blender::gpu::GLContext::state_manager_active_get(), blender::gpu::swizzle_to_gl(), and blender::gpu::GLStateManager::texture_bind_temp().
Referenced by GLTexturePool.
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 190 of file gl_texture.cc.
References blender::BLI_assert(), BLI_assert_msg, blender::data, blender::MutableSpan< T >::data(), blender::Span< T >::data(), blender::gpu::Texture::dimensions_count(), blender::gpu::GLContext::direct_state_access_support, ELEM, blender::math::float_to_half_make_finite_array(), blender::gpu::Texture::format_, blender::gpu::Texture::format_flag_, blender::GPU_DATA_FLOAT, blender::GPU_DATA_HALF_FLOAT, blender::GPU_DATA_INT, blender::gpu::GPU_FORMAT_COMPRESSED, blender::gpu::GPU_TEXTURE_CUBE, blender::IndexRange::IndexRange(), blender::gpu::is_half_float(), blender::gpu::is_half_integer(), blender::max_ii(), blender::MEM_new_uninitialized_aligned(), blender::gpu::Texture::mipmaps_, blender::threading::parallel_for(), blender::gpu::debug::raise_gl_error(), blender::IndexRange::size(), blender::MutableSpan< T >::slice(), blender::Span< T >::slice(), blender::gpu::GLContext::state_manager_active_get(), blender::gpu::GLStateManager::texture_bind_temp(), blender::gpu::to_block_size(), blender::gpu::to_bytesize(), blender::gpu::to_component_len(), blender::gpu::to_gl(), blender::gpu::to_gl_data_format(), blender::gpu::Texture::type_, UNPACK2, UNPACK3, blender::gpu::validate_data_format(), and y.
Referenced by GLTexturePool.
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 358 of file gl_texture.cc.
References blender::BLI_assert(), blender::gpu::Texture::dimensions_count(), blender::gpu::Texture::format_, blender::GPU_pixel_buffer_get_native_handle(), blender::gpu::GLContext::state_manager_active_get(), blender::gpu::GLStateManager::texture_bind_temp(), blender::gpu::to_gl(), blender::gpu::to_gl_data_format(), UNPACK2, UNPACK3, and blender::gpu::validate_data_format().
|
friend |
Definition at line 23 of file gl_texture.hh.
References GLFrameBuffer.
Referenced by check_feedback_loop(), and GLFrameBuffer.
|
friend |
Definition at line 22 of file gl_texture.hh.
References GLStateManager.
Referenced by GLStateManager.
|
friend |
Definition at line 24 of file gl_texture.hh.
References check_feedback_loop(), clear(), copy_to(), blender::data, generate_mipmap(), get_sampler(), GLTexture(), GLTexturePool, GPU_SAMPLER_CUSTOM_TYPES_COUNT, GPU_SAMPLER_EXTEND_MODES_COUNT, init_internal(), max, min, read(), blender::gpu::Texture::sampler_state, samplers_free(), samplers_init(), swizzle_set(), blender::gpu::Texture::Texture(), and update_sub().
Referenced by GLTexturePool.