Blender V4.3
draw_texture_pool.hh File Reference
#include "GPU_texture.hh"

Go to the source code of this file.

Functions

DRWTexturePoolDRW_texture_pool_create ()
 
void DRW_texture_pool_free (DRWTexturePool *pool)
 
GPUTexture * DRW_texture_pool_query (DRWTexturePool *pool, int width, int height, eGPUTextureFormat format, eGPUTextureUsage usage, void *user)
 
GPUTexture * DRW_texture_pool_texture_acquire (DRWTexturePool *pool, int width, int height, eGPUTextureFormat format, eGPUTextureUsage usage)
 
void DRW_texture_pool_texture_release (DRWTexturePool *pool, GPUTexture *tmp_tex)
 
void DRW_texture_pool_take_texture_ownership (DRWTexturePool *pool, GPUTexture *tex)
 
void DRW_texture_pool_give_texture_ownership (DRWTexturePool *pool, GPUTexture *tex)
 
void DRW_texture_pool_reset (DRWTexturePool *pool)
 

Detailed Description

Texture pool A pool that gives temporary render targets that can be reused through other parts of the render pipeline. Expect texture data is garbage when acquiring it.

Definition in file draw_texture_pool.hh.

Function Documentation

◆ DRW_texture_pool_create()

DRWTexturePool * DRW_texture_pool_create ( )

Definition at line 44 of file draw_texture_pool.cc.

Referenced by DRW_viewport_data_create().

◆ DRW_texture_pool_free()

void DRW_texture_pool_free ( DRWTexturePool * pool)

Definition at line 49 of file draw_texture_pool.cc.

References GPU_texture_free(), GPU_TEXTURE_FREE_SAFE, and tex.

Referenced by DRW_viewport_data_free().

◆ DRW_texture_pool_give_texture_ownership()

void DRW_texture_pool_give_texture_ownership ( DRWTexturePool * pool,
GPUTexture * tex )

This Inserts a texture into the texture pool, giving full ownership to the texture pool. The texture needs not to be in the pool already. The texture may be reused in a latter call to DRW_texture_pool_texture_acquire(); IMPORTANT: DRW_texture_pool_texture_release() still needs to be called on this texture after usage.

Definition at line 182 of file draw_texture_pool.cc.

References tex.

Referenced by blender::draw::TextureFromPool::swap().

◆ DRW_texture_pool_query()

GPUTexture * DRW_texture_pool_query ( DRWTexturePool * pool,
int width,
int height,
eGPUTextureFormat format,
eGPUTextureUsage usage,
void * user )

Try to find a texture corresponding to params into the texture pool. If no texture was found, create one and add it to the pool. DEPRECATED: Use DRW_texture_pool_texture_acquire instead and do it just before rendering.

Definition at line 63 of file draw_texture_pool.cc.

References BLI_assert, BLI_assert_msg, G, G_DEBUG_GPU, GPU_texture_create_2d(), GPU_texture_filter_mode(), GPU_texture_format(), GPU_texture_has_depth_format(), GPU_texture_has_integer_format(), GPU_texture_height(), GPU_texture_usage(), GPU_TEXTURE_USAGE_ATTACHMENT, GPU_texture_width(), SNPRINTF, and DRWTexturePoolHandle::users_bits.

Referenced by DRW_texture_pool_query_2d_ex().

◆ DRW_texture_pool_reset()

void DRW_texture_pool_reset ( DRWTexturePool * pool)

Resets the user bits for each texture in the pool and delete unused ones.

Defer deallocation enough cycles to avoid interleaved calls to different DRW_draw/DRW_render functions causing constant allocation/deallocation (See #113024).

Definition at line 187 of file draw_texture_pool.cc.

References BLI_assert_msg, GPU_texture_free(), DRWTexturePoolHandle::orphan_cycles, and tex.

Referenced by drw_viewport_data_reset().

◆ DRW_texture_pool_take_texture_ownership()

void DRW_texture_pool_take_texture_ownership ( DRWTexturePool * pool,
GPUTexture * tex )

This effectively remove a texture from the texture pool, giving full ownership to the caller. The given texture needs to be been acquired through DRW_texture_pool_texture_acquire(). IMPORTANT: This removes the need for a DRW_texture_pool_texture_release() call on this texture.

Definition at line 177 of file draw_texture_pool.cc.

References tex.

Referenced by blender::draw::TextureFromPool::swap().

◆ DRW_texture_pool_texture_acquire()

GPUTexture * DRW_texture_pool_texture_acquire ( DRWTexturePool * pool,
int width,
int height,
eGPUTextureFormat format,
eGPUTextureUsage usage )

Returns a temporary texture that needs to be released after use. Texture content is undefined.

Definition at line 132 of file draw_texture_pool.cc.

References G, G_DEBUG_GPU, GPU_texture_create_2d(), GPU_texture_format(), GPU_texture_height(), GPU_texture_usage(), GPU_texture_width(), SNPRINTF, and tex.

Referenced by blender::draw::TextureFromPool::acquire().

◆ DRW_texture_pool_texture_release()

void DRW_texture_pool_texture_release ( DRWTexturePool * pool,
GPUTexture * tmp_tex )

Releases a previously acquired texture.

Definition at line 171 of file draw_texture_pool.cc.

Referenced by blender::draw::TextureFromPool::release().