-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add high level wrapper for currently-empty RayQuery extension
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#![allow(dead_code)] | ||
use crate::version::{DeviceV1_0, InstanceV1_0}; | ||
use crate::vk; | ||
use std::ffi::CStr; | ||
use std::mem; | ||
|
||
#[derive(Clone)] | ||
pub struct RayQuery { | ||
handle: vk::Device, | ||
ray_query_fn: vk::KhrRayQueryFn, | ||
} | ||
|
||
impl RayQuery { | ||
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self { | ||
let ray_query_fn = vk::KhrRayQueryFn::load(|name| unsafe { | ||
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) | ||
}); | ||
Self { | ||
handle: device.handle(), | ||
ray_query_fn, | ||
} | ||
} | ||
|
||
pub fn name() -> &'static CStr { | ||
vk::KhrRayQueryFn::name() | ||
} | ||
|
||
pub fn fp(&self) -> &vk::KhrRayQueryFn { | ||
&self.ray_query_fn | ||
} | ||
|
||
pub fn device(&self) -> vk::Device { | ||
self.handle | ||
} | ||
} |