From f020e436d5be8eae9efaa8e304eb59f855c41abf Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Wed, 17 Jan 2024 14:45:04 +0200 Subject: [PATCH] Fix #117171: Assert in GPU compositor Denoise node Blender asserts when an Image node is directly connected to a Denoise node in the GPU compositor. This is because the node reads the image to host memory, but the cached image didn't specifiy host read usage. This patch adds the host read usage flag to the IMB module GPU image creation functions. --- source/blender/imbuf/intern/util_gpu.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/imbuf/intern/util_gpu.cc b/source/blender/imbuf/intern/util_gpu.cc index 06238bafa5c..b2d91f92524 100644 --- a/source/blender/imbuf/intern/util_gpu.cc +++ b/source/blender/imbuf/intern/util_gpu.cc @@ -366,14 +366,14 @@ GPUTexture *IMB_create_gpu_texture(const char *name, bool freebuf = false; - /* Create Texture. */ - tex = GPU_texture_create_2d( - name, UNPACK2(size), 9999, tex_format, GPU_TEXTURE_USAGE_SHADER_READ, nullptr); + /* Create Texture. Specifiy read usage to allow both shader and host reads, the latter is needed + * by the GPU compositor. */ + const eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_HOST_READ; + tex = GPU_texture_create_2d(name, UNPACK2(size), 9999, tex_format, usage, nullptr); if (tex == nullptr) { size[0] = max_ii(1, size[0] / 2); size[1] = max_ii(1, size[1] / 2); - tex = GPU_texture_create_2d( - name, UNPACK2(size), 9999, tex_format, GPU_TEXTURE_USAGE_SHADER_READ, nullptr); + tex = GPU_texture_create_2d(name, UNPACK2(size), 9999, tex_format, usage, nullptr); do_rescale = true; } BLI_assert(tex != nullptr);