Skip to content

Commit 143b048

Browse files
FIXUP: rework docs a bit
1 parent 12ff945 commit 143b048

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

wgpu-hal/src/vulkan/instance.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ use arrayvec::ArrayVec;
1111
use ash::{ext, khr, vk};
1212
use parking_lot::RwLock;
1313

14-
/// Name of the `VK_OHOS_surface` extension.
15-
///
16-
/// `ash` does not generate OpenHarmony bindings, so this mirrors
17-
/// `VK_OHOS_SURFACE_EXTENSION_NAME` from the OpenHarmony SDK's `vulkan_ohos.h`.
14+
/// Name of the `VK_OHOS_surface` extension. Used with [`create_surface_ohos`].
1815
#[cfg(target_env = "ohos")]
1916
const OHOS_SURFACE_EXTENSION_NAME: &CStr = c"VK_OHOS_surface";
2017

@@ -587,28 +584,36 @@ impl super::Instance {
587584
Ok(self.create_surface_from_vk_surface_khr(surface, None))
588585
}
589586

590-
/// OpenHarmony window-system integration.
587+
/// OpenHarmony window-system integration, using the `VK_OHOS_surface` extension.
588+
///
589+
/// `ash` has no bindings for this, so we create bindings ad-hoc as needed. See also:
591590
///
592-
/// `ash` has no `VK_OHOS_surface` bindings, so the `vkCreateSurfaceOHOS` entry point is
593-
/// resolved manually and `VkSurfaceCreateInfoOHOS` is declared here, matching the
594-
/// OpenHarmony SDK's `vulkan_ohos.h` (`VK_STRUCTURE_TYPE_SURFACE_CREATE_INFO_OHOS`
595-
/// is 1000685000).
591+
/// - <https://docs.vulkan.org/refpages/latest/refpages/source/VK_OHOS_surface.html>
592+
/// - [`vulkan_ohos.h`](https://github.com/KhronosGroup/Vulkan-Headers/blob/e3b1eec08173d6b825cd3ac88c885a63b621504a/include/vulkan/vulkan_ohos.h)
596593
///
597594
/// `window` is the `OHNativeWindow*` handed out by an XComponent.
598595
#[cfg(target_env = "ohos")]
599596
fn create_surface_ohos(
600597
&self,
601598
window: *mut c_void,
602599
) -> Result<super::Surface, crate::InstanceError> {
600+
// - Upstream docs:
601+
// <https://docs.vulkan.org/refpages/latest/refpages/source/VkSurfaceCreateInfoOHOS.html>
603602
#[repr(C)]
604603
struct VkSurfaceCreateInfoOHOS {
605604
s_type: vk::StructureType,
606605
p_next: *const c_void,
607606
flags: vk::Flags,
608607
window: *mut c_void,
609608
}
609+
610+
// - Upstream docs: Search for term `VK_STRUCTURE_TYPE_SURFACE_CREATE_INFO_OHOS` in
611+
// <https://docs.vulkan.org/refpages/latest/refpages/source/VkStructureType.html>.
610612
const S_TYPE_SURFACE_CREATE_INFO_OHOS: vk::StructureType =
611613
vk::StructureType::from_raw(1000685000);
614+
615+
// - Upstream docs:
616+
// <https://docs.vulkan.org/refpages/latest/refpages/source/vkCreateSurfaceOHOS.html>
612617
type PfnCreateSurfaceOHOS = unsafe extern "system" fn(
613618
vk::Instance,
614619
*const VkSurfaceCreateInfoOHOS,

0 commit comments

Comments
 (0)