Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ if get_option('tracy_enable')
)
endif

if get_option('force_fragment_shader_precision_high')
add_project_arguments('-DFORCE_GL_FRAGMENT_PRECISION_HIGH=1', language: 'c')
endif

subdir('protocol')
subdir('render')

Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
option('examples', type: 'boolean', value: true, description: 'Build example applications')
option('renderers', type: 'array', choices: ['auto', 'gles2'], value: ['auto'], description: 'Select built-in renderers')
option('tracy_enable', type: 'boolean', value: false, description: 'Enable profiling')
option( 'force_fragment_shader_precision_high', type: 'boolean', value: false)
4 changes: 4 additions & 0 deletions render/egl.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,11 @@ static bool egl_init(struct wlr_egl *egl, EGLenum platform,
EGLint attribs[7];

attribs[atti++] = EGL_CONTEXT_CLIENT_VERSION;
#ifdef FORCE_GL_FRAGMENT_PRECISION_HIGH
attribs[atti++] = 3;
#else
attribs[atti++] = 2;
#endif

// Request a high priority context if possible
// TODO: only do this if we're running as the DRM master
Expand Down
15 changes: 14 additions & 1 deletion render/fx_renderer/shaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,20 @@

GLuint compile_shader(GLuint type, const GLchar *src) {
GLuint shader = glCreateShader(type);
glShaderSource(shader, 1, &src, NULL);

const char *prefix = "";
#ifdef FORCE_GL_FRAGMENT_PRECISION_HIGH
if (type == GL_FRAGMENT_SHADER) {
prefix =
"#ifndef GL_FRAGMENT_PRECISION_HIGH\n"
"#define GL_FRAGMENT_PRECISION_HIGH 1\n"
"#endif\n";
}
#endif

const GLchar *sources[] = { prefix, src };

glShaderSource(shader, 2, sources, NULL);
glCompileShader(shader);

GLint ok;
Expand Down