From d512b31889bf15311d3389f84ce8d9a2fc490720 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Thu, 5 Jul 2018 02:32:58 +0200 Subject: [PATCH] shader: downgrade GLSL to 1.20 because of macOS --- src/shader.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/shader.c b/src/shader.c index 684bf54..ef4661b 100644 --- a/src/shader.c +++ b/src/shader.c @@ -28,7 +28,14 @@ static ALLEGRO_USTR* GetShaderSource(struct Game* game, const char* filename) { FatalError(game, false, "Failed to open shader file %s", filename); return NULL; } - ALLEGRO_USTR* str = al_ustr_new(al_get_opengl_variant() == ALLEGRO_OPENGL_ES ? "#version 100\n" : "#version 130\n"); + + // Use GLSL 1.20 (GL 2.1) and GLSL ES 1.00 (GLES 2.0) + // We need to use 120 for GL because non-core GL profile on macOS is limited to 2.1 + // Even when ignoring macOS, the highest possible option right now is GLSL 1.30, because + // most Mesa drivers implement only OpenGL 3.0 on compatibility profile. + // TODO: upgrade to GLSL 1.50 (GL 3.2, highest possible on macOS) once Allegro works on core profiles + ALLEGRO_USTR* str = al_ustr_new(al_get_opengl_variant() == ALLEGRO_OPENGL_ES ? "#version 100\n" : "#version 120\n"); + while (true) { char buf[512]; size_t n;