477bdc85c9
The main goal of this patch is to improve the readability of how and what fragment shaders are generated. Instead of having C code that assembles each shader variant from literal string snippets, create one big fragment shader source that has everything in it. This relies on a GLSL compiler to optimize statically false conditions and unused uniforms away. Having all the fragment shader code in one file, uncluttered by C string literal syntax, improves readability significantly. A disadvantage is that the code is more verbose, but it allows comments much better. The actual shader code is kept unchanged except: - FRAGMENT_CONVERT_YUV macro is now a proper function - GLSL version is explicitly set to 1.00 ES - RGBA and EXTERNAL use the same path, the difference is how the sampler is declared Further shader code consolidation is possible, but is left for another time. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
57 lines
1.2 KiB
Meson
57 lines
1.2 KiB
Meson
if not get_option('renderer-gl')
|
|
subdir_done()
|
|
endif
|
|
|
|
config_h.set('ENABLE_EGL', '1')
|
|
|
|
vertex_glsl = custom_target(
|
|
'vertex-shader.h',
|
|
command: cmd_xxd + [ '-n', 'vertex_shader' ],
|
|
input: 'vertex.glsl',
|
|
output: 'vertex-shader.h',
|
|
)
|
|
|
|
fragment_glsl = custom_target(
|
|
'fragment-shader.h',
|
|
command: cmd_xxd + [ '-n', 'fragment_shader' ],
|
|
input: 'fragment.glsl',
|
|
output: 'fragment-shader.h',
|
|
)
|
|
|
|
srcs_renderer_gl = [
|
|
'egl-glue.c',
|
|
fragment_glsl,
|
|
'gl-renderer.c',
|
|
'gl-shaders.c',
|
|
linux_dmabuf_unstable_v1_protocol_c,
|
|
linux_dmabuf_unstable_v1_server_protocol_h,
|
|
vertex_glsl,
|
|
]
|
|
|
|
deps_renderer_gl = [
|
|
dep_libm,
|
|
dep_pixman,
|
|
dep_libweston_private,
|
|
dep_libdrm_headers,
|
|
dep_vertex_clipping
|
|
]
|
|
|
|
foreach name : [ 'egl', 'glesv2' ]
|
|
d = dependency(name, required: false)
|
|
if not d.found()
|
|
error('gl-renderer requires @0@ which was not found. Or, you can use \'-Drenderer-gl=false\'.'.format(name))
|
|
endif
|
|
deps_renderer_gl += d
|
|
endforeach
|
|
|
|
plugin_gl = shared_library(
|
|
'gl-renderer',
|
|
srcs_renderer_gl,
|
|
include_directories: common_inc,
|
|
dependencies: deps_renderer_gl,
|
|
name_prefix: '',
|
|
install: true,
|
|
install_dir: dir_module_libweston
|
|
)
|
|
env_modmap += 'gl-renderer.so=@0@;'.format(plugin_gl.full_path())
|