Fix: GPU: Wrong colorspace on context swap

It can happen that the previous context drew with a different
colorspace. In the case where the new context is drawing with
the same shader that was previously bound (shader binding
optimization), the uniform would not be set again because the
dirty flag would not have been set (since the color space of
this new context never changed). The shader would reuse the same
colorspace as the previous context framebuffer (see #137855).

Fix #137855

Pull Request: https://projects.blender.org/blender/blender/pulls/139226
This commit is contained in:
Clément Foucault
2025-05-22 11:54:29 +02:00
committed by Clément Foucault
parent 781b80c017
commit 8768e8553d

View File

@@ -242,6 +242,12 @@ void GPU_context_active_set(GPUContext *ctx_)
if (ctx) {
ctx->activate();
/* It can happen that the previous context drew with a different colorspace.
* In the case where the new context is drawing with the same shader that was previously bound
* (shader binding optimization), the uniform would not be set again because the dirty flag
* would not have been set (since the color space of this new context never changed). The
* shader would reuse the same colorspace as the previous context framebuffer (see #137855). */
ctx->shader_builtin_srgb_is_dirty = true;
}
}