20{
22
24 const std::initializer_list<std::string_view> &defines = {}) {
25 m_shaders.push_back(std::make_unique<GLShaderProgram>());
26 if (!
m_shaders.back()->init_from_files(name, filenames, defines)) {
28
30 return false;
31 }
32 return true;
33 };
34
36
37 bool valid = true;
38
39#if ENABLE_OPENGL_ES
40 const std::string prefix = "ES/";
41
42 valid &= append_shader("wireframe", { prefix + "wireframe.vs", prefix + "wireframe.fs" });
43#else
44 const std::string prefix = GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 1) ? "140/" : "110/";
45#endif
46
47 valid &= append_shader("imgui", { prefix + "imgui.vs", prefix + "imgui.fs" });
48
49 valid &= append_shader("flat", { prefix + "flat.vs", prefix + "flat.fs" });
50
51 valid &= append_shader("flat_clip", { prefix + "flat_clip.vs", prefix + "flat_clip.fs" });
52
53 valid &= append_shader("flat_texture", { prefix + "flat_texture.vs", prefix + "flat_texture.fs" });
54
55 valid &= append_shader("background", { prefix + "background.vs", prefix + "background.fs" });
56#if ENABLE_OPENGL_ES
57
58 valid &= append_shader("dashed_lines", { prefix + "dashed_lines.vs", prefix + "dashed_lines.fs" });
59#elif ENABLE_GL_CORE_PROFILE
61
62 valid &= append_shader("dashed_thick_lines", { prefix + "dashed_thick_lines.vs", prefix + "dashed_thick_lines.fs", prefix + "dashed_thick_lines.gs" });
63#endif
64
65 valid &= append_shader("toolpaths_cog", { prefix + "toolpaths_cog.vs", prefix + "toolpaths_cog.fs" });
66
67 valid &= append_shader("gouraud_light", { prefix + "gouraud_light.vs", prefix + "gouraud_light.fs" });
68
69 valid &= append_shader("gouraud_light_clip", { prefix + "gouraud_light_clip.vs", prefix + "gouraud_light_clip.fs" });
70
71 valid &= append_shader("printbed", { prefix + "printbed.vs", prefix + "printbed.fs" });
72
73 if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 3)) {
74 valid &= append_shader("gouraud_light_instanced", { prefix + "gouraud_light_instanced.vs", prefix + "gouraud_light_instanced.fs" });
75 }
76
77 valid &= append_shader("gouraud", { prefix + "gouraud.vs", prefix + "gouraud.fs" }
78#if ENABLE_ENVIRONMENT_MAP
79 , { "ENABLE_ENVIRONMENT_MAP"sv }
80#endif
81 );
82
83 valid &= append_shader("variable_layer_height", { prefix + "variable_layer_height.vs", prefix + "variable_layer_height.fs" });
84
85 valid &= append_shader("mm_contour", { prefix + "mm_contour.vs", prefix + "mm_contour.fs" });
86
87
88
89
90
91
93 valid &= append_shader("mm_gouraud", { prefix + "mm_gouraud.vs", prefix + "mm_gouraud.fs" }, { "FLIP_TRIANGLE_NORMALS"sv });
94 else
95 valid &= append_shader("mm_gouraud", { prefix + "mm_gouraud.vs", prefix + "mm_gouraud.fs" });
96
97 return { valid,
error };
98}
std::array< std::string, static_cast< size_t >(EShaderType::Count)> ShaderFilenames
Definition GLShader.hpp:29
static const GLInfo & get_gl_info()
Definition OpenGLManager.hpp:141
PlatformFlavor platform_flavor()
Definition Platform.cpp:103
static char error[256]
Definition tga.cpp:50