|
Blender V4.3
|
#include <gl_texture.hh>
Inherits blender::gpu::Texture.
Friends | |
| class | GLStateManager |
| class | GLFrameBuffer |
Sampler objects | |
| static void | samplers_init () |
| static void | samplers_free () |
| static void | samplers_update () |
| 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 (GPUTexture *src, int mip_offset, int layer_offset, bool use_stencil) override |
Operations | |
| void | update_sub (int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data) override |
| void | update_sub (int offset[3], int extent[3], eGPUDataFormat format, GPUPixelBuffer *pixbuf) override |
| void | generate_mipmap () override |
| void | copy_to (Texture *dst) override |
| void | clear (eGPUDataFormat format, const void *data) override |
| void * | read (int mip, eGPUDataFormat type) override |
Getters & setters | |
| void | swizzle_set (const char swizzle_mask[4]) override |
| void | mip_range_set (int min, int max) 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_ |
| eGPUTextureFormat | format_ |
| eGPUTextureFormatFlag | format_flag_ |
| eGPUTextureType | type_ |
| eGPUTextureUsage | gpu_image_usage_flags_ |
| int | mipmaps_ = -1 |
| int | mip_min_ = 0 |
| int | mip_max_ = 0 |
| char | name_ [DEBUG_NAME_LEN] |
| GPUAttachmentType | fb_attachment_ [GPU_TEX_MAX_FBO_ATTACHED] |
| FrameBuffer * | fb_ [GPU_TEX_MAX_FBO_ATTACHED] |
Definition at line 20 of file gl_texture.hh.
| blender::gpu::GLTexture::GLTexture | ( | const char * | name | ) |
Definition at line 33 of file gl_texture.cc.
References BLI_assert, and blender::gpu::GLContext::get().
| blender::gpu::GLTexture::~GLTexture | ( | ) |
Definition at line 40 of file gl_texture.cc.
References blender::gpu::GLContext::get(), GPU_framebuffer_free(), blender::gpu::StateManager::image_unbind(), blender::gpu::Context::state_manager, blender::gpu::GLContext::tex_free(), blender::gpu::StateManager::texture_unbind(), and blender::gpu::wrap().
| void blender::gpu::GLTexture::check_feedback_loop | ( | ) |
Definition at line 723 of file gl_texture.cc.
References blender::gpu::Context::active_fb, ARRAY_SIZE, fb(), blender::gpu::Texture::fb_, blender::gpu::Texture::fb_attachment_, blender::gpu::Context::get(), blender::gpu::GLContext::get(), GPU_mip_render_workaround(), blender::gpu::GLShader::is_compute(), 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 GPUAttachment::tex.
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 327 of file gl_texture.cc.
References blender::gpu::Texture::attachment_type(), BLI_assert, blender::gpu::GLContext::clear_texture_support, fb(), blender::gpu::Texture::format_, GPU_framebuffer_active_get(), GPU_framebuffer_bind(), blender::gpu::to_gl(), blender::gpu::to_gl_data_format(), and blender::gpu::validate_data_format().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 351 of file gl_texture.cc.
References BLI_assert, blender::gpu::Texture::d_, blender::gpu::Texture::format_, blender::gpu::Texture::h_, blender::gpu::Texture::mip_size_get(), blender::gpu::Texture::type_, UNPACK3, and blender::gpu::Texture::w_.
|
overridevirtual |
This will create the mipmap images and populate them with filtered data from base level.
Implements blender::gpu::Texture.
Definition at line 291 of file gl_texture.cc.
References blender::gpu::GLContext::direct_state_access_support, blender::gpu::Texture::format_flag_, blender::gpu::GLContext::generate_mipmap_workaround, blender::gpu::GPU_FORMAT_COMPRESSED, blender::gpu::GPU_FORMAT_DEPTH, mip_range_set(), blender::gpu::GLContext::state_manager_active_get(), and blender::gpu::GLStateManager::texture_bind_temp().
|
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 606 of file gl_texture.cc.
References BLI_assert, GPUSamplerState::custom_type, GPUSamplerState::extend_x, GPUSamplerState::extend_yz, GPUSamplerState::filtering, GPU_SAMPLER_STATE_TYPE_CUSTOM, GPU_SAMPLER_STATE_TYPE_INTERNAL, blender::gpu::Texture::sampler_state, and GPUSamplerState::type.
Referenced by blender::gpu::GLStateManager::texture_bind().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 761 of file gl_texture.cc.
|
overrideprotectedvirtual |
Return true on success.
Implements blender::gpu::Texture.
Definition at line 54 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_, GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8, GPU_depth_blitting_workaround(), blender::gpu::GPU_TEXTURE_CUBE, blender::gpu::Texture::h_, mip_range_set(), 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_.
|
overrideprotectedvirtual |
Return true on success.
Implements blender::gpu::Texture.
Definition at line 123 of file gl_texture.cc.
References ELEM, blender::gpu::Texture::format_, GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8, 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::unwrap().
|
overrideprotectedvirtual |
Return true on success.
Implements blender::gpu::Texture.
Definition at line 101 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_.
Implements blender::gpu::Texture.
Definition at line 444 of file gl_texture.cc.
References BLI_assert, blender::gpu::GLContext::direct_state_access_support, max, min, blender::gpu::Texture::mip_max_, blender::gpu::Texture::mip_min_, blender::gpu::Texture::mipmaps_, blender::gpu::GLContext::state_manager_active_get(), and blender::gpu::GLStateManager::texture_bind_temp().
Referenced by generate_mipmap(), and init_internal().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 370 of file gl_texture.cc.
References BLI_assert, data, blender::gpu::GLContext::direct_state_access_support, blender::gpu::Texture::format_, blender::gpu::Texture::format_flag_, blender::gpu::GPU_FORMAT_COMPRESSED, blender::gpu::GPU_TEXTURE_CUBE, MEM_mallocN, blender::gpu::Texture::mip_size_get(), blender::gpu::Texture::mipmaps_, blender::gpu::GLContext::state_manager_active_get(), blender::gpu::GLStateManager::texture_bind_temp(), blender::gpu::to_bytesize(), blender::gpu::to_gl(), blender::gpu::to_gl_data_format(), blender::gpu::Texture::type_, and blender::gpu::validate_data_format().
|
static |
Free the samplers cache generated in samplers_init() method.
Definition at line 600 of file gl_texture.cc.
References GPU_SAMPLER_CUSTOM_TYPES_COUNT.
Referenced by blender::gpu::GLBackend::delete_resources().
|
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 501 of file gl_texture.cc.
References GPU_SAMPLER_CUSTOM_COMPARE, GPU_SAMPLER_CUSTOM_ICON, GPU_SAMPLER_CUSTOM_TYPES_COUNT, GPU_SAMPLER_EXTEND_MODES_COUNT, GPU_SAMPLER_FILTERING_LINEAR, GPU_SAMPLER_FILTERING_MIPMAP, GPU_SAMPLER_FILTERING_TYPES_COUNT, blender::gpu::debug::object_label(), sampler(), blender::gpu::Texture::sampler_state, samplers_update(), blender::gpu::to_gl(), and GPUSamplerState::to_string().
Referenced by blender::gpu::GLBackend::GLBackend().
|
static |
Updates the anisotropic filter parameters of samplers that enables anisotropic filtering. This is not done as a one time initialization in samplers_init() method because the user might change the anisotropic filtering samples in the user preferences. So it is called in samplers_init() method as well as every time the user preferences change.
Definition at line 572 of file gl_texture.cc.
References GPU_SAMPLER_EXTEND_MODES_COUNT, GPU_SAMPLER_FILTERING_ANISOTROPIC, GPU_SAMPLER_FILTERING_MIPMAP, GPU_SAMPLER_FILTERING_TYPES_COUNT, min_ff(), and blender::gpu::GLContext::texture_filter_anisotropic_support.
Referenced by samplers_init(), and blender::gpu::GLBackend::samplers_update().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 416 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().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 192 of file gl_texture.cc.
References BLI_assert, blender::gpu::Texture::dimensions_count(), blender::gpu::GLContext::direct_state_access_support, blender::gpu::Texture::format_, blender::gpu::Texture::format_flag_, blender::gpu::GPU_FORMAT_COMPRESSED, blender::gpu::GPU_TEXTURE_CUBE, blender::gpu::Texture::mipmaps_, blender::gpu::debug::raise_gl_error(), blender::gpu::GLContext::state_manager_active_get(), blender::gpu::GLStateManager::texture_bind_temp(), blender::gpu::to_block_size(), blender::gpu::to_gl(), blender::gpu::to_gl_data_format(), blender::gpu::Texture::type_, UNPACK2, UNPACK3, and blender::gpu::validate_data_format().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 255 of file gl_texture.cc.
References BLI_assert, blender::gpu::Texture::dimensions_count(), blender::gpu::Texture::format_, 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 22 of file gl_texture.hh.
|
friend |
Definition at line 21 of file gl_texture.hh.