Blender V4.3
select_id_info.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6#include "select_defines.hh"
7
8/* -------------------------------------------------------------------- */
12GPU_SHADER_INTERFACE_INFO(select_id_iface, "").flat(Type::INT, "select_id");
13
14GPU_SHADER_CREATE_INFO(select_id_flat)
15 .push_constant(Type::FLOAT, "sizeVertex")
16 .push_constant(Type::INT, "offset")
17 .push_constant(Type::FLOAT, "retopologyOffset")
18 .vertex_in(0, Type::VEC3, "pos")
19 .vertex_in(1, Type::INT, "index")
20 .vertex_out(select_id_iface)
21 .fragment_out(0, Type::UINT, "fragColor")
22 .vertex_source("select_id_vert.glsl")
23 .fragment_source("select_id_frag.glsl")
24 .additional_info("draw_modelmat")
25 .do_static_compilation(true);
26
27GPU_SHADER_CREATE_INFO(select_id_uniform)
28 .define("UNIFORM_ID")
29 .push_constant(Type::FLOAT, "sizeVertex")
30 .push_constant(Type::INT, "select_id")
31 .push_constant(Type::FLOAT, "retopologyOffset")
32 .vertex_in(0, Type::VEC3, "pos")
33 .fragment_out(0, Type::UINT, "fragColor")
34 .vertex_source("select_id_vert.glsl")
35 .fragment_source("select_id_frag.glsl")
36 .additional_info("draw_modelmat")
37 .do_static_compilation(true);
38
39GPU_SHADER_CREATE_INFO(select_id_flat_clipped)
40 .additional_info("select_id_flat")
41 .additional_info("drw_clipped")
42 .do_static_compilation(true);
43
44GPU_SHADER_CREATE_INFO(select_id_uniform_clipped)
45 .additional_info("select_id_uniform")
46 .additional_info("drw_clipped")
47 .do_static_compilation(true);
48
49/* Used to patch overlay shaders. */
50GPU_SHADER_CREATE_INFO(select_id_patch)
51 .typedef_source("select_shader_shared.hh")
52 .vertex_out(select_id_iface)
53 /* Need to make sure the depth & stencil comparison runs before the fragment shader. */
54 .early_fragment_test(true)
55 .uniform_buf(SELECT_DATA, "SelectInfoData", "select_info_buf")
56 /* Select IDs for instanced draw-calls not using #PassMain. */
57 .storage_buf(SELECT_ID_IN, Qualifier::READ, "int", "in_select_buf[]")
58 /* Stores the result of the whole selection drawing. Content depends on selection mode. */
59 .storage_buf(SELECT_ID_OUT, Qualifier::READ_WRITE, "uint", "out_select_buf[]");
60
63GPU_SHADER_CREATE_INFO(select_debug_fullscreen)
64 .additional_info("draw_fullscreen")
65 .fragment_source("select_debug_frag.glsl")
66 .sampler(0, ImageType::UINT_2D, "image")
67 .fragment_out(0, Type::VEC4, "fragColor")
68 .do_static_compilation(true);
#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name)
#define GPU_SHADER_CREATE_INFO(_info)
#define SELECT_DATA
#define SELECT_ID_IN
#define SELECT_ID_OUT