Exemple #1
0
            print(
                "The extension {} is {} extension - expected an instance extension."
                .format(ext.name, entry.ext_type))
            continue

        if entry.commands and ext.instance_funcs:
            for func in map(lambda f: "vk" + f + ext.vendor(),
                            ext.instance_funcs):
                if func not in entry.commands:
                    error_count += 1
                    print(
                        "The instance function {} is not added by the extension {}."
                        .format(func, ext.name))

        if entry.promoted_in:
            ext.core_since = Version((*entry.promoted_in, 0))

    if error_count > 0:
        print("zink_instance.py: Found {} error(s) in total. Quitting.".format(
            error_count))
        exit(1)

    with open(header_path, "w") as header_file:
        header = Template(header_code).render(extensions=extensions,
                                              layers=layers).strip()
        header = replace_code(header, replacement)
        print(header, file=header_file)

    with open(impl_path, "w") as impl_file:
        impl = Template(impl_code).render(extensions=extensions,
                                          layers=layers).strip()
Exemple #2
0
    Extension("VK_EXT_scalar_block_layout",
        alias="scalar_block_layout",
        features=True,
        conditions=["$feats.scalarBlockLayout"]),
]

# constructor: Versions(device_version(major, minor, patch), struct_version(major, minor))
# The attributes:
#  - device_version: Vulkan version, as tuple, to use with 
#                    VK_MAKE_VERSION(version_major, version_minor, version_patch)
#
#  - struct_version: Vulkan version, as tuple, to use with structures and macros
VERSIONS = [
    # VkPhysicalDeviceVulkan11Properties and VkPhysicalDeviceVulkan11Features is new from Vk 1.2, not Vk 1.1
    # https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#_new_structures
    Version((1,2,0), (1,1)),
    Version((1,2,0), (1,2)),
]

# There exists some inconsistencies regarding the enum constants, fix them.
# This is basically generated_code.replace(key, value).
REPLACEMENTS = {
    "ROBUSTNESS2": "ROBUSTNESS_2",
    "PROPERTIES_PROPERTIES": "PROPERTIES",
}


# This template provides helper functions for the other templates.
# Right now, the following functions are defined:
# - guard(ext) : surrounds the body with an if-def guard according to
#                `ext.extension_name()` if `ext.guard` is True.
        print("usage: %s <path to .h> <path to .c> <path to vk.xml>" %
              sys.argv[0])
        exit(1)

    all_extensions = parse_vkxml(vkxml_path)

    extensions = EXTENSIONS
    layers = LAYERS
    replacement = REPLACEMENTS

    for ext in extensions:
        if ext.name not in all_extensions:
            print("the extension {} is not registered in vk.xml - a typo?".
                  format(ext.name))
            exit(1)

        if all_extensions[ext.name] is not None:
            ext.core_since = Version((*all_extensions[ext.name], 0))

    with open(header_path, "w") as header_file:
        header = Template(header_code).render(extensions=extensions,
                                              layers=layers).strip()
        header = replace_code(header, replacement)
        print(header, file=header_file)

    with open(impl_path, "w") as impl_file:
        impl = Template(impl_code).render(extensions=extensions,
                                          layers=layers).strip()
        impl = replace_code(impl, replacement)
        print(impl, file=impl_file)
Exemple #4
0
              alias="portability_subset_extx",
              properties=True,
              features=True,
              guard=True),
]

# constructor: Versions(device_version(major, minor, patch), struct_version(major, minor))
# The attributes:
#  - device_version: Vulkan version, as tuple, to use with
#                    VK_MAKE_VERSION(version_major, version_minor, version_patch)
#
#  - struct_version: Vulkan version, as tuple, to use with structures and macros
VERSIONS = [
    # VkPhysicalDeviceVulkan11Properties and VkPhysicalDeviceVulkan11Features is new from Vk 1.2, not Vk 1.1
    # https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#_new_structures
    Version((1, 2, 0), (1, 1)),
    Version((1, 2, 0), (1, 2)),
]

# There exists some inconsistencies regarding the enum constants, fix them.
# This is basically generated_code.replace(key, value).
REPLACEMENTS = {"ROBUSTNESS2": "ROBUSTNESS_2"}

# This template provides helper functions for the other templates.
# Right now, the following functions are defined:
# - guard(ext) : surrounds the body with an if-def guard according to
#                `ext.extension_name()` if `ext.guard` is True.
include_template = """
<%def name="guard_(ext, body)">
%if ext.guard:
#ifdef ${ext.extension_name()}