Fix #155302: Crash for huge images in the compositor

The compositor crashes if huge images were used in the compositor. We
already have mechanism to avoid crashes in such cases, but the limits
are not actually safe. Previously, we used 16k for GPUs and 65k for CPU,
but neither is safe, so we reduce that to 8k for GPUs and 32k for CPUs.

Pull Request: https://projects.blender.org/blender/blender/pulls/155403
This commit is contained in:
Omar Emara 2026-03-09 10:31:38 +01:00 • committed by Omar Emara
parent a77a823e43
commit b81cca4033
2 changed files with 2 additions and 3 deletions

View file

@ -116,7 +116,7 @@ void RealizeOnDomainOperation::realize_on_domain_gpu(const float3x3 &inverse_tra
output.allocate_texture(domain);
output.bind_as_image(shader, "domain_img");
compute_dispatch_threads_at_least(shader, domain.data_size);
compute_dispatch_threads_at_least(shader, output.domain().data_size);
input.unbind_as_texture();
output.unbind_as_image();

View file

@ -17,7 +17,6 @@
#include "BLI_math_vector_types.hh"
#include "BLI_utildefines.h"
#include "GPU_capabilities.hh"
#include "GPU_shader.hh"
#include "GPU_state.hh"
#include "GPU_texture.hh"
@ -374,7 +373,7 @@ static Domain sanitize_domain_size(const Domain domain,
Domain sanitized_domain = domain;
const bool use_gpu = storage_type.has_value() ? storage_type.value() == ResultStorageType::GPU :
context.use_gpu();
const int max_size = use_gpu ? GPU_max_texture_size() : 65536;
const int max_size = use_gpu ? 8192 : 32768;
sanitized_domain.data_size = math::clamp(domain.data_size, int2(1), int2(max_size));
return sanitized_domain;
}