[gtk+] gsk: Use the appropriate GLSL version
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gsk: Use the appropriate GLSL version
- Date: Tue, 1 Nov 2016 15:23:47 +0000 (UTC)
commit 02c615cc34e51a3b5661b79372f09749b845e864
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue Nov 1 15:00:31 2016 +0000
gsk: Use the appropriate GLSL version
The GLSL versions are:
OpenGL 2.1: #version 110
OpenGL 3.0: #version 130
OpenGL 3.2: #version 150
OpenGLES 2.0: #version 100
OpenGLES 3.0: #version 300 es
So we need to check the version of the GdkGLContext if we want use the
appropriate version, especially for legacy OpenGL contexts, which can be
both 3.x and 2.x.
gsk/gskglrenderer.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gsk/gskglrenderer.c b/gsk/gskglrenderer.c
index c4eec60..0808caa 100644
--- a/gsk/gskglrenderer.c
+++ b/gsk/gskglrenderer.c
@@ -16,8 +16,9 @@
#include <epoxy/gl.h>
-#define SHADER_VERSION_GLES 110
-#define SHADER_VERSION_GL_LEGACY 120
+#define SHADER_VERSION_GLES 100
+#define SHADER_VERSION_GL2_LEGACY 110
+#define SHADER_VERSION_GL3_LEGACY 130
#define SHADER_VERSION_GL3 150
typedef struct {
@@ -213,7 +214,14 @@ gsk_gl_renderer_create_programs (GskGLRenderer *self)
}
else if (gdk_gl_context_is_legacy (self->gl_context))
{
- gsk_shader_builder_set_version (builder, SHADER_VERSION_GL_LEGACY);
+ int maj, min;
+ gdk_gl_context_get_version (self->gl_context, &maj, &min);
+
+ if (maj == 3)
+ gsk_shader_builder_set_version (builder, SHADER_VERSION_GL3_LEGACY);
+ else
+ gsk_shader_builder_set_version (builder, SHADER_VERSION_GL2_LEGACY);
+
gsk_shader_builder_set_vertex_preamble (builder, "gl_common.vs.glsl");
gsk_shader_builder_set_fragment_preamble (builder, "gl_common.fs.glsl");
gsk_shader_builder_add_define (builder, "GSK_LEGACY", "1");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]