Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 186 additions & 0 deletions scripts/profiles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
#!/usr/bin/python3
#
# Copyright (c) 2026-2026 Google, Inc.
# Copyright (C) 2026-2026 Valve Corporation
# Copyright (c) 2026-2026 LunarG, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Authors:
# - Christophe Riccio <christophe@lunarg.com>

from datetime import datetime
import argparse
import functools
import importlib.resources
import json
import re
import tempfile
import os
import sys
import collections
from vulkan_object import get_vulkan_object

def main_convert(args):
vk = get_vulkan_object()

for version in vk.versions.values():
print(version.name)

def main(argv):
parser = argparse.ArgumentParser(description='Convert Vulkan profile JSON file')
parser.add_argument('convert', action='store',
help='Convert an implicit profile to an explicit profile by pulling Vulkan capabilities dependencies from vk.xml.')
parser.add_argument('--registry', '-r', action='store', # required=True,
help='Use specified registry file instead of vk.xml.')
# parser.add_argument('--config', '-c', action='store',
# help='Use specified a JSON merge config file path instead of using individual arguments.')
# parser.add_argument('--input', '-i', action='store',
# help='Path to directory with profiles.')
# parser.add_argument('--input-profiles', action='store',
# help='Comma separated list of profiles.')
parser.add_argument('--input-path', '-i', action='store',
help='Path to the input profiles file.')
parser.add_argument('--output-path', '-o', action='store', # required=True,
help='Path to the output profiles file.')
# parser.add_argument('--output-profile', action='store',
# help='Profile name of the output profile. Deprecated, replaced by `--profile-name`.')
# parser.add_argument('--profile-name', action='store',
# help='Profile name of the output profile. If the argument is not set, the value is generated.')
# parser.add_argument('--profile-version', action='store',
# help='Override the Profile version of the generated profile. If the argument is not set, the value is 1.')
# parser.add_argument('--profile-label', action='store',
# help='Override the Label of the generated profile. If the argument is not set, the value is generated.')
# parser.add_argument('--profile-desc', action='store',
# help='Override the Description of the generated profile. If the argument is not set, the value is generated.')
# parser.add_argument('--profile-date', action='store',
# help='Override the release date of the generated profile. If the argument is not set, the value is generated.')
# parser.add_argument('--profile-api-version', action='store',
# help='Override the Vulkan API version of the generated profile. If the argument is not set, the value is generated.')
# parser.add_argument('--profile-stage', action='store', choices=['ALPHA', 'BETA', 'STABLE'], default='STABLE',
# help='Override the development stage of the generated profile. If the argument is not set, the value is set to "stable".')
# parser.add_argument('--profile-required-profiles', action='store',
# help='Comma separated list of required profiles by the generated profile.')
# parser.add_argument('--mode', '-m', action='store', choices=['union', 'intersection'], default='intersection',
# help='Mode of profile combination. If the argument is not set, the value is set to "intersection".')
# parser.add_argument('--strip-duplicate-structs', action='store_true',
# help='Strip the duplicated structures in the generated profiles file.')

# parser.set_defaults(mode='intersection')

args = parser.parse_args(argv)

if args.convert is not None:
main_convert(args)
exit()
else:
parser.print_help()
exit()

# profile_configs = list()

# if args.registry is None:
# gen_profiles_solution.Log.e('Merging the profiles requires specifying --registry')
# parser.print_help()
# exit()

#registry = gen_profiles_solution.VulkanRegistry(args.registry)

#if (args.mode.lower() != 'union' and args.mode.lower() != 'intersection'):
# gen_profiles_solution.Log.e('Mode must be either union or intersection')
# parser.print_help()
# exit()

#if args.strip_duplicate_structs:
# gen_profiles_solution.Log.i('Stripping duplicated structures. `--strip-duplicate-structs` is set. Eg the output profiles file will contain VkPhysicalDeviceVulkan11Properties not VkPhysicalDeviceMultiviewPropertiesKHR.')
# strip_duplicate_struct = True
#else:
# strip_duplicate_struct = False

#if args.input_profiles is not None:
# input_profile_names = args.input_profiles.split(',')
#else:
# input_profile_names = list()

#profile_file = ProfileFile()

#if args.config is None:
# profile_config = ProfileConfig(args.input, input_profile_names, args.profile_api_version, args.mode)

# if args.profile_name is not None:
# if not re.match('^VP_[A-Z0-9]+[A-Za-z0-9]+', args.profile_name):
# gen_profiles_solution.Log.e('Invalid profile_name, must follow regex pattern ^VP_[A-Z0-9]+[A-Za-z0-9]+')
# exit()
# else:
# profile_config.name = args.profile_name
# elif args.output_profile is not None:
# if not re.match('^VP_[A-Z0-9]+[A-Za-z0-9]+', args.output_profile):
# gen_profiles_solution.Log.e('Invalid output_profile, must follow regex pattern ^VP_[A-Z0-9]+[A-Za-z0-9]+')
# exit()
# else:
# profile_config.name = args.output_profile

# if args.profile_version is not None:
# profile_config.version = int(args.profile_version)

# if args.profile_label is not None:
# profile_config.label = args.profile_label

# if args.profile_desc is not None:
# profile_config.description = args.profile_desc

# if args.profile_stage is not None:
# profile_config.stage = args.profile_stage

# if args.profile_date is not None:
# profile_config.date = args.profile_date

# if args.profile_required_profiles is not None:
# profile_config.required_profiles = args.profile_required_profiles.split(',')

# profile_configs.append(profile_config)

#else:
# currentdir = os.path.dirname(args.config)

# json_file = open(args.config, "r")
# json_data = json.load(json_file)

# if json_data["$schema"]:
# profile_file.set_schema(json_data["$schema"])
# if json_data["contributors"]:
# profile_file.set_contributors(json_data["contributors"])
# if json_data["history"]:
# profile_file.set_history(json_data["history"])

# for profile_name in json_data["profiles"]:
# profile_value = json_data["profiles"][profile_name]
# profile_config = ProfileConfig(currentdir + "/" + profile_value["input"], list(), profile_value["api-version"], args.mode)
# profile_config.apply_json_value(profile_name, profile_value)
# profile_configs.append(profile_config)

#for config in profile_configs:
# profile_merger = ProfileMerger(registry)
# profile_merger.merge(
# config,
# profile_file,
# args.mode,
# strip_duplicate_struct)

#profile_file.dump(args.output_path)

if __name__ == '__main__':
print(sys.executable)

sys.exit(main(sys.argv[1:]))

Loading