23{
24 std::string error;
25
27 const std::initializer_list<std::string_view> &defines = {}) {
28 m_shaders.push_back(std::make_unique<GLShaderProgram>());
29 if (!
m_shaders.back()->init_from_files(name, filenames, defines)) {
30 error += name + "\n";
31
33 return false;
34 }
35 return true;
36 };
37
39
40 bool valid = true;
41
42#if SLIC3R_OPENGL_ES
43 const std::string prefix = "ES/";
44
45 valid &= append_shader("wireframe", { prefix + "wireframe.vs", prefix + "wireframe.fs" });
46#else
47 const std::string prefix = GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 1) ? "140/" : "110/";
48#endif
49
50 valid &= append_shader("imgui", { prefix + "imgui.vs", prefix + "imgui.fs" });
51
52 valid &= append_shader("flat", { prefix + "flat.vs", prefix + "flat.fs" });
53
54 valid &= append_shader("flat_clip", { prefix + "flat_clip.vs", prefix + "flat_clip.fs" });
55
56 valid &= append_shader("flat_texture", { prefix + "flat_texture.vs", prefix + "flat_texture.fs" });
57
58 valid &= append_shader("fxaa", { prefix + "fxaa.vs", prefix + "fxaa.fs" });
59
60 valid &= append_shader("ssao", { prefix + "ssao.vs", prefix + "ssao.fs" });
61
62 valid &= append_shader("background", { prefix + "background.vs", prefix + "background.fs" });
63#if SLIC3R_OPENGL_ES
64
65 valid &= append_shader("dashed_lines", { prefix + "dashed_lines.vs", prefix + "dashed_lines.fs" });
66#else
68
69 valid &= append_shader("dashed_thick_lines", { prefix + "dashed_thick_lines.vs", prefix + "dashed_thick_lines.fs", prefix + "dashed_thick_lines.gs" });
70#endif
71
72 valid &= append_shader("gouraud_light", { prefix + "gouraud_light.vs", prefix + "gouraud_light.fs" });
73
74 valid &= append_shader("thumbnail", { prefix + "thumbnail.vs", prefix + "thumbnail.fs"});
75
76 valid &= append_shader("printbed", { prefix + "printbed.vs", prefix + "printbed.fs" });
77#if !SLIC3R_OPENGL_ES
78
79 valid &= append_shader("printbed_shadow", { prefix + "printbed_shadow.vs", prefix + "printbed_shadow.fs" });
80#endif
81 valid &= append_shader("hotbed", {prefix + "hotbed.vs", prefix + "hotbed.fs"});
82
83 if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 3)) {
84 valid &= append_shader("gouraud_light_instanced", { prefix + "gouraud_light_instanced.vs", prefix + "gouraud_light_instanced.fs" });
85 }
86
87
88 valid &= append_shader("gouraud", { prefix + "gouraud.vs", prefix + "gouraud.fs" }
89#if ENABLE_ENVIRONMENT_MAP
90 , { "ENABLE_ENVIRONMENT_MAP"sv }
91#endif
92 );
93
94 valid &= append_shader("phong", { prefix + "phong.vs", prefix + "phong.fs" }
95#if ENABLE_ENVIRONMENT_MAP
96 , { "ENABLE_ENVIRONMENT_MAP"sv }
97#endif
98 );
99
100 valid &= append_shader("xray", { prefix + "xray.vs", prefix + "xray.fs" });
101
102 valid &= append_shader("variable_layer_height", { prefix + "variable_layer_height.vs", prefix + "variable_layer_height.fs" });
103
104 valid &= append_shader("mm_contour", { prefix + "mm_contour.vs", prefix + "mm_contour.fs" });
105
106
107
108
109
110
112 valid &= append_shader("mm_gouraud", { prefix + "mm_gouraud.vs", prefix + "mm_gouraud.fs" }, { "FLIP_TRIANGLE_NORMALS"sv });
113 else
114 valid &= append_shader("mm_gouraud", { prefix + "mm_gouraud.vs", prefix + "mm_gouraud.fs" });
115
116 valid &= append_shader("texture_displacement_shaded", { prefix + "texture_displacement_shaded.vs", prefix + "texture_displacement_shaded.fs" });
117
118
119 valid &= append_shader("texture_displacement_uvcheck", { prefix + "texture_displacement_uvcheck.vs", prefix + "texture_displacement_uvcheck.fs" });
120
121 return { valid, error };
122}
std::array< std::string, static_cast< size_t >(EShaderType::Count)> ShaderFilenames
Definition GLShader.hpp:33
static const GLInfo & get_gl_info()
Definition OpenGLManager.hpp:106
@ OSXOnArm
Definition Platform.hpp:30
PlatformFlavor platform_flavor()
Definition Platform.cpp:108