Skip to content

Glad2 Vulkan: Fails on assert during Vulkan specification parsing #526

@TheMagehawk

Description

@TheMagehawk

API: Vulkan (any version)
Build System Generator: CMake

Since a recent Vulkan specification update, fetching the Vulkan headers fails to complete for any Vulkan version because of an assertion error in the specification parser.

To reproduce:

glad_add_library(glad STATIC EXCLUDE_FROM_ALL API gl:core=4.6 vulkan=1.4)

Note: The error is not triggered by gl:core=4.6 or gles2:core=3.2, so none of the OpenGL specifications are affected by this.

Error message:

AssertionError: assert best_match is not None

In glad/parse.py on line 581:

# this should never happen and indicates broken XML!?
assert best_match is not None

Getting rid of the assert leaves you with a lot of undefined vulkan types.

I have bisected the Vulkan specification and it turns out that it started breaking with this commit: KhronosGroup/Vulkan-Docs@ac874e1
What I have noticed is that they have added a new Vulkan base specification, but I haven't looked into the details yet.

Temporary workaround:

Manually applying an older commit (KhronosGroup/Vulkan-Docs@ac3d066) for the xml in glad/specification.py on line 56, fixes the issue:

class VK(Specification):
    DISPLAY_NAME = 'Vulkan'

    API = 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/ac3d0660c45ecf86b2952b298d125270228150d1/xml/'
    NAME = 'vk'

    def _magic_require(self, api, profile):
        # magic_categories = (
        #     'define', 'basetype', 'handle'
        # )
        #
        # requirements = [name for name, types in self.types.items()
        #                 if any(t.api in (None, api) and t.category in magic_categories for t in types)]
        #
        # return Require(api, profile, requirements)
        return None

    def _magic_are_enums_blacklisted(self, enums_element):
        # blacklist everything that has a type
        return enums_element.get('type') in ('enum', 'bitmask')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions