aboutsummaryrefslogtreecommitdiff
path: root/subprojects/d2tk/pugl/examples/shaders/meson.build
blob: e47be9d655794d1367b575a04b57462dd855cd9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
shader_files = [
  'header_330.glsl',
  'header_420.glsl',
  'rect.frag',
  'rect.vert',
]

# Copy shader sources for GL examples
foreach shader_file : shader_files
  configure_file(copy: true, input: shader_file, output: shader_file)
endforeach

# Build SPV shader binaries for Vulkan examples
if vulkan_dep.found()
  cat = find_program('../../scripts/cat.py')
  glslang = find_program('glslangValidator')

  shaders = ['rect.vert', 'rect.frag']
  foreach shader : shaders
    source = shader.split('.')[0] + '.vulkan.' + shader.split('.')[1]
    shader_input = custom_target(source,
                                 output: source,
                                 input: ['header_420.glsl', shader],
                                 command: [cat, '@INPUT@'],
                                 build_by_default: true,
                                 capture: true)

    mytarget = custom_target(shader,
                             output: shader + '.spv',
                             input: shader_input,
                             command: [glslang, '-V', '-o', '@OUTPUT@', '@INPUT@'],
                             build_by_default: true,
                             install: false)
  endforeach
endif