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