Blender V4.3
util_gpu.cc File Reference
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "GPU_capabilities.hh"
#include "GPU_texture.hh"
#include "IMB_colormanagement.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"

Go to the source code of this file.

Functions

static bool imb_is_grayscale_texture_format_compatible (const ImBuf *ibuf)
 
static void imb_gpu_get_format (const ImBuf *ibuf, bool high_bitdepth, bool use_grayscale, eGPUTextureFormat *r_texture_format)
 
static const char * imb_gpu_get_swizzle (const ImBuf *ibuf)
 
static bool IMB_gpu_get_compressed_format (const ImBuf *ibuf, eGPUTextureFormat *r_texture_format)
 
static void * imb_gpu_get_data (const ImBuf *ibuf, const bool do_rescale, const int rescale_size[2], const bool store_premultiplied, const bool allow_grayscale, bool *r_freedata, eGPUDataFormat *r_data_format)
 
GPUTexture * IMB_touch_gpu_texture (const char *name, ImBuf *ibuf, int w, int h, int layers, bool use_high_bitdepth, bool use_grayscale)
 
void IMB_update_gpu_texture_sub (GPUTexture *tex, ImBuf *ibuf, int x, int y, int z, int w, int h, bool use_high_bitdepth, bool use_grayscale, bool use_premult)
 
GPUTexture * IMB_create_gpu_texture (const char *name, ImBuf *ibuf, bool use_high_bitdepth, bool use_premult)
 
eGPUTextureFormat IMB_gpu_get_texture_format (const ImBuf *ibuf, bool high_bitdepth, bool use_grayscale)
 
void IMB_gpu_clamp_half_float (ImBuf *image_buffer)
 

Function Documentation

◆ IMB_create_gpu_texture()

◆ IMB_gpu_clamp_half_float()

void IMB_gpu_clamp_half_float ( ImBuf * image_buffer)

Ensures that values stored in the float rect can safely loaded into half float gpu textures.

Does nothing when given image_buffer doesn't contain a float rect.

Definition at line 404 of file util_gpu.cc.

References ImBuf::channels, clamp_f(), ImBufFloatBuffer::data, ImBuf::float_buffer, ImBuf::x, and ImBuf::y.

◆ IMB_gpu_get_compressed_format()

◆ imb_gpu_get_data()

static void * imb_gpu_get_data ( const ImBuf * ibuf,
const bool do_rescale,
const int rescale_size[2],
const bool store_premultiplied,
const bool allow_grayscale,
bool * r_freedata,
eGPUDataFormat * r_data_format )
static

◆ imb_gpu_get_format()

◆ imb_gpu_get_swizzle()

static const char * imb_gpu_get_swizzle ( const ImBuf * ibuf)
static

◆ IMB_gpu_get_texture_format()

eGPUTextureFormat IMB_gpu_get_texture_format ( const ImBuf * ibuf,
bool high_bitdepth,
bool use_grayscale )

Definition at line 395 of file util_gpu.cc.

References imb_gpu_get_format().

Referenced by uiTemplateImageInfo().

◆ imb_is_grayscale_texture_format_compatible()

◆ IMB_touch_gpu_texture()

GPUTexture * IMB_touch_gpu_texture ( const char * name,
ImBuf * ibuf,
int w,
int h,
int layers,
bool use_high_bitdepth,
bool use_grayscale )

The ibuf is only here to detect the storage type. The produced texture will have undefined content. It will need to be populated by using IMB_update_gpu_texture_sub().

Definition at line 255 of file util_gpu.cc.

References GPU_texture_anisotropic_filter(), GPU_texture_create_2d(), GPU_texture_create_2d_array(), GPU_texture_swizzle_set(), GPU_TEXTURE_USAGE_SHADER_READ, imb_gpu_get_format(), imb_gpu_get_swizzle(), tex, and w().

Referenced by gpu_texture_create_tile_array().

◆ IMB_update_gpu_texture_sub()

void IMB_update_gpu_texture_sub ( GPUTexture * tex,
ImBuf * ibuf,
int x,
int y,
int z,
int w,
int h,
bool use_high_bitdepth,
bool use_grayscale,
bool use_premult )

Will update a #GPUTexture using the content of the ImBuf. Only one layer will be updated. Will resize the ibuf if needed. Z is the layer to update. Unused if the texture is 2D.

Definition at line 281 of file util_gpu.cc.

References GPU_texture_update_sub(), imb_gpu_get_data(), imb_gpu_get_format(), MEM_freeN(), tex, w(), ImBuf::x, ImBuf::y, and z().

Referenced by gpu_texture_create_tile_array().