forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
3c1f72671a
commit
02c615cc34
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user