Blender V5.3
gpu_shader_sequencer_zebra.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
9namespace sequencer::zebra {
10
17
22
23struct VertOut {
25};
26
28 [[in]] const VertIn &v_in,
29 [[out]] VertOut &v_out,
31{
32 position = srt.ModelViewProjectionMatrix * float4(v_in.pos.xy, 0.0f, 1.0f);
33 v_out.uv = v_in.texCoord;
34}
35
36struct FragOut {
38};
39
41 [[frag_coord]] const float4 frag_co,
42 [[in]] const VertOut &v_out,
43 [[out]] FragOut &frag_out)
44{
45 float4 color = texture(srt.image, v_out.uv);
46 if (srt.img_premultiplied) {
47 color_alpha_unpremultiply(color, color);
48 }
49
50 frag_out.color = float4(0.0);
51 int phase = int(mod((frag_co.x + frag_co.y), 6.0f));
52 if (any(greaterThan(color.rgb, float3(srt.zebra_limit)))) {
53 if (phase == 4) {
54 frag_out.color = float4(0.0f, 0.0f, 0.0f, 0.85f);
55 }
56 else if (phase >= 3) {
57 frag_out.color = float4(1.0f, 0.0f, 0.5f, 0.95f);
58 }
59 }
60}
61} // namespace sequencer::zebra
62
void color_alpha_unpremultiply(float4 color, float4 &result)
#define position
#define frag_coord
#define smooth
#define push_constant
#define resource_table
#define sampler(slot)
#define attribute(slot)
#define fragment
#define vertex
#define frag_color(slot)
bool any(VecOp< bool, D >) RET
VecBase< bool, D > greaterThan(VecOp< T, D >, VecOp< T, D >) RET
VecBase< float, D > constexpr mod(VecOp< float, D >, VecOp< float, D >) RET
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
SamplerBase< float, 2 > sampler2D
PipelineGraphic gpu_shader_sequencer_zebra(sequencer::zebra::main_vert, sequencer::zebra::main_frag)
MatBase< float, 4, 4 > float4x4
void main_vert(Resources &srt, const VertIn &v_in, VertOut &v_out, float4 &position)
void main_frag(const Resources &srt, const float4 frag_co, const VertOut &v_out, FragOut &frag_out)