aboutsummaryrefslogtreecommitdiff
path: root/shader.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-05-16 18:55:58 +0200
committerlonkaars <loek@pipeframe.xyz>2024-05-16 18:55:58 +0200
commit107684b00d65eac84e4bf2dfd34073d309230d50 (patch)
tree131215f9b95d1a8a24fa92c99982ee691a7b4724 /shader.c
parent766a817a23403ea2aeb325bea9f340f54a3e7987 (diff)
move shader compilation from runtime to compile-time
Diffstat (limited to 'shader.c')
-rw-r--r--shader.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/shader.c b/shader.c
index df17d5d..321439a 100644
--- a/shader.c
+++ b/shader.c
@@ -8,7 +8,7 @@ void check_shader(GLuint shader) {
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
if (success) return;
glGetShaderInfoLog(shader, LOG_MAX, NULL, debug);
- die("error: shader compilation failed:\n%s\n", debug);
+ die("error: shader compilation failed!\n%s", debug);
}
void check_program(GLuint program) {
@@ -17,13 +17,13 @@ void check_program(GLuint program) {
glGetProgramiv(program, GL_LINK_STATUS, &success);
if (success) return;
glGetProgramInfoLog(program, LOG_MAX, NULL, debug);
- die("error: shader linking failed:\n%s\n", debug);
+ die("error: shader linking failed!\n%s", debug);
}
GLuint load_shader(GLenum type, const char* const src, size_t src_size) {
GLuint shader = glCreateShader(type);
- glShaderSource(shader, 1, &src, (const int*) &src_size);
- glCompileShader(shader);
+ glShaderBinary(1, &shader, GL_SHADER_BINARY_FORMAT_SPIR_V_ARB, src, src_size);
+ glSpecializeShaderARB(shader, "main", 0, 0, 0);
check_shader(shader);
return shader;
}