mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 06:40:08 +00:00
84737a5159
If we build our own targets, we need to include those. This is only relevant when adding new shaders because meson will complain that the (unused) sources don't exist as it tries to include those. And that will make the build.ninja file not be generated which would have build those shaders and would have allowed to copy them into the sources. Note that this makes builds with glslc not care about all the shader files being included with the sources, but we have CI to check that.
106 lines
4.0 KiB
Meson
106 lines
4.0 KiB
Meson
gsk_private_vulkan_include_shaders = [
|
|
'clip.frag.glsl',
|
|
'clip.vert.glsl',
|
|
'common.frag.glsl',
|
|
'common.vert.glsl',
|
|
'constants.glsl',
|
|
'rect.glsl',
|
|
'rect.frag.glsl',
|
|
'rect.vert.glsl',
|
|
'rounded-rect.glsl',
|
|
'rounded-rect.frag.glsl',
|
|
]
|
|
|
|
gsk_private_vulkan_fragment_shaders = [
|
|
'blend-mode.frag',
|
|
'blur.frag',
|
|
'border.frag',
|
|
'color.frag',
|
|
'color-matrix.frag',
|
|
'cross-fade.frag',
|
|
'inset-shadow.frag',
|
|
'linear.frag',
|
|
'mask.frag',
|
|
'outset-shadow.frag',
|
|
'texture.frag',
|
|
]
|
|
|
|
gsk_private_vulkan_vertex_shaders = [
|
|
'blend-mode.vert',
|
|
'blur.vert',
|
|
'border.vert',
|
|
'color.vert',
|
|
'color-matrix.vert',
|
|
'cross-fade.vert',
|
|
'inset-shadow.vert',
|
|
'linear.vert',
|
|
'mask.vert',
|
|
'outset-shadow.vert',
|
|
'texture.vert',
|
|
]
|
|
|
|
gsk_private_vulkan_shaders += gsk_private_vulkan_fragment_shaders
|
|
gsk_private_vulkan_shaders += gsk_private_vulkan_vertex_shaders
|
|
|
|
glslc = find_program('glslc', required: false)
|
|
foreach shader: gsk_private_vulkan_shaders
|
|
basefn = shader.split('.').get(0)
|
|
suffix = shader.split('.').get(1)
|
|
|
|
stage_arg = suffix == 'frag' ? '-fshader-stage=fragment' : '-fshader-stage=vertex'
|
|
spv_shader = '@0@.@1@.spv'.format(basefn, suffix)
|
|
clip_spv_shader = '@0@-clip.@1@.spv'.format(basefn, suffix)
|
|
clip_rounded_spv_shader = '@0@-clip-rounded.@1@.spv'.format(basefn, suffix)
|
|
|
|
if glslc.found()
|
|
compiled_shader = custom_target(spv_shader,
|
|
input: shader,
|
|
output: spv_shader,
|
|
depend_files: gsk_private_vulkan_include_shaders,
|
|
command: [
|
|
glslc,
|
|
stage_arg,
|
|
'-DCLIP_NONE',
|
|
'@INPUT@',
|
|
'-o', '@OUTPUT@'
|
|
])
|
|
compiled_clip_shader = custom_target(clip_spv_shader,
|
|
input: shader,
|
|
output: clip_spv_shader,
|
|
depend_files: gsk_private_vulkan_include_shaders,
|
|
command: [
|
|
glslc,
|
|
stage_arg,
|
|
'-DCLIP_RECT',
|
|
'@INPUT@',
|
|
'-o', '@OUTPUT@'
|
|
])
|
|
compiled_clip_rounded_shader = custom_target(clip_rounded_spv_shader,
|
|
input: shader,
|
|
output: clip_rounded_spv_shader,
|
|
depend_files: gsk_private_vulkan_include_shaders,
|
|
command: [
|
|
glslc,
|
|
stage_arg,
|
|
'-DCLIP_ROUNDED_RECT',
|
|
'@INPUT@',
|
|
'-o', '@OUTPUT@'
|
|
])
|
|
gsk_private_vulkan_compiled_shaders_deps += [compiled_shader, compiled_clip_shader, compiled_clip_rounded_shader]
|
|
gsk_private_vulkan_compiled_shaders += [spv_shader, clip_spv_shader, clip_rounded_spv_shader]
|
|
else
|
|
gsk_private_vulkan_compiled_shaders += files(spv_shader, clip_spv_shader, clip_rounded_spv_shader)
|
|
endif
|
|
endforeach
|
|
|
|
foreach shader: gsk_private_vulkan_vertex_shaders
|
|
shader_header = configure_file(output: '@0@.h'.format(shader),
|
|
input: shader,
|
|
command: [
|
|
find_program('generate-header.py'),
|
|
'@INPUT@',
|
|
],
|
|
capture: true)
|
|
gsk_private_vulkan_shader_headers += shader_header
|
|
endforeach
|