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
This commit is contained in:
Falk David
2025-07-02 14:50:59 +02:00
committed by Falk David
parent 4990edd94d
commit dd16e5f96d

View File

@@ -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. */