From 819ff69ea3306dbecbfa563cae2cf3b5152bc866 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Mon, 2 Dec 2024 16:24:52 +0200 Subject: [PATCH] Fix: Crash in compositor transform node Transform node in the new CPU compositor crash in background mode because of a call to GPU_max_texture_size where the GPU module is not initialized. To fix this, restrict this call to GPU device and use 2^16 as an upper limit for CPU. --- .../realtime_compositor/algorithms/intern/transform.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/compositor/realtime_compositor/algorithms/intern/transform.cc b/source/blender/compositor/realtime_compositor/algorithms/intern/transform.cc index 1a4a5f08011..b297b161980 100644 --- a/source/blender/compositor/realtime_compositor/algorithms/intern/transform.cc +++ b/source/blender/compositor/realtime_compositor/algorithms/intern/transform.cc @@ -26,7 +26,7 @@ namespace blender::realtime_compositor { * size to account for the bounding box of the domain after rotation. The size of the returned * domain is bound and clipped by the maximum possible GPU texture size to avoid allocations that * surpass hardware limits, which is typically 16k. */ -static Domain compute_realized_transformation_domain(const Domain &domain) +static Domain compute_realized_transformation_domain(Context &context, const Domain &domain) { math::AngleRadian rotation; float2 translation, scale; @@ -46,8 +46,8 @@ static Domain compute_realized_transformation_domain(const Domain &domain) const float3x3 transformation = math::from_loc_rot_scale(translation, rotation, scale); - const int2 domain_size = math::clamp( - int2(math::round(size)), int2(1), int2(GPU_max_texture_size())); + const int max_size = context.use_gpu() ? GPU_max_texture_size() : 65536; + const int2 domain_size = math::clamp(int2(math::round(size)), int2(1), int2(max_size)); return Domain(domain_size, transformation); } @@ -71,7 +71,7 @@ void transform(Context &context, input_domain.transform(domain_transformation); /* Realize the input on the target domain using the full transformation. */ - const Domain target_domain = compute_realized_transformation_domain(input_domain); + const Domain target_domain = compute_realized_transformation_domain(context, input_domain); realize_on_domain(context, input, output,