Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/image_gpu.c
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
| /* Prototypes. */ | /* Prototypes. */ | ||||
| static void gpu_free_unused_buffers(void); | static void gpu_free_unused_buffers(void); | ||||
| static void image_free_gpu(Image *ima, const bool immediate); | static void image_free_gpu(Image *ima, const bool immediate); | ||||
| /* Is the alpha of the `GPUTexture` for a given image/ibuf premultiplied. */ | /* Is the alpha of the `GPUTexture` for a given image/ibuf premultiplied. */ | ||||
| bool BKE_image_has_gpu_texture_premultiplied_alpha(Image *image, ImBuf *ibuf) | bool BKE_image_has_gpu_texture_premultiplied_alpha(Image *image, ImBuf *ibuf) | ||||
| { | { | ||||
| const bool type_is_premultiplied = (image == NULL) || ELEM(image->type, | const bool type_is_premultiplied = (image == NULL) || | ||||
| IMA_TYPE_R_RESULT, | ELEM(image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE); | ||||
| IMA_TYPE_COMPOSITE, | |||||
| IMA_TYPE_UV_TEST); | |||||
| const bool store_premultiplied = | const bool store_premultiplied = | ||||
| type_is_premultiplied || | type_is_premultiplied || | ||||
| ((ibuf != NULL) && | ((ibuf != NULL) && | ||||
| (ibuf->rect_float ? (image ? (image->alpha_mode != IMA_ALPHA_STRAIGHT) : false) : | (ibuf->rect_float ? (image ? (image->alpha_mode != IMA_ALPHA_STRAIGHT) : false) : | ||||
| (image ? (image->alpha_mode == IMA_ALPHA_PREMUL) : true))); | (image ? (image->alpha_mode == IMA_ALPHA_PREMUL) : true))); | ||||
| return store_premultiplied; | return store_premultiplied; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 732 Lines • Show Last 20 Lines | |||||