Blender
V3.3
|
#include "imbuf.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "BKE_global.h"
#include "GPU_capabilities.h"
#include "GPU_texture.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
Go to the source code of this file.
Functions | |
static void | imb_gpu_get_format (const ImBuf *ibuf, bool high_bitdepth, eGPUDataFormat *r_data_format, 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, bool *r_freedata) |
GPUTexture * | IMB_touch_gpu_texture (const char *name, ImBuf *ibuf, int w, int h, int layers, bool use_high_bitdepth) |
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_premult) |
GPUTexture * | IMB_create_gpu_texture (const char *name, ImBuf *ibuf, bool use_high_bitdepth, bool use_premult) |
void | IMB_gpu_clamp_half_float (ImBuf *image_buffer) |
GPUTexture* IMB_create_gpu_texture | ( | const char * | name, |
struct ImBuf * | ibuf, | ||
bool | use_high_bitdepth, | ||
bool | use_premult | ||
) |
Definition at line 227 of file util_gpu.c.
References BLI_assert, data, DDSData::data, ImBuf::dds_data, ImBuf::ftype, GPU_texture_anisotropic_filter(), GPU_texture_create_2d(), GPU_texture_create_compressed_2d(), GPU_texture_size_with_limit(), GPU_texture_update(), imb_gpu_get_data(), imb_gpu_get_format(), is_power_of_2_i(), max_ii(), MEM_freeN, NULL, DDSData::nummipmaps, size(), tex, UNPACK2, ImBuf::x, and ImBuf::y.
Referenced by BKE_movieclip_get_gpu_texture(), and image_get_gpu_texture().
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 294 of file util_gpu.c.
References ImBuf::channels, clamp_f(), ImBuf::rect_float, ImBuf::x, and ImBuf::y.
|
static |
Apply colormanagement and scale buffer if needed. *r_freedata
is set to true if the returned buffer need to be manually freed.
Definition at line 87 of file util_gpu.c.
References ImBuf::channels, if(), IMB_allocFromBuffer(), IMB_colormanagement_imbuf_to_byte_texture(), IMB_colormanagement_imbuf_to_float_texture(), IMB_colormanagement_space_is_data(), IMB_colormanagement_space_is_scene_linear(), IMB_colormanagement_space_is_srgb(), IMB_freeImBuf(), IMB_scaleImBuf(), MEM_freeN, MEM_mallocN, NULL, ImBuf::rect, ImBuf::rect_colorspace, ImBuf::rect_float, UNPACK2, ImBuf::x, and ImBuf::y.
Referenced by IMB_create_gpu_texture(), and IMB_update_gpu_texture_sub().
|
static |
Definition at line 25 of file util_gpu.c.
References ImBuf::flags, GPU_DATA_FLOAT, GPU_DATA_UBYTE, GPU_RGBA16F, GPU_RGBA32F, GPU_RGBA8, GPU_SRGB8_A8, IB_halffloat, IMB_colormanagement_space_is_data(), IMB_colormanagement_space_is_scene_linear(), IMB_colormanagement_space_is_srgb(), NULL, ImBuf::rect_colorspace, and ImBuf::rect_float.
Referenced by IMB_create_gpu_texture(), IMB_touch_gpu_texture(), and IMB_update_gpu_texture_sub().
GPUTexture* IMB_touch_gpu_texture | ( | const char * | name, |
struct ImBuf * | ibuf, | ||
int | w, | ||
int | h, | ||
int | layers, | ||
bool | use_high_bitdepth | ||
) |
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 179 of file util_gpu.c.
References GPU_texture_anisotropic_filter(), GPU_texture_create_2d(), GPU_texture_create_2d_array(), imb_gpu_get_format(), NULL, tex, and w().
Referenced by gpu_texture_create_tile_array().
void IMB_update_gpu_texture_sub | ( | struct GPUTexture * | tex, |
struct ImBuf * | ibuf, | ||
int | x, | ||
int | y, | ||
int | z, | ||
int | w, | ||
int | h, | ||
bool | use_high_bitdepth, | ||
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 198 of file util_gpu.c.
References data, GPU_texture_update_sub(), imb_gpu_get_data(), imb_gpu_get_format(), MEM_freeN, size(), tex, w(), x, ImBuf::x, y, ImBuf::y, and z.
Referenced by gpu_texture_create_tile_array().