1#!/bin/bash
2
3# Copyright 2022 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17export GFXSTREAM_DIR=$(pwd)
18
19if [ -z "$1" ];
20then
21    export GFXSTREAM_GUEST_DIR=$GFXSTREAM_DIR/guest
22else
23    export GFXSTREAM_GUEST_DIR=$1
24fi
25
26# Detect clang-format
27#if ! $WHICH clang-format > /dev/null; then
28#    echo "Failed to find clang-format." 1>&2
29#    exit 1
30#fi
31
32export GFXSTREAM_GUEST_ENCODER_DIR=$GFXSTREAM_GUEST_DIR/vulkan_enc
33export GFXSTREAM_HOST_DECODER_DIR=$GFXSTREAM_DIR/host/vulkan
34export GFXSTREAM_OUTPUT_DIR=$GFXSTREAM_HOST_DECODER_DIR/cereal
35export GFXSTREAM_SCRIPTS_DIR=$GFXSTREAM_DIR/scripts
36
37export GEN_VK=$GFXSTREAM_DIR/codegen/vulkan/vulkan-docs-next/scripts/genvk.py
38export VK_XML=$GFXSTREAM_DIR/codegen/vulkan/vulkan-docs-next/xml/vk.xml
39export CUSTOM_XML=$GFXSTREAM_DIR/codegen/vulkan/vulkan-docs-next/xml/vk_gfxstream.xml
40
41python3 $GEN_VK -registry $VK_XML -registryGfxstream $CUSTOM_XML cereal -o $GFXSTREAM_OUTPUT_DIR
42
43# Should have a unified headers dir here:
44python3 $GEN_VK -registry $CUSTOM_XML vulkan_gfxstream.h -o $GFXSTREAM_GUEST_ENCODER_DIR
45python3 $GEN_VK -registry $CUSTOM_XML vulkan_gfxstream.h -o $GFXSTREAM_HOST_DECODER_DIR
46