Blender  V3.3
gpu_shader_line_dashed_uniform_color_info.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2022 Blender Foundation. All rights reserved. */
3 
8 #include "gpu_interface_info.hh"
10 
11 /* We leverage hardware interpolation to compute distance along the line. */
12 GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface, "")
13  .no_perspective(Type::VEC2, "stipple_start") /* In screen space */
14  .flat(Type::VEC2, "stipple_pos"); /* In screen space */
15 
16 GPU_SHADER_CREATE_INFO(gpu_shader_line_dashed)
17  .vertex_out(flat_color_iface)
18  .push_constant(Type::MAT4, "ModelViewProjectionMatrix")
19  .push_constant(Type::VEC2, "viewport_size")
20  .push_constant(Type::FLOAT, "dash_width")
21  .push_constant(Type::FLOAT, "dash_factor") /* if > 1.0, solid line. */
22  /* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */
23  .push_constant(Type::INT, "colors_len") /* Enabled if > 0, 1 for solid line. */
24  .push_constant(Type::VEC4, "color")
25  .push_constant(Type::VEC4, "color2")
26  .vertex_out(gpu_shader_line_dashed_interface)
27  .fragment_out(0, Type::VEC4, "fragColor")
28  .fragment_source("gpu_shader_2D_line_dashed_frag.glsl");
29 
30 GPU_SHADER_CREATE_INFO(gpu_shader_2D_line_dashed_uniform_color)
31  .vertex_in(0, Type::VEC2, "pos")
32  .vertex_source("gpu_shader_2D_line_dashed_uniform_color_vert.glsl")
33  .additional_info("gpu_shader_line_dashed")
34  .do_static_compilation(true);
35 
36 GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
37  .vertex_in(0, Type::VEC3, "pos")
38  .vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl")
39  .additional_info("gpu_shader_line_dashed")
40  .do_static_compilation(true);
41 
42 GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped)
43  .push_constant(Type::MAT4, "ModelMatrix")
44  .additional_info("gpu_shader_3D_line_dashed_uniform_color")
45  .additional_info("gpu_clip_planes")
46  .do_static_compilation(true);
#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name)
#define GPU_SHADER_CREATE_INFO(_info)
@ FLOAT