2023-08-24 10:54:59 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
|
2025-09-25 10:57:02 +02:00
|
|
|
#include "infos/overlay_extra_infos.hh"
|
2025-02-24 16:17:18 +01:00
|
|
|
|
|
|
|
|
FRAGMENT_SHADER_CREATE_INFO(overlay_image_base)
|
|
|
|
|
|
2025-04-16 20:19:09 +02:00
|
|
|
#include "draw_colormanagement_lib.glsl"
|
2024-10-04 15:48:22 +02:00
|
|
|
#include "select_lib.glsl"
|
2019-12-02 01:40:58 +01:00
|
|
|
|
|
|
|
|
void main()
|
|
|
|
|
{
|
2025-04-14 13:46:41 +02:00
|
|
|
float2 uvs_clamped = clamp(uvs, 0.0f, 1.0f);
|
|
|
|
|
float4 tex_color;
|
2025-04-24 12:50:45 +02:00
|
|
|
tex_color = texture_read_as_linearrgb(img_tx, img_premultiplied, uvs_clamped);
|
2020-02-11 15:18:55 +01:00
|
|
|
|
2025-04-24 12:50:45 +02:00
|
|
|
frag_color = tex_color * ucolor;
|
2019-12-02 01:40:58 +01:00
|
|
|
|
2025-04-24 12:50:45 +02:00
|
|
|
if (!img_alpha_blend) {
|
2019-12-02 01:40:58 +01:00
|
|
|
/* Arbitrary discard anything below 5% opacity.
|
|
|
|
|
* Note that this could be exposed to the User. */
|
2025-04-11 18:28:45 +02:00
|
|
|
if (tex_color.a < 0.05f) {
|
2025-05-05 09:59:00 +02:00
|
|
|
gpu_discard_fragment();
|
2019-12-02 01:40:58 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2025-04-24 12:50:45 +02:00
|
|
|
frag_color.a = 1.0f;
|
2019-12-02 01:40:58 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-07-03 01:46:45 +02:00
|
|
|
|
|
|
|
|
/* Pre-multiplied blending. */
|
2025-04-24 12:50:45 +02:00
|
|
|
frag_color.rgb *= frag_color.a;
|
2024-08-30 18:11:14 +02:00
|
|
|
|
|
|
|
|
select_id_output(select_id);
|
2019-12-02 01:40:58 +01:00
|
|
|
}
|