Blender V5.0
blender::gpu::GLTexture Class Reference

#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
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
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)

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 (gpu::Texture *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_
TextureFormat format_
GPUTextureFormatFlag format_flag_
GPUTextureType 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]
FrameBufferfb_ [GPU_TEX_MAX_FBO_ATTACHED]

Detailed Description

Definition at line 20 of file gl_texture.hh.

Constructor & Destructor Documentation

◆ GLTexture()

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

◆ ~GLTexture()

Member Function Documentation

◆ check_feedback_loop()

◆ clear()

void blender::gpu::GLTexture::clear ( eGPUDataFormat format,
const void * data )
overridevirtual

◆ copy_to()

◆ generate_mipmap()

void blender::gpu::GLTexture::generate_mipmap ( )
overridevirtual

This will create the mipmap images and populate them with filtered data from base level.

Warning
Depth textures are not populated but they have their mips correctly defined.
This resets the mipmap range.

Implements blender::gpu::Texture.

Definition at line 359 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().

◆ get_sampler()

GLuint blender::gpu::GLTexture::get_sampler ( const GPUSamplerState & sampler_state)
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 670 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().

◆ init_internal() [1/3]

◆ init_internal() [2/3]

bool blender::gpu::GLTexture::init_internal ( gpu::Texture * src,
int mip_offset,
int layer_offset,
bool use_stencil )
overrideprotectedvirtual

◆ init_internal() [3/3]

◆ mip_range_set()

◆ read()

◆ samplers_free()

void blender::gpu::GLTexture::samplers_free ( )
static

Free the samplers cache generated in samplers_init() method.

Definition at line 664 of file gl_texture.cc.

References GPU_SAMPLER_CUSTOM_TYPES_COUNT.

Referenced by blender::gpu::GLBackend::delete_resources().

◆ samplers_init()

void blender::gpu::GLTexture::samplers_init ( )
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 565 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().

◆ samplers_update()

void blender::gpu::GLTexture::samplers_update ( )
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 636 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().

◆ swizzle_set()

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

◆ update_sub() [1/2]

◆ update_sub() [2/2]

◆ GLFrameBuffer

◆ GLStateManager

friend class GLStateManager
friend

Definition at line 21 of file gl_texture.hh.

References GLStateManager.

Referenced by GLStateManager.


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