Make api version optional

This commit is contained in:
hodasemi 2023-02-22 09:35:42 +01:00
parent c09268bee7
commit 0993d57f8e
2 changed files with 4 additions and 4 deletions

View file

@ -120,7 +120,7 @@ impl Instance {
instance: VkInstance,
proc_addr: PFN_vkGetInstanceProcAddr,
extensions: &[VkString],
api_version: u32,
api_version: Option<u32>,
) -> Result<Arc<Instance>> {
log("Instance::preinitialized: start");
@ -168,7 +168,7 @@ impl Instance {
debug_report: None,
api_version,
api_version: api_version.unwrap_or(VK_MAKE_VERSION(1, 0, 0)),
});
Ok(instance)

View file

@ -12,11 +12,11 @@ pub mod types;
pub mod functions;
pub fn VK_MAKE_VERSION(major: u32, minor: u32, patch: u32) -> u32 {
pub const fn VK_MAKE_VERSION(major: u32, minor: u32, patch: u32) -> u32 {
(major as u32) << 22 | (minor as u32) << 12 | (patch as u32)
}
pub fn VK_GET_VERSION(version: u32) -> (u32, u32, u32) {
pub const fn VK_GET_VERSION(version: u32) -> (u32, u32, u32) {
let major = version >> 22;
let minor = (version >> 12) & 0x03FF;
let patch = version & 0x00CF;