Skip to content

vk: Use driver API version for instance creation#342

Merged
kvark merged 2 commits into
kvark:mainfrom
hellno:fix-vulkan-instance-api-version
Apr 17, 2026
Merged

vk: Use driver API version for instance creation#342
kvark merged 2 commits into
kvark:mainfrom
hellno:fix-vulkan-instance-api-version

Conversation

@hellno

@hellno hellno commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Use the version reported by vkEnumerateInstanceVersion instead of vk::HEADER_VERSION_COMPLETE when creating the Vulkan instance.

On systems where the driver only supports Vulkan 1.1 or 1.2 (e.g. lavapipe on RHEL 8), requesting the ash header version (1.3.x) causes ERROR_INCOMPATIBLE_DRIVER. The spec says conformant 1.1+ implementations must not return this error, but older Mesa builds do.

driver_api_version is already queried via try_enumerate_instance_version() and used for extension promotion checks in the same function. This matches what wgpu-hal does for instance creation.

Fixes #341

Use the version reported by vkEnumerateInstanceVersion instead of
vk::HEADER_VERSION_COMPLETE when creating the Vulkan instance.

On systems where the driver only supports Vulkan 1.1 or 1.2 (e.g.
lavapipe on RHEL 8), requesting the ash header version (1.3.x)
causes ERROR_INCOMPATIBLE_DRIVER. driver_api_version is already
queried and used for extension promotion checks in the same function.

Fixes kvark#341

@kvark kvark left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Comment thread blade-graphics/src/vulkan/init.rs Outdated
.engine_name(c"blade")
.engine_version(1)
.api_version(vk::HEADER_VERSION_COMPLETE);
.api_version(driver_api_version);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should take minimum of ours and theirs, not just theirs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, changed it!

Take the minimum of driver_api_version and vk::HEADER_VERSION_COMPLETE
so we never request a version newer than our ash headers support,
while still capping at the driver version on older systems.
@hellno

hellno commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

changed it to use the min version between the two

@kvark
kvark enabled auto-merge (squash) April 17, 2026 15:06
@kvark

kvark commented Apr 17, 2026

Copy link
Copy Markdown
Owner

Ah, I should have included this in 0.8.3. release

@kvark
kvark merged commit 2c3e2bc into kvark:main Apr 17, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vk: Instance creation requests header API version instead of driver API version

2 participants