File: specification.py

package info (click to toggle)
python-glad 2.0.2-0.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 6,360 kB
  • sloc: xml: 76,627; ansic: 5,843; python: 2,413; sh: 423; cpp: 248; makefile: 4
file content (72 lines) | stat: -rw-r--r-- 2,139 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from glad.parse import Specification, Require


class EGL(Specification):
    DISPLAY_NAME = 'EGL'

    API = 'https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/main/api/'
    NAME = 'egl'

    def protections(self, symbol, api=None, profile=None, feature_set=None):
        return list()


class GL(Specification):
    DISPLAY_NAME = 'OpenGL'

    API = 'https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/'
    NAME = 'gl'

    def _magic_require(self, api, profile):
        require = Specification._magic_require(self, api, profile)

        magic_blacklist = (
            'stddef', 'khrplatform', 'inttypes',  # gl.xml
        )
        requirements = [r for r in require.requirements if r not in magic_blacklist]
        return Require(api, profile, requirements)

    def protections(self, symbol, api=None, profile=None, feature_set=None):
        return list()


class GLX(Specification):
    DISPLAY_NAME = 'GLX'

    API = 'https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/'
    NAME = 'glx'

    def protections(self, symbol, api=None, profile=None, feature_set=None):
        return list()


class WGL(Specification):
    DISPLAY_NAME = 'WGL'

    API = 'https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/'
    NAME = 'wgl'

    def protections(self, symbol, api=None, profile=None, feature_set=None):
        return list()


class VK(Specification):
    DISPLAY_NAME = 'Vulkan'

    API = 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/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')