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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user