Blender  V3.3
gpu_shader_3D_polyline_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 GPU_SHADER_INTERFACE_INFO(gpu_shader_3D_polyline_iface, "interp")
12  .smooth(Type::VEC4, "color")
13  .smooth(Type::FLOAT, "clip")
14  .no_perspective(Type::FLOAT, "smoothline");
15 
16 GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline)
17  .define("SMOOTH_WIDTH", "1.0")
18  .push_constant(Type::MAT4, "ModelViewProjectionMatrix")
19  .push_constant(Type::VEC2, "viewportSize")
20  .push_constant(Type::FLOAT, "lineWidth")
21  .push_constant(Type::BOOL, "lineSmooth")
22  .vertex_in(0, Type::VEC3, "pos")
23  .vertex_out(gpu_shader_3D_polyline_iface)
24  .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
25  .geometry_out(gpu_shader_3D_polyline_iface)
26  .fragment_out(0, Type::VEC4, "fragColor")
27  .vertex_source("gpu_shader_3D_polyline_vert.glsl")
28  .geometry_source("gpu_shader_3D_polyline_geom.glsl")
29  .fragment_source("gpu_shader_3D_polyline_frag.glsl")
30  .additional_info("gpu_srgb_to_framebuffer_space");
31 
32 GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color)
33  .do_static_compilation(true)
34  .define("UNIFORM")
35  .push_constant(Type::VEC4, "color")
36  .additional_info("gpu_shader_3D_polyline");
37 
38 GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped)
39  .do_static_compilation(true)
40  /* TODO(fclem): Put in a UBO to fit the 128byte requirement. */
41  .push_constant(Type::MAT4, "ModelMatrix")
42  .push_constant(Type::VEC4, "ClipPlane")
43  .define("CLIP")
44  .additional_info("gpu_shader_3D_polyline_uniform_color");
45 
46 GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color)
47  .do_static_compilation(true)
48  .define("FLAT")
49  .vertex_in(1, Type::VEC4, "color")
50  .additional_info("gpu_shader_3D_polyline");
51 
52 GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color)
53  .do_static_compilation(true)
54  .define("SMOOTH")
55  .vertex_in(1, Type::VEC4, "color")
56  .additional_info("gpu_shader_3D_polyline");
#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name)
#define GPU_SHADER_CREATE_INFO(_info)
@ FLOAT