From dd16e5f96de80021f6155ae7a601ae122dc91b85 Mon Sep 17 00:00:00 2001 From: Falk David Date: Wed, 2 Jul 2025 14:50:59 +0200 Subject: [PATCH] Fix #94253: Grease Pencil: Transparency yellow color shift in viewport In the viewport, semi-transparent strokes could appear more yellowish. This was because the `reveal_tx` uses the `GPU_R11F_G11F_B10F` format (loosing precision in the blue channel). Now using `GPU_RGB10_A2` for `reveal_tx` to fix the issue. We don't need to change the format for the `color_tx`. Pull Request: https://projects.blender.org/blender/blender/pulls/141335 --- .../draw/engines/gpencil/gpencil_engine_c.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc index 46456a81922..a8f5d88c9cb 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc +++ b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc @@ -622,19 +622,20 @@ void Instance::acquire_resources() const int2 size = int2(draw_ctx->viewport_size_get()); - eGPUTextureFormat format = this->use_signed_fb ? GPU_RGBA16F : GPU_R11F_G11F_B10F; + const eGPUTextureFormat format_color = this->use_signed_fb ? GPU_RGBA16F : GPU_R11F_G11F_B10F; + const eGPUTextureFormat format_reveal = this->use_signed_fb ? GPU_RGBA16F : GPU_RGB10_A2; this->depth_tx.acquire(size, GPU_DEPTH24_STENCIL8); - this->color_tx.acquire(size, format); - this->reveal_tx.acquire(size, format); + this->color_tx.acquire(size, format_color); + this->reveal_tx.acquire(size, format_reveal); this->gpencil_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_tx), GPU_ATTACHMENT_TEXTURE(this->color_tx), GPU_ATTACHMENT_TEXTURE(this->reveal_tx)); if (this->use_layer_fb) { - this->color_layer_tx.acquire(size, format); - this->reveal_layer_tx.acquire(size, format); + this->color_layer_tx.acquire(size, format_color); + this->reveal_layer_tx.acquire(size, format_reveal); this->layer_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_tx), GPU_ATTACHMENT_TEXTURE(this->color_layer_tx), @@ -642,8 +643,8 @@ void Instance::acquire_resources() } if (this->use_object_fb) { - this->color_object_tx.acquire(size, format); - this->reveal_object_tx.acquire(size, format); + this->color_object_tx.acquire(size, format_color); + this->reveal_object_tx.acquire(size, format_reveal); this->object_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_tx), GPU_ATTACHMENT_TEXTURE(this->color_object_tx), @@ -652,7 +653,7 @@ void Instance::acquire_resources() if (this->use_mask_fb) { /* Use high quality format for render. */ - eGPUTextureFormat mask_format = this->is_render ? GPU_R16 : GPU_R8; + const eGPUTextureFormat mask_format = this->is_render ? GPU_R16 : GPU_R8; /* We need an extra depth to not disturb the normal drawing. */ this->mask_depth_tx.acquire(size, GPU_DEPTH24_STENCIL8); /* The mask_color_tx is needed for frame-buffer completeness. */