43template<
class BufferType>
48 const size_t type_size,
49 bool initialize_pixels)
55 buffer.data =
static_cast<decltype(BufferType::data)
>(
data);
69 const size_t size = size_t(this->
x) * size_t(this->
y) * 4;
88 const size_t size = size_t(this->
x) * size_t(this->
y) * this->
channels;
120 if (ibuf ==
nullptr) {
130 if (ibuf ==
nullptr) {
146 if (ibuf ==
nullptr) {
154 "'.blend' relative \"//\" must not be used in ImBuf!");
170 if (ibuf ==
nullptr) {
187 uint x,
uint y,
uint channels,
size_t typesize,
bool initialize_pixels,
const char *alloc_name)
195 size_t size = size_t(
x) * size_t(
y) * size_t(channels) * typesize;
202 if (ibuf ==
nullptr) {
209 ibuf->
float_buffer, ibuf->
x, ibuf->
y, channels,
sizeof(
float), initialize_pixels))
223 if (ibuf ==
nullptr) {
295 if (need_secondary_context) {
300 float *output_buffer =
static_cast<float *
>(
304 if (need_secondary_context) {
312 if (!(byte_buffer || float_buffer)) {
338 ImBuf *ibuf =
nullptr;
340 if (!(byte_buffer || float_buffer)) {
369 ImBuf *ibuf = MEM_new<ImBuf>(
"ImBuf_struct");
418 if (ibuf1 ==
nullptr) {
423 if (ibuf2 ==
nullptr) {
442 ibuf2->
ppm[0] = ibuf1->
ppm[0];
443 ibuf2->
ppm[1] = ibuf1->
ppm[1];
460 return size_t(ibuf->
x) * size_t(ibuf->
y);
465 size_t size = 0, channel_size = 0;
467 size +=
sizeof(
ImBuf);
470 channel_size +=
sizeof(char);
474 channel_size +=
sizeof(
float);
499 return chan_id ==
"RGB" || chan_id ==
"RGBA" || chan_id ==
"RA" || chan_id ==
"BA" ||
500 chan_id ==
"GA" || chan_id ==
"R" || chan_id ==
"G" || chan_id ==
"B" || chan_id ==
"A";
Read Blender memory allocation and freeing.
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
ATOMIC_INLINE int32_t atomic_add_and_fetch_int32(int32_t *p, int32_t x)
ATOMIC_INLINE int32_t atomic_load_int32(const int32_t *v)
ATOMIC_INLINE int32_t atomic_sub_and_fetch_int32(int32_t *p, int32_t x)
#define BLI_assert_msg(a, msg)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
friend class ImplicitSharingPtr
virtual bool is_data() const =0
const ImplicitSharingInfo * info_for_mem_free(T *data)
void * MEM_new_uninitialized(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void IMB_activate_gpu_context()
unsigned __int64 uint64_t
ImBuf * IMB_makeSingleUser(ImBuf *ibuf)
void IMB_free_byte_pixels(ImBuf *ibuf)
ImBuf * IMB_allocFromBufferOwn(uint8_t *byte_buffer, float *float_buffer, unsigned int w, unsigned int h, unsigned int channels)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool IMB_chan_id_is_color(StringRef chan_id)
size_t IMB_get_pixel_count(const ImBuf *ibuf)
Get the length of the data of the given image buffer in pixels.
bool IMB_alloc_byte_pixels(ImBuf *ibuf, bool initialize_pixels=true)
void IMB_refImBuf(ImBuf *ibuf)
@ COLOR_ROLE_SCENE_LINEAR
@ COLOR_ROLE_DEFAULT_BYTE
bool IMB_initImBuf(ImBuf *ibuf, unsigned int x, unsigned int y, ImBufFlags flags)
size_t IMB_get_size_in_memory(const ImBuf *ibuf)
ImBuf * IMB_dupImBuf(const ImBuf *ibuf1)
void * imb_alloc_pixels(unsigned int x, unsigned int y, unsigned int channels, size_t typesize, bool initialize_pixels, const char *alloc_name)
void IMB_partial_update_free(ImBuf *ibuf)
void IMB_freeImBuf(ImBuf *ibuf)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
ImColorMode IMB_color_mode_from_channels(int channels)
void GPU_memory_barrier(GPUBarrier barrier)
const char * IMB_colormanagement_role_colorspace_name_get(int role)
BMesh const char void * data
void IMB_ensure_host_buffer(ImBuf *ibuf)
@ GPU_BARRIER_TEXTURE_UPDATE
bool imb_alloc_buffer(BufferType &buffer, const uint x, const uint y, const uint channels, const size_t type_size, bool initialize_pixels)
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, ImBufFlags flags)
imbuf::ChangesetID IMB_partial_update_changeset_id_next()
const ColorSpace * IMB_colormanagement_space_get_named(const char *name)
ImBuf * IMB_allocFromBuffer(const uint8_t *byte_buffer, const float *float_buffer, unsigned int w, unsigned int h, unsigned int channels)
void IMB_free_gpu_textures(ImBuf *ibuf)
void IMB_free_all_data(ImBuf *ibuf)
void * GPU_texture_read(gpu::Texture *texture, eGPUDataFormat data_format, int mip_level)
bool IMB_alloc_float_pixels(ImBuf *ibuf, unsigned int channels, bool initialize_pixels=true)
void colormanage_imbuf_set_default_spaces(ImBuf *ibuf)
void IMB_deactivate_gpu_context()
void IMB_free_float_pixels(ImBuf *ibuf)
size_t(*) MEM_allocN_len(const void *vmemh) ATTR_WARN_UNUSED_RESULT
GPUContext * GPU_context_active_get()
ocio::ColorSpace ColorSpace
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ImplicitSharingPtr sharing_info
const ColorSpace * colorspace
ImplicitSharingPtr sharing_info
const ColorSpace * colorspace
std::atomic< gpu::Texture * > texture
ImbFormatOptions foptions
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
IDProperty * metadata_ptr
const ColorSpace & byte_colorspace() const
const uint8_t * byte_data() const
uint8_t * byte_data_for_write()
std::atomic< imbuf::ChangesetID > full_update_changeset_id
bool colorspace_is_data() const
ImplicitSharingPtr metadata_sharing_info
const float * float_data() const
void assign_byte_data(uint8_t *data)
const ColorSpace & float_colorspace() const
float * float_data_for_write()
void assign_float_data(float *data)