2019-05-16 09:48:24 +00:00
|
|
|
# Shaders
|
|
|
|
gst_vulkan_shader_sources = [
|
|
|
|
'identity.frag',
|
|
|
|
'identity.vert',
|
2019-06-13 08:05:40 +00:00
|
|
|
'swizzle.frag',
|
|
|
|
'swizzle_and_clobber_alpha.frag',
|
2019-06-19 09:09:21 +00:00
|
|
|
'yuy2_to_rgb.frag',
|
|
|
|
'rgb_to_yuy2.frag',
|
|
|
|
'ayuv_to_rgb.frag',
|
|
|
|
'rgb_to_ayuv.frag',
|
2019-06-19 15:39:53 +00:00
|
|
|
'nv12_to_rgb.frag',
|
|
|
|
'rgb_to_nv12.frag',
|
2019-07-04 07:22:07 +00:00
|
|
|
'view_convert.frag',
|
2019-05-16 09:48:24 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
bin2array = find_program('bin2array.py')
|
|
|
|
|
2019-06-19 05:25:18 +00:00
|
|
|
# FIXME: meson compiler class instead?
|
|
|
|
glslc_build_options = []
|
|
|
|
optimization = get_option('optimization')
|
2020-04-03 11:37:47 +00:00
|
|
|
if get_option('debug')
|
2019-06-19 05:25:18 +00:00
|
|
|
glslc_build_options += ['-g']
|
|
|
|
endif
|
|
|
|
if get_option('werror')
|
|
|
|
glslc_build_options += ['-Werror']
|
|
|
|
endif
|
2020-04-03 11:37:47 +00:00
|
|
|
if optimization == 's'
|
2019-06-19 05:25:18 +00:00
|
|
|
glslc_build_options += ['-Os']
|
|
|
|
endif
|
2020-04-03 11:37:47 +00:00
|
|
|
if optimization in ['1', '2', '3']
|
2019-06-19 05:25:18 +00:00
|
|
|
glslc_build_options += ['-O']
|
|
|
|
endif
|
|
|
|
|
2019-05-16 09:48:24 +00:00
|
|
|
vulkan_compiled_shader_sources = []
|
|
|
|
foreach shader: gst_vulkan_shader_sources
|
|
|
|
basefn = shader.split('.').get(0)
|
|
|
|
suffix = shader.split('.').get(1)
|
|
|
|
|
|
|
|
stage_arg = suffix == 'frag' ? '-fshader-stage=fragment' : '-fshader-stage=vertex'
|
|
|
|
basename = '@0@.@1@'.format(basefn, suffix)
|
|
|
|
spv_shader = basename + '.spv'
|
|
|
|
c_shader_source = basename + '.c'
|
|
|
|
c_shader_header = basename + '.h'
|
|
|
|
|
|
|
|
compiled_shader = custom_target(spv_shader,
|
2023-05-12 15:13:21 +00:00
|
|
|
input: shader,
|
|
|
|
output: spv_shader,
|
|
|
|
depfile: '@PLAINNAME@.d',
|
|
|
|
command: [glslc] + glslc_build_options + [stage_arg,
|
|
|
|
'--target-env=vulkan1.0',
|
|
|
|
'-MD', '-MF', '@DEPFILE@',
|
|
|
|
'@INPUT@',
|
|
|
|
'-o', '@OUTPUT@'])
|
2019-05-16 09:48:24 +00:00
|
|
|
|
|
|
|
c_shader = custom_target (c_shader_source,
|
|
|
|
input: compiled_shader,
|
|
|
|
output: [c_shader_source, c_shader_header],
|
|
|
|
command: [ bin2array,
|
|
|
|
'--array-name=' + basename.underscorify(),
|
|
|
|
'--c-include=gst/gst.h',
|
|
|
|
'--element-type=gchar',
|
|
|
|
'--element-size=1',
|
|
|
|
'--linebreak=8',
|
2023-05-12 15:13:21 +00:00
|
|
|
'--input', '@INPUT@',
|
2019-05-16 09:48:24 +00:00
|
|
|
'--output', '@OUTPUT0@',
|
|
|
|
'--header-output', '@OUTPUT1@'])
|
|
|
|
|
|
|
|
vulkan_compiled_shader_sources += [c_shader]
|
|
|
|
endforeach
|