Shaders written, for example, GLSL, are usually loaded into the graphics application at runtime. I'm wondering why not just compile the application with shaders so that they do not need to be downloaded later. Like this:
#define glsl(version, glsl) "#version " #version "\n" #glsl
namespace glsl { namespace vs {
constexpr GLchar * const simple = glsl(450 core,
layout(location = 0) in vec3 position;
void main() {
gl_Position = vec4(position, 1.0f);
}
);
} namespace fs {
constexpr GLchar * const simple = glsl(450 core,
out vec4 color;
void main() {
color = vec4(1.0f, 0.0f, 0.0f, 1.0f);
}
);
} }
I do not think that this will lead to a too large exe file, and this will speed up the loading time; if I'm not mistaken about how many shaders are used for a typical graphical application. I understand that you can update the shaders after compilation, but is this really happening?
Is there a reason why I do not want to do this?
source
share