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
41 changes: 24 additions & 17 deletions .github/workflows/generated-bindings-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
if: matrix.v-channel == 'stable' || steps.setup_v_source.outcome == 'success'
shell: bash
run: bash .github/scripts/setup-vulkan-ci.sh 1.4.309.0 v1.2
- name: Install registry-matched headers and pinned Volk
- name: Verify bundled headers and Volk against pinned upstream sources
if: matrix.v-channel == 'stable' || steps.setup_v_source.outcome == 'success'
shell: bash
run: |
Expand All @@ -163,29 +163,33 @@ jobs:
git -C "$registry_checkout" fetch --depth 1 origin "$registry_commit"
git -C "$registry_checkout" checkout --detach FETCH_HEAD
test "$(git -C "$registry_checkout" rev-parse HEAD)" = "$registry_commit"
mkdir -p "$VULKAN_SDK/include" "$VULKAN_SDK/include/volk"
cp -R "$registry_checkout/include/." "$VULKAN_SDK/include/"
while IFS= read -r -d '' header; do
cmp "$header" "c/vendor/include/${header#"$registry_checkout/include/"}"
done < <(find "$registry_checkout/include/vulkan" "$registry_checkout/include/vk_video" -name '*.h' -print0)
registry_version=$(tr -d '\r\n' < VERSION)
[[ "$registry_version" =~ ^v[0-9]+\.[0-9]+\.([0-9]+)$ ]] || {
echo "Invalid Vulkan registry version: $registry_version" >&2
exit 1
}
header_version=${BASH_REMATCH[1]}
grep -F "#define VK_HEADER_VERSION $header_version" \
"$VULKAN_SDK/include/vulkan/vulkan_core.h"
"c/vendor/include/vulkan/vulkan_core.h"

volk_commit=$(tr -d '\r\n' < VOLK_COMMIT)
curl --fail --silent --show-error --location \
"https://raw.githubusercontent.com/zeux/volk/$volk_commit/volk.h" \
--output "$VULKAN_SDK/include/volk/volk.h"
--output "$RUNNER_TEMP/pinned-volk.h"
curl --fail --silent --show-error --location \
"https://raw.githubusercontent.com/zeux/volk/$volk_commit/volk.c" \
--output "$VULKAN_SDK/include/volk/volk.c"
--output "$RUNNER_TEMP/pinned-volk.c"
# Git for Windows can check out tracked text with CRLF line endings.
cmp <(sed 's/\r$//' "$RUNNER_TEMP/pinned-volk.h") <(sed 's/\r$//' c/vendor/volk/volk.h)
cmp <(sed 's/\r$//' "$RUNNER_TEMP/pinned-volk.c") <(sed 's/\r$//' c/vendor/volk/volk.c)
- name: Verify the public setup diagnostics
if: matrix.v-channel == 'stable' || steps.setup_v_source.outcome == 'success'
shell: bash
run: v run setup.vsh --check
- name: Reject old headers in setup diagnostics
- name: Accept old installed headers with bundled build inputs
if: runner.os == 'Linux' && matrix.v-channel == 'stable'
shell: bash
run: |
Expand All @@ -197,13 +201,9 @@ jobs:
#define VK_HEADER_VERSION 275
#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION)
EOF
if VULKAN_SDK="$old_sdk" v run setup.vsh --check > "$RUNNER_TEMP/old-header-check.log" 2>&1; then
cat "$RUNNER_TEMP/old-header-check.log"
echo "setup check accepted outdated Vulkan headers" >&2
exit 1
fi
required_version=$(tr -d '\r\n' < VERSION)
grep -F "[outdated] Vulkan headers 1.3.275; bindings use registry ${required_version#v}" \
VULKAN_SDK="$old_sdk" v run setup.vsh --check > "$RUNNER_TEMP/old-header-check.log"
cat "$RUNNER_TEMP/old-header-check.log"
grep -F '[ok] Bundled Vulkan headers 1.4.363 cover registry 1.4.363' \
"$RUNNER_TEMP/old-header-check.log"
- name: Assemble isolated module
if: matrix.v-channel == 'stable' || steps.setup_v_source.outcome == 'success'
Expand All @@ -214,6 +214,7 @@ jobs:
mkdir -p "$module_root/c" "$module_root/ergonomic"
cp vulkan.v vulkan_video.v loader.v v.mod VERSION REGISTRY_COMMIT VOLK_COMMIT "$module_root/"
cp c/loader_bridge.h c/volk.c.v c/volk_impl.h "$module_root/c/"
cp -R c/vendor "$module_root/c/"
cp ergonomic/ergonomic.v ergonomic/allocator.v ergonomic/discovery.v ergonomic/configuration.v \
ergonomic/presentation.v ergonomic/resources.v \
"$module_root/ergonomic/"
Expand All @@ -226,14 +227,19 @@ jobs:
v \
-new-compiler \
-check \
-cflags "-I$VMODULES/antono2/vulkan -I$VULKAN_SDK/include -I$VULKAN_SDK/include/volk" \
-cflags "-I$VMODULES/antono2/vulkan/c/vendor/include -I$VMODULES/antono2/vulkan/c/vendor/volk -I$VMODULES/antono2/vulkan -I$VULKAN_SDK/include" \
generator/test/main.c.v
v \
-new-compiler \
-d vulkan_xlib \
-check \
-cflags "-I$VMODULES/antono2/vulkan -I$VULKAN_SDK/include -I$VULKAN_SDK/include/volk" \
-cflags "-I$VMODULES/antono2/vulkan/c/vendor/include -I$VMODULES/antono2/vulkan/c/vendor/volk -I$VMODULES/antono2/vulkan -I$VULKAN_SDK/include" \
generator/test/main.c.v
v \
-new-compiler \
-check \
-cflags "-I$VMODULES/antono2/vulkan/c/vendor/include -I$VMODULES/antono2/vulkan/c/vendor/volk -I$VMODULES/antono2/vulkan -I$VULKAN_SDK/include" \
ci/bundled_header_smoke
- name: Compile smoke test and ergonomic unit tests
id: compile
if: matrix.v-channel == 'stable' || steps.setup_v_source.outcome == 'success'
Expand All @@ -248,14 +254,15 @@ jobs:
v_flags=(
-new-compiler
"${v_flags[@]}"
-cflags "-I$VMODULES/antono2/vulkan -I$VULKAN_SDK/include -I$VULKAN_SDK/include/volk"
-cflags "-I$VMODULES/antono2/vulkan/c/vendor/include -I$VMODULES/antono2/vulkan/c/vendor/volk -I$VMODULES/antono2/vulkan -I$VULKAN_SDK/include"
)
fi
if [[ "${{ runner.os }}" == macOS ]]; then
v "${v_flags[@]}" -o "$RUNNER_TEMP/vulkan-smoke" generator/test
else
v "${v_flags[@]}" run generator/test
fi
v "${v_flags[@]}" -o "$RUNNER_TEMP/bundled-header-smoke" ci/bundled_header_smoke
v "${v_flags[@]}" test ergonomic
if [[ "${{ runner.os }}" == Linux && "${{ matrix.v-channel }}" == stable ]]; then
v -d vulkan_xlib -cc "${{ matrix.compiler }}" \
Expand Down
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,37 @@
[Vulkan API registry](https://github.com/KhronosGroup/Vulkan-Docs/blob/main/xml/vk.xml).
The package follows the semantic version in `v.mod`; `VERSION` records the
Vulkan registry snapshot, while `REGISTRY_COMMIT` and `VOLK_COMMIT` make the
CI header and loader inputs reproducible.
bundled header and loader inputs reproducible.

## One-command setup

Install the native Vulkan development prerequisites and this V module:
Install native Vulkan tools and this V module:

```sh
v run ~/.vmodules/antono2/vulkan/setup.vsh
```

From a source checkout, use `v run setup.vsh`. The script supports Ubuntu and
Debian, Fedora, Arch, openSUSE, macOS, and Windows with winget.
It installs headers, the Vulkan loader, Volk, diagnostic tools, and the VPM
module, then verifies the result. For a read-only support check, run:
It installs native Vulkan tools and the VPM module, then verifies the result.
For a read-only support check, run:

```sh
v run setup.vsh --check
```

`v install antono2.vulkan` downloads the V module without checking local Vulkan
headers. Older headers can build applications that use declarations they already
contain, but code using newer generated types or commands needs newer native
headers and a compatible Volk. `setup.vsh --check` compares the installed
`vulkan_core.h` version with this release's `VERSION` and reports older headers
as incomplete for the full binding. A distribution's Vulkan development
packages may be older than this release; in that case install a recent Vulkan
SDK or registry-matched headers and Volk, set `VULKAN_SDK` to that SDK, and rerun
the check. The check finds Volk but does not verify every Volk entry point;
the CI workflow pins the exact header and Volk sources used to test the release.
`v install antono2.vulkan` includes the matching Khronos Vulkan C headers and
Volk sources. The package compiles against these bundled files, even when the
system has older Vulkan development headers or none installed. `VULKAN_SDK` is
not needed to compile the module. `setup.vsh --check` verifies the bundled
header version against `VERSION` and checks that Volk is present. The native
Vulkan loader and a driver or software implementation are still needed to run
Vulkan applications.

The SDK and loader cannot supply a hardware Vulkan implementation. If
`vulkaninfo` cannot enumerate a device after setup, install or update the GPU
vendor's driver. CI uses registry-matched headers and the pinned Volk revision
recorded by this repository rather than this convenience installer.
vendor's driver. CI verifies the bundled headers and Volk against the pinned
upstream revisions recorded by this repository.

## Supported toolchains

Expand Down Expand Up @@ -100,7 +97,8 @@ v -d vulkan_xlib run your_app.v

For XCB or Wayland, use `vulkan_xcb` or `vulkan_wayland` instead. Other flags
follow the registry platform names, such as `vulkan_win32`, `vulkan_android`,
and `vulkan_metal`. Install the native headers for the selected platform.
and `vulkan_metal`. Applications and windowing libraries may need native
window-system headers for the selected platform (for example Xlib or Wayland).
Extension name and spec-version constants are available without these flags,
so applications can still query extension support before selecting a backend.

Expand Down
Loading
Loading