From adb86504823663d5f71b7bd6652b875a15154569 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Fri, 26 May 2023 10:46:03 +0200 Subject: [PATCH] entry: Mark `Entry::from_parts_1_1()` as `unsafe` `Entry` is the only struct marking some Vulkan API calls as safe, as their soundness can be trivially upheld. This however relies on `vkGetInstanceProcAddr` returning a sound function pointer, which is not something we can guarantee when the user passes us function pointers via `Entry::from_parts_1_1()` instead: hence mark this new constructor as `unsafe` to uphold this contract. Related discussion chain: https://github.com/ash-rs/ash/pull/748#discussion_r1186794284 --- Changelog.md | 2 +- ash/src/entry.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 8ce05df1b..206cf1b10 100644 --- a/Changelog.md +++ b/Changelog.md @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `VK_EXT_shader_object` device extension (#732) - Added missing `Device::get_device_queue2()` wrapper (#736) - Exposed `FramebufferCreateInfo::attachment_count()` builder for `vk::FramebufferCreateFlags::IMAGELESS` (#747) -- Allow building `Entry`/`Instance`/`Device` from handle+fns (#748) +- Allow building `Entry`/`Instance`/`Device` from handle+fns (see their `from_parts_x_x()` associated functions) (#748) ### Changed diff --git a/ash/src/entry.rs b/ash/src/entry.rs index f3052e2c7..6f29833d2 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -155,7 +155,7 @@ impl Entry { } #[inline] - pub fn from_parts_1_1( + pub unsafe fn from_parts_1_1( static_fn: vk::StaticFn, entry_fn_1_0: vk::EntryFnV1_0, entry_fn_1_1: vk::EntryFnV1_1,