mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
Include raw function pointer structs in documentation (#1831)
This commit is contained in:
parent
662c93af33
commit
7f14f6ff7a
@ -15,14 +15,20 @@ use quote::{format_ident, quote};
|
||||
use vk_parse::{Extension, ExtensionChild, InterfaceItem};
|
||||
|
||||
pub fn write(vk_data: &VkRegistryData) {
|
||||
let entry_fns_output = fns_output(&[], "Entry");
|
||||
let entry_fns_output = fns_output(
|
||||
&[],
|
||||
"Entry",
|
||||
"Raw Vulkan global entry point-level functions.\n\nTo use these, you need to include the Ash crate, using the same version Vulkano uses.",
|
||||
);
|
||||
let instance_fns_output = fns_output(
|
||||
&extension_fns_members("instance", &vk_data.extensions),
|
||||
"Instance",
|
||||
"Raw Vulkan instance-level functions.\n\nTo use these, you need to include the Ash crate, using the same version Vulkano uses.",
|
||||
);
|
||||
let device_fns_output = fns_output(
|
||||
&extension_fns_members("device", &vk_data.extensions),
|
||||
"Device",
|
||||
"Raw Vulkan device-level functions.\n\nTo use these, you need to include the Ash crate, using the same version Vulkano uses.",
|
||||
);
|
||||
write_file(
|
||||
"fns.rs",
|
||||
@ -41,7 +47,7 @@ struct FnsMember {
|
||||
fn_struct: Ident,
|
||||
}
|
||||
|
||||
fn fns_output(extension_members: &[FnsMember], fns_level: &str) -> TokenStream {
|
||||
fn fns_output(extension_members: &[FnsMember], fns_level: &str, doc: &str) -> TokenStream {
|
||||
let struct_name = format_ident!("{}Functions", fns_level);
|
||||
let members = ["1_0", "1_1", "1_2"]
|
||||
.into_iter()
|
||||
@ -61,13 +67,15 @@ fn fns_output(extension_members: &[FnsMember], fns_level: &str) -> TokenStream {
|
||||
});
|
||||
|
||||
quote! {
|
||||
#[doc = #doc]
|
||||
#[allow(missing_docs)]
|
||||
pub struct #struct_name {
|
||||
#(#struct_items)*
|
||||
pub _ne: crate::NonExhaustive,
|
||||
}
|
||||
|
||||
impl #struct_name {
|
||||
pub fn load<F>(mut load_fn: F) -> #struct_name
|
||||
pub(crate) fn load<F>(mut load_fn: F) -> #struct_name
|
||||
where F: FnMut(&CStr) -> *const c_void
|
||||
{
|
||||
#struct_name {
|
||||
|
@ -108,7 +108,7 @@ use crate::device::physical::QueueFamily;
|
||||
pub use crate::extensions::{
|
||||
ExtensionRestriction, ExtensionRestrictionError, SupportedExtensionsError,
|
||||
};
|
||||
use crate::fns::DeviceFunctions;
|
||||
pub use crate::fns::DeviceFunctions;
|
||||
use crate::instance::Instance;
|
||||
use crate::memory::pool::StdMemoryPool;
|
||||
use crate::Error;
|
||||
|
@ -22,7 +22,7 @@
|
||||
//! a Vulkan implementation from the system.
|
||||
|
||||
use crate::check_errors;
|
||||
use crate::fns::EntryFunctions;
|
||||
pub use crate::fns::EntryFunctions;
|
||||
use crate::OomError;
|
||||
use crate::SafeDeref;
|
||||
use crate::Version;
|
||||
|
@ -61,7 +61,7 @@ use crate::device::physical::{init_physical_devices, PhysicalDeviceInfo};
|
||||
pub use crate::extensions::{
|
||||
ExtensionRestriction, ExtensionRestrictionError, SupportedExtensionsError,
|
||||
};
|
||||
use crate::fns::InstanceFunctions;
|
||||
pub use crate::fns::InstanceFunctions;
|
||||
use crate::instance::loader::FunctionPointers;
|
||||
use crate::instance::loader::Loader;
|
||||
pub use crate::version::Version;
|
||||
|
Loading…
Reference in New Issue
Block a user