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
25 changes: 24 additions & 1 deletion .github/workflows/historical-registry-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [v1.4.363, v1.4.364]
version: [v1.4.363, v1.4.364, v1.4.368]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
Expand All @@ -61,6 +61,29 @@ jobs:
v fmt -w src/vulkan.v src/vulkan_video.v
v fmt -verify src/vulkan.v src/vulkan_video.v
git diff --check
- name: Check out module support files for the opaque-pointer ABI probe
if: matrix.version == 'v1.4.368'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: antono2/vulkan
path: abi-modules/antono2/vulkan
- name: Check out matching C headers
if: matrix.version == 'v1.4.368'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: KhronosGroup/Vulkan-Headers
ref: ${{ matrix.version }}
path: abi-headers
- name: Compile and run the generated opaque-pointer ABI probe
if: matrix.version == 'v1.4.368'
env:
VMODULES: ${{ github.workspace }}/abi-modules
V_C_ERROR_BUG_REPORT_DISABLED: '1'
run: |
set -euo pipefail
cp src/vulkan.v src/vulkan_video.v abi-modules/antono2/vulkan/
cp -R abi-headers/include/. abi-modules/antono2/vulkan/c/vendor/include/
v -cc gcc run test/opaque_basetype

windows-generator:
name: Windows generator setup
Expand Down
5 changes: 4 additions & 1 deletion src/vgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,10 @@ def genVType(self, typeinfo, name, alias):
elif v_value and v_text and category == 'basetype':
if not self.should_emit_external_basetype(v_value):
return
body = 'pub type ' + v_value + ' = C.' + v_value + '\n@[typedef]\npub struct C.' + v_value + ' {}'
# The V alias drops Vk, but the C typedef must keep its registry name.
# Opaque pointer basetypes such as VkInternalHandleNV are not C structs
# named InternalHandleNV.
body = 'pub type ' + v_value + ' = C.' + name + '\n@[typedef]\npub struct C.' + name + ' {}'
else:
if category == 'include' or category == 'define':
#NOTE: Since video structs are translated to V in vulkan_video.v,
Expand Down
9 changes: 9 additions & 0 deletions test/opaque_basetype/main.c.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Verify that the generated opaque alias resolves to the actual C pointer typedef.
module main

import antono2.vulkan as vk

fn main() {
assert sizeof(vk.InternalHandleNV) == sizeof(voidptr)
println('Opaque Vulkan internal handle has pointer-sized C ABI.')
}
Loading