|
Blender V4.5
|
#include <gl_texture.hh>
Inherits blender::gpu::Texture.
Public Member Functions | |
| void | check_feedback_loop () |
| uint | gl_bindcode_get () const override |
| Public Member Functions inherited from blender::gpu::Texture | |
| int | width_get () const |
| int | height_get () const |
| int | depth_get () const |
| eGPUTextureUsage | usage_get () const |
| void | mip_size_get (int mip, int r_size[3]) 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 |
| eGPUTextureFormat | format_get () const |
| eGPUTextureFormatFlag | format_flag_get () const |
| eGPUTextureType | 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, eGPUTextureFormat format) |
| bool | init_2D (int w, int h, int layers, int mip_len, eGPUTextureFormat format) |
| bool | init_3D (int w, int h, int d, int mip_len, eGPUTextureFormat format) |
| bool | init_cubemap (int w, int layers, int mip_len, eGPUTextureFormat format) |
| bool | init_buffer (VertBuf *vbo, eGPUTextureFormat format) |
| bool | init_view (GPUTexture *src, eGPUTextureFormat format, eGPUTextureType 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) |
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, blender::gpu::GLContext::get(), and blender::gpu::Texture::Texture().
Referenced by copy_to(), and init_internal().
| 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 720 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(), GLFrameBuffer, GPU_mip_render_workaround(), i, 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.
Referenced by blender::gpu::GLStateManager::image_bind(), and blender::gpu::GLStateManager::texture_bind().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 327 of file gl_texture.cc.
References blender::gpu::Texture::attachment_type(), BLI_assert, data, fb(), blender::gpu::Texture::format_, GPU_framebuffer_active_get(), GPU_framebuffer_bind(), and blender::gpu::validate_data_format().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 347 of file gl_texture.cc.
References BLI_assert, blender::gpu::Texture::d_, blender::gpu::Texture::format_, GLTexture(), blender::gpu::Texture::h_, blender::gpu::Texture::mip_size_get(), blender::gpu::Texture::Texture(), 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 602 of file gl_texture.cc.
References BLI_assert, GPU_SAMPLER_STATE_TYPE_CUSTOM, GPU_SAMPLER_STATE_TYPE_INTERNAL, and blender::gpu::Texture::sampler_state.
Referenced by blender::gpu::GLStateManager::texture_bind().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 758 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_, GLTexture(), GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8, blender::gpu::Texture::mipmaps_, blender::gpu::Texture::name_, blender::gpu::debug::object_label(), this, 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_.
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 440 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 366 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, i, 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 596 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 497 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(), blender::gpu::Texture::sampler_state, samplers_update(), and blender::gpu::to_gl().
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 568 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(), blender::gpu::GLContext::texture_filter_anisotropic_support, and U.
Referenced by samplers_init(), and blender::gpu::GLBackend::samplers_update().
|
overridevirtual |
Implements blender::gpu::Texture.
Definition at line 412 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, data, 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, i, blender::gpu::Texture::mipmaps_, blender::gpu::debug::raise_gl_error(), size(), 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(), GPUPixelBufferNativeHandle::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.
References data, GLFrameBuffer, GPU_SAMPLER_CUSTOM_TYPES_COUNT, GPU_SAMPLER_EXTEND_MODES_COUNT, GPU_SAMPLER_FILTERING_TYPES_COUNT, max, min, blender::gpu::Texture::sampler_state, and blender::gpu::Texture::Texture().
Referenced by check_feedback_loop(), and GLFrameBuffer.
|
friend |
Definition at line 21 of file gl_texture.hh.
References GLStateManager.
Referenced by GLStateManager.