From 25c4dd53dd2007afbcca498c274458527bfbd51f Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Wed, 12 Feb 2025 11:50:44 +0200 Subject: [PATCH] Fix: Keying Screen and anti-aliasing produce bad results The Keying Screen and the Anti-Aliasing nodes produce bad results in the viewport compositor. This is because their cached resources are allocated from the GPU texture pool, so they might get overwritten. To fix this, we make sure those are not allocated from the texture pool. --- .../compositor/cached_resources/intern/keying_screen.cc | 2 +- .../cached_resources/intern/smaa_precomputed_textures.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/compositor/cached_resources/intern/keying_screen.cc b/source/blender/compositor/cached_resources/intern/keying_screen.cc index 7f5e2f8315a..540e05b6701 100644 --- a/source/blender/compositor/cached_resources/intern/keying_screen.cc +++ b/source/blender/compositor/cached_resources/intern/keying_screen.cc @@ -143,7 +143,7 @@ KeyingScreen::KeyingScreen(Context &context, return; } - this->result.allocate_texture(Domain(size)); + this->result.allocate_texture(Domain(size), false); if (context.use_gpu()) { this->compute_gpu(context, smoothness, marker_positions, marker_colors); } diff --git a/source/blender/compositor/cached_resources/intern/smaa_precomputed_textures.cc b/source/blender/compositor/cached_resources/intern/smaa_precomputed_textures.cc index 669e801a4ec..0b3703cb58c 100644 --- a/source/blender/compositor/cached_resources/intern/smaa_precomputed_textures.cc +++ b/source/blender/compositor/cached_resources/intern/smaa_precomputed_textures.cc @@ -89,7 +89,7 @@ void SMAAPrecomputedTextures::compute_gpu() void SMAAPrecomputedTextures::compute_cpu() { const int2 search_texture_size = int2(SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT); - search_texture.allocate_texture(Domain(search_texture_size)); + search_texture.allocate_texture(Domain(search_texture_size), false); parallel_for(search_texture_size, [&](const int2 texel) { const float value = searchTexBytes[int64_t(texel.y) * search_texture_size.x + texel.x] / 255.0f; @@ -97,7 +97,7 @@ void SMAAPrecomputedTextures::compute_cpu() }); const int2 area_texture_size = int2(AREATEX_WIDTH, AREATEX_HEIGHT); - area_texture.allocate_texture(Domain(area_texture_size)); + area_texture.allocate_texture(Domain(area_texture_size), false); parallel_for(area_texture_size, [&](const int2 texel) { const float2 value = float2(uchar2(areaTexBytes + (int64_t(texel.y) * area_texture_size.x + texel.x) * 2)) /