Skip to content

Commit

Permalink
Add high level wrapper for currently-empty RayQuery extension
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Nov 24, 2020
1 parent 8ab32a1 commit 6bf3119
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ash/src/extensions/khr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub use self::draw_indirect_count::DrawIndirectCount;
pub use self::external_memory_fd::ExternalMemoryFd;
pub use self::pipeline_executable_properties::PipelineExecutableProperties;
pub use self::push_descriptor::PushDescriptor;
pub use self::ray_query::RayQuery;
pub use self::ray_tracing_pipeline::RayTracingPipeline;
pub use self::surface::Surface;
pub use self::swapchain::Swapchain;
Expand All @@ -23,6 +24,7 @@ mod draw_indirect_count;
mod external_memory_fd;
mod pipeline_executable_properties;
mod push_descriptor;
mod ray_query;
mod ray_tracing_pipeline;
mod surface;
mod swapchain;
Expand Down
35 changes: 35 additions & 0 deletions ash/src/extensions/khr/ray_query.rs
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
}
}

0 comments on commit 6bf3119

Please sign in to comment.