1#!/bin/bash
2
3# Copyright 2015 The Android Open Source Project
4# Copyright (C) 2015 Valve Corporation
5
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9
10#      http://www.apache.org/licenses/LICENSE-2.0
11
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
19cd $dir
20
21rm -rf generated
22mkdir -p generated/include generated/common
23
24( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_safe_struct.h )
25( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_safe_struct.cpp )
26( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_struct_size_helper.h )
27( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_struct_size_helper.c )
28( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_enum_string_helper.h )
29( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_object_types.h )
30( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_dispatch_table_helper.h )
31( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml thread_check.h )
32( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml parameter_validation.cpp )
33( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml unique_objects_wrappers.h )
34( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_loader_extensions.h )
35( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_loader_extensions.c )
36( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_layer_dispatch_table.h )
37( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_extension_helper.h )
38( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml object_tracker.cpp )
39( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_typemap_helper.h )
40
41SPIRV_TOOLS_PATH=../../third_party/shaderc/third_party/spirv-tools
42SPIRV_TOOLS_UUID=spirv_tools_uuid.txt
43
44set -e
45
46( cd generated/include;
47
48  if [[ -d $SPIRV_TOOLS_PATH ]]; then
49
50    echo Found spirv-tools, using git_dir for external_revision_generator.py
51
52    python3 ../../../scripts/external_revision_generator.py \
53      --git_dir $SPIRV_TOOLS_PATH \
54      -s SPIRV_TOOLS_COMMIT_ID \
55      -o spirv_tools_commit_id.h
56
57  else
58
59    echo No spirv-tools git_dir found, generating UUID for external_revision_generator.py
60
61    # Ensure uuidgen is installed, this should error if not found
62    type uuidgen
63
64    uuidgen > $SPIRV_TOOLS_UUID;
65    cat $SPIRV_TOOLS_UUID;
66    python3 ../../../scripts/external_revision_generator.py \
67      --rev_file $SPIRV_TOOLS_UUID \
68      -s SPIRV_TOOLS_COMMIT_ID \
69      -o spirv_tools_commit_id.h
70
71  fi
72)
73
74
75exit 0
76