Edit

kc3-lang/angle/scripts/generate_vulkan_header.py

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2017-01-06 10:43:44
    Hash : a66779fc
    Message : Vulkan: Load layers relative to executable dir. Instead of baking in a relative path and expecting the app to run from a fixed directory, we can change the CWD at runtime so the layers can load relative to the current executable directory. Future alternatives could include modifying the layers SDK to provide a path dynamically, but for now the relative paths must be baked in at compile-time. BUG=angleproject:1319 BUG=chromium:677841 Change-Id: I443b6b35d38276ea667cdf08ec2204ea280b6cec Reviewed-on: https://chromium-review.googlesource.com/425441 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>

  • scripts/generate_vulkan_header.py
  • #!/usr/bin/python
    #
    # Copyright 2016 The ANGLE Project Authors. All rights reserved.
    # Use of this source code is governed by a BSD-style license that can be
    # found in the LICENSE file.
    #
    # generate_vulkan_header.py:
    #   Workaround problems with Windows and GYP and the Vulkan loader paths.
    
    import os, sys
    
    if len(sys.argv) < 4:
        print("Usage: " + sys.argv[0] + " <json_source_path> <output_file> <product_dir>")
        sys.exit(1)
    
    layers_source_path = sys.argv[1]
    output_file = sys.argv[2]
    product_dir = sys.argv[3].rstrip("\"")
    
    def fixpath(inpath):
        return os.path.relpath(inpath, product_dir).replace('\\', '/')
    
    with open(output_file, "w") as outfile:
        outfile.write("#define LAYERS_SOURCE_PATH \"" + fixpath(layers_source_path) + "\"\n")
        outfile.write("#define DEFAULT_VK_LAYERS_PATH \"" + fixpath(product_dir) + "\"\n")