• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © 2022 Konstantin Seurer
2# SPDX-License-Identifier: MIT
3
4# source file, output name, defines
5bvh_shaders = [
6  [
7    'copy.comp',
8    'copy',
9    [],
10  ],
11  [
12    'encode.comp',
13    'encode',
14    ['COMPACT=0'],
15  ],
16  [
17    'encode.comp',
18    'encode_compact',
19    ['COMPACT=1'],
20  ],
21  [
22    'header.comp',
23    'header',
24    [],
25  ],
26  [
27    'update.comp',
28    'update',
29    [],
30  ],
31]
32
33bvh_include_dir = dir_source_root + '/src/amd/vulkan/bvh'
34vk_bvh_include_dir = dir_source_root + '/src/vulkan/runtime/bvh'
35
36bvh_includes = files(
37  'build_helpers.h',
38  'build_interface.h',
39  'bvh.h',
40  vk_bvh_include_dir + '/vk_build_helpers.h',
41  vk_bvh_include_dir + '/vk_bvh.h',
42)
43
44bvh_spv = []
45foreach s : bvh_shaders
46  command = [
47    prog_glslang, '-V', '-I' + bvh_include_dir, '-I' + vk_bvh_include_dir, '--target-env', 'spirv1.5',
48    '-x', '-o', '@OUTPUT@', '@INPUT@', glslang_depfile, glslang_quiet,
49  ]
50
51  foreach define : s[2]
52    command += '-D' + define
53  endforeach
54
55  _bvh_name = '@0@.spv.h'.format(s[1])
56  bvh_spv += custom_target(
57    _bvh_name,
58    input : s[0],
59    output : _bvh_name,
60    command : command,
61    depfile : f'@_bvh_name@.d',
62    depend_files: bvh_includes
63  )
64endforeach
65