Commit: d743ef91df743941a859a98fb6a94e3982c234b5 Author: Jeroen Bakker Date: Tue Mar 1 10:45:19 2022 +0100 Branches: blender-v3.1-release https://developer.blender.org/rBd743ef91df743941a859a98fb6a94e3982c234b5
Fix 3d texture painting artifacts. When dimension of images aren't a multifold of 256 parts of the gpu textures are not updated. This patch will calculate the correct part of the image that needs to be reuploaded. =================================================================== M source/blender/blenkernel/intern/image_gpu.cc =================================================================== diff --git a/source/blender/blenkernel/intern/image_gpu.cc b/source/blender/blenkernel/intern/image_gpu.cc index 42dcfcd7aa9..d854c043a3e 100644 --- a/source/blender/blenkernel/intern/image_gpu.cc +++ b/source/blender/blenkernel/intern/image_gpu.cc @@ -338,19 +338,25 @@ static void image_gpu_texture_partial_update_changes_available( Image *image, PartialUpdateChecker<ImageTileData>::CollectResult &changes) { while (changes.get_next_change() == ePartialUpdateIterResult::ChangeAvailable) { - const int tile_offset_x = changes.changed_region.region.xmin; - const int tile_offset_y = changes.changed_region.region.ymin; - const int tile_width = min_ii(changes.tile_data.tile_buffer->x, - BLI_rcti_size_x(&changes.changed_region.region)); - const int tile_height = min_ii(changes.tile_data.tile_buffer->y, - BLI_rcti_size_y(&changes.changed_region.region)); + /* Calculate the clipping region with the tile buffer. + * TODO(jbakker): should become part of ImageTileData to deduplicate with image engine. */ + rcti buffer_rect; + BLI_rcti_init( + &buffer_rect, 0, changes.tile_data.tile_buffer->x, 0, changes.tile_data.tile_buffer->y); + rcti clipped_update_region; + const bool has_overlap = BLI_rcti_isect( + &buffer_rect, &changes.changed_region.region, &clipped_update_region); + if (!has_overlap) { + continue; + } + image_update_gputexture_ex(image, changes.tile_data.tile, changes.tile_data.tile_buffer, - tile_offset_x, - tile_offset_y, - tile_width, - tile_height); + clipped_update_region.xmin, + clipped_update_region.ymin, + BLI_rcti_size_x(&clipped_update_region), + BLI_rcti_size_y(&clipped_update_region)); } } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs