Files
test2/source/blender/gpu/shaders/gpu_shader_sequencer_scope_frag.glsl
Clément Foucault fe213f80a4 GPU: Shader: Make info files generated
This is the first step of moving the create infos
back inside shader sources.

All info files are now treated as source files.
However, they are not considered in the include tree
yet. This will come in another following PR.

Each shader source file now generate a `.info` file
containing only the create info declarations.

This renames all info files so that they do not
conflict with their previous versions that were
copied (non-generated).

Pull Request: https://projects.blender.org/blender/blender/pulls/146676
2025-09-25 10:57:02 +02:00

32 lines
1.0 KiB
GLSL

/* SPDX-FileCopyrightText: 2025 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_sequencer_infos.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_sequencer_scope_resolve)
void main()
{
/* Compute shader based scope point rasterizer produced screen-sized
* raster buffer, with accumulated R,G,B,A values in fixed point.
* Fetch data from that buffer and calculate resulting color. */
int2 view_pos = int2(gl_FragCoord.xy);
fragColor = float4(0.0f);
if (any(lessThan(view_pos, int2(0))) ||
any(greaterThanEqual(view_pos, int2(view_width, view_height))))
{
return;
}
int view_index = view_pos.y * view_width + view_pos.x;
SeqScopeRasterData data = raster_buf[view_index];
if (data.col_a != 0) {
float4 pix = float4(data.col_r, data.col_g, data.col_b, data.col_a) / 255.0f;
fragColor.rgb = pix.rgb / pix.a;
/* Use tonemap-like curve to map amount of points to transparency. */
fragColor.w = 1.0f - exp(-pix.a * alpha_exponent);
}
}