Fix #143691: Out of bounds 2d painting

When doing 2D image painting the region on the GPU that is updated could
be out of bounds of the texture, resulting in a crash. This PR fixes
this by clamping the gpu region to update to the actual image size.

Pull Request: https://projects.blender.org/blender/blender/pulls/144545
This commit is contained in:
Jeroen Bakker
2025-08-14 10:55:26 +02:00
parent b60ed07236
commit 7d384b4a01

View File

@@ -188,6 +188,10 @@ void ScreenSpaceDrawingMode::do_partial_update(
texture_height / BLI_rctf_size_y(&info.clipping_uv_bounds)),
ceil((changed_overlapping_region_in_uv_space.ymax - info.clipping_uv_bounds.ymin) *
texture_height / BLI_rctf_size_y(&info.clipping_uv_bounds)));
gpu_texture_region_to_update.xmax = min_ii(gpu_texture_region_to_update.xmax,
info.clipping_bounds.xmax);
gpu_texture_region_to_update.ymax = min_ii(gpu_texture_region_to_update.ymax,
info.clipping_bounds.ymax);
rcti tile_region_to_extract;
BLI_rcti_init(