Skip to content
Merged
Show file tree
Hide file tree
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
36 changes: 35 additions & 1 deletion .github/workflows/historical-registry-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,38 @@ permissions:
contents: read

jobs:
registry-generator-compat:
name: Vulkan-Docs ${{ matrix.version }} generator interface
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
version: [v1.4.363, v1.4.364]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: KhronosGroup/Vulkan-Docs
ref: ${{ matrix.version }}
path: vulkandocs
- uses: prantlf/setup-v-action@92f20bea50d2c9931a28c96bb4997a3c7357baf0 # v4
with:
version: 0.5.2
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.x"
cache: pip
cache-dependency-path: .github/generator-requirements.txt
- run: python -m pip install --requirement .github/generator-requirements.txt
- name: Generate and format both bindings
run: |
set -euo pipefail
python src/main.py -registry vulkandocs/xml/vk.xml vulkan.v
python src/main.py -registry vulkandocs/xml/video.xml vulkan_video.v
v fmt -w src/vulkan.v src/vulkan_video.v
v fmt -verify src/vulkan.v src/vulkan_video.v
git diff --check

windows-generator:
name: Windows generator setup
runs-on: windows-2022
Expand Down Expand Up @@ -163,15 +195,17 @@ jobs:

required-checks:
if: always()
needs: [windows-generator, strict-v3-frontend, generate-and-compile]
needs: [registry-generator-compat, windows-generator, strict-v3-frontend, generate-and-compile]
runs-on: ubuntu-24.04
steps:
- name: Verify historical registry matrix
env:
REGISTRY_RESULT: ${{ needs.registry-generator-compat.result }}
WINDOWS_RESULT: ${{ needs.windows-generator.result }}
V3_RESULT: ${{ needs.strict-v3-frontend.result }}
MATRIX_RESULT: ${{ needs.generate-and-compile.result }}
run: |
test "$REGISTRY_RESULT" = success
test "$WINDOWS_RESULT" = success
test "$V3_RESULT" = success
test "$MATRIX_RESULT" = success
14 changes: 7 additions & 7 deletions src/vgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ def typeMayAlias(self, typeName):
if x is not None))
return typeName in self.may_alias

def genStruct(self, typeinfo, typeName, alias, keep_vk_member_name = False):
def genStruct(self, typeinfo, typeName, alias, protect=None, *, keep_vk_member_name=False):
"""Generate struct (e.g. C "struct" type).

This is a special case of the <type> tag where the contents are
Expand All @@ -887,7 +887,7 @@ def genStruct(self, typeinfo, typeName, alias, keep_vk_member_name = False):
typeName, alias = self.v_translate_c_name_to_basetype(typeName, alias)
body = 'pub type ' + typeName + ' = ' + alias + '\n'
else:
(protect_begin, protect_end) = self.genProtectString(typeElem.get('protect'))
(protect_begin, protect_end) = self.genProtectString(typeElem.get('protect') or protect)
if protect_begin:
body += protect_begin

Expand Down Expand Up @@ -930,7 +930,7 @@ def genStruct(self, typeinfo, typeName, alias, keep_vk_member_name = False):

self.appendSection('struct', body)

def genGroup(self, groupinfo, groupName, alias=None):
def genGroup(self, groupinfo, groupName, alias=None, protect=None):
"""Generate groups (e.g. C "enum" type).

These are concatenated together with other types.
Expand Down Expand Up @@ -962,7 +962,7 @@ def genGroup(self, groupinfo, groupName, alias=None):
(section, body) = self.buildEnumVDecl(self.genOpts.genEnumBeginEndRange, groupinfo, groupName, keep_vk_member_name=False)
self.appendSection(section, '\n' + body)

def genEnum(self, enuminfo, name, alias):
def genEnum(self, enuminfo, name, alias, protect=None):
"""Generate the C declaration for a constant (a single <enum> value).

<enum> tags may specify their values in several ways, but are usually
Expand Down Expand Up @@ -1159,7 +1159,7 @@ def build_legacy_funcpointer_type_decl(self, typeElem, name):
body += f' {return_type}'
return ('struct', body + '\n')

def genCmd(self, cmdinfo, name, alias):
def genCmd(self, cmdinfo, name, alias, protect=None):
"Command generation"
OutputGenerator.genCmd(self, cmdinfo, name, alias)

Expand Down Expand Up @@ -2076,7 +2076,7 @@ def makeVDecls(self, cmd):
return ['@[keep_args_alive]\nfn C.' + v_name_original + c_func_def_params + ' ' + v_type + '\n' + v_wrapper, tdecl]

# NOTE Anton: the oiginal method comes from vulkandocs/scripts/generator.py
def genType(self, typeinfo, name, alias):
def genType(self, typeinfo, name, alias, protect=None):
"""Generate interface for a type

- typeinfo - TypeInfo for a type
Expand Down Expand Up @@ -2114,7 +2114,7 @@ def genType(self, typeinfo, name, alias):
# They must not flow through the generic genCType/genVType path,
# otherwise they get emitted twice and V reports duplicate aliases.
if category in ('struct', 'union'):
self.genStruct(typeinfo, name, alias, keep_vk_member_name=True)
self.genStruct(typeinfo, name, alias, protect, keep_vk_member_name=True)
return

body = ''
Expand Down
Loading