diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_pbvh_pixels.hh | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image_gpu.cc | 14 |
2 files changed, 20 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh_pixels.hh b/source/blender/blenkernel/BKE_pbvh_pixels.hh index e73950e6299..ad8eca2b36f 100644 --- a/source/blender/blenkernel/BKE_pbvh_pixels.hh +++ b/source/blender/blenkernel/BKE_pbvh_pixels.hh @@ -186,8 +186,14 @@ struct NodeData { { UDIMTilePixels *tile = find_tile_data(image_tile); if (tile && tile->flags.dirty) { - BKE_image_partial_update_mark_region( - &image, image_tile.image_tile, &image_buffer, &tile->dirty_region); + if (image_buffer.planes == 8) { + image_buffer.planes = 32; + BKE_image_partial_update_mark_full_update(&image); + } + else { + BKE_image_partial_update_mark_region( + &image, image_tile.image_tile, &image_buffer, &tile->dirty_region); + } tile->clear_dirty(); } } diff --git a/source/blender/blenkernel/intern/image_gpu.cc b/source/blender/blenkernel/intern/image_gpu.cc index 6506b40b603..08fdd715512 100644 --- a/source/blender/blenkernel/intern/image_gpu.cc +++ b/source/blender/blenkernel/intern/image_gpu.cc @@ -138,6 +138,8 @@ static GPUTexture *gpu_texture_create_tile_array(Image *ima, ImBuf *main_ibuf) int arraywidth = 0, arrayheight = 0; ListBase boxes = {nullptr}; + int planes = 0; + LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) { ImageUser iuser; BKE_imageuser_default(&iuser); @@ -164,6 +166,7 @@ static GPUTexture *gpu_texture_create_tile_array(Image *ima, ImBuf *main_ibuf) BKE_image_release_ibuf(ima, ibuf, nullptr); BLI_addtail(&boxes, packtile); + planes = max_ii(planes, ibuf->planes); } } @@ -195,9 +198,15 @@ static GPUTexture *gpu_texture_create_tile_array(Image *ima, ImBuf *main_ibuf) } const bool use_high_bitdepth = (ima->flag & IMA_HIGH_BITDEPTH); + const bool use_grayscale = planes <= 8; /* Create Texture without content. */ - GPUTexture *tex = IMB_touch_gpu_texture( - ima->id.name + 2, main_ibuf, arraywidth, arrayheight, arraylayers, use_high_bitdepth); + GPUTexture *tex = IMB_touch_gpu_texture(ima->id.name + 2, + main_ibuf, + arraywidth, + arrayheight, + arraylayers, + use_high_bitdepth, + use_grayscale); /* Upload each tile one by one. */ LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) { @@ -223,6 +232,7 @@ static GPUTexture *gpu_texture_create_tile_array(Image *ima, ImBuf *main_ibuf) tilelayer, UNPACK2(tilesize), use_high_bitdepth, + use_grayscale, store_premultiplied); } |