Blender V5.3
workbench_shader_cache.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
11namespace blender::workbench {
12
14{
15 const std::string geometries[] = {"_mesh", "_curves", "_ptcloud", "_gsplat"};
16 const std::string pipelines[] = {"_opaque", "_transparent"};
17 const std::string lightings[] = {"_flat", "_studio", "_matcap"};
18 const std::string shaders[] = {"_material", "_texture"};
19 const std::string clip[] = {"_no_clip", "_clip"};
20 static_assert(std::size(geometries) == geometry_type_len);
21 static_assert(std::size(pipelines) == pipeline_type_len);
22 static_assert(std::size(lightings) == lighting_type_len);
23 static_assert(std::size(shaders) == shader_type_len);
24
25 for (auto g : IndexRange(geometry_type_len)) {
26 for (auto p : IndexRange(pipeline_type_len)) {
27 for (auto l : IndexRange(lighting_type_len)) {
28 for (auto s : IndexRange(shader_type_len)) {
29 for (auto c : IndexRange(2) /*clip*/) {
30 prepass_[g][p][l][s][c] = {"workbench_prepass" + geometries[g] + pipelines[p] +
31 lightings[l] + shaders[s] + clip[c]};
32 }
33 }
34 }
35 }
36 }
37
38 const std::string cavity[] = {"_no_cavity", "_cavity"};
39 const std::string curvature[] = {"_no_curvature", "_curvature"};
40 const std::string shadow[] = {"_no_shadow", "_shadow"};
41
42 for (auto l : IndexRange(lighting_type_len)) {
43 for (auto ca : IndexRange(2) /*cavity*/) {
44 for (auto cu : IndexRange(2) /*curvature*/) {
45 for (auto s : IndexRange(2) /*shadow*/) {
46 resolve_[l][ca][cu][s] = {"workbench_resolve_opaque" + lightings[l] + cavity[ca] +
47 curvature[cu] + shadow[s]};
48 }
49 }
50 }
51 }
52
53 const std::string pass[] = {"_fail", "_pass"};
54 const std::string manifold[] = {"_no_manifold", "_manifold"};
55 const std::string caps[] = {"_no_caps", "_caps"};
56
57 for (auto p : IndexRange(2) /*pass*/) {
58 for (auto m : IndexRange(2) /*manifold*/) {
59 for (auto c : IndexRange(2) /*caps*/) {
60 shadow_[p][m][c] = {"workbench_shadow" + pass[p] + manifold[m] + caps[c] +
61 (DEBUG_SHADOW_VOLUME ? "_debug" : "")};
62 }
63 }
64 }
65
66 const std::string smoke[] = {"_object", "_smoke"};
67 const std::string interpolation[] = {"_linear", "_cubic", "_closest"};
68 const std::string coba[] = {"_no_coba", "_coba"};
69 const std::string slice[] = {"_no_slice", "_slice"};
70
71 for (auto sm : IndexRange(2) /*smoke*/) {
72 for (auto i : IndexRange(3) /*interpolation*/) {
73 for (auto c : IndexRange(2) /*coba*/) {
74 for (auto sl : IndexRange(2) /*slice*/) {
75 volume_[sm][i][c][sl] = {"workbench_volume" + smoke[sm] + interpolation[i] + coba[c] +
76 slice[sl]};
77 }
78 }
79 }
80 }
81}
82
83} // namespace blender::workbench
constexpr IndexRange()=default
ATTR_WARN_UNUSED_RESULT const BMLoop * l
#define DEBUG_SHADOW_VOLUME