Added helper on RayTracing to query physical device ray tracing properties info (such as shader group handle size)
This commit is contained in:
parent
011e9e611f
commit
0ed0a06634
|
@ -2,7 +2,7 @@
|
|||
use prelude::*;
|
||||
use std::ffi::CStr;
|
||||
use std::mem;
|
||||
use version::{DeviceV1_0, InstanceV1_0};
|
||||
use version::{DeviceV1_1, InstanceV1_1};
|
||||
use vk;
|
||||
use RawPtr;
|
||||
|
||||
|
@ -13,7 +13,7 @@ pub struct RayTracing {
|
|||
}
|
||||
|
||||
impl RayTracing {
|
||||
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> RayTracing {
|
||||
pub fn new<I: InstanceV1_1, D: DeviceV1_1>(instance: &I, device: &D) -> RayTracing {
|
||||
let ray_tracing_fn = vk::NvRayTracingFn::load(|name| unsafe {
|
||||
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
|
||||
});
|
||||
|
@ -23,6 +23,19 @@ impl RayTracing {
|
|||
}
|
||||
}
|
||||
|
||||
pub unsafe fn get_properties<I: InstanceV1_1>(
|
||||
instance: &I,
|
||||
pdevice: vk::PhysicalDevice,
|
||||
) -> vk::PhysicalDeviceRayTracingPropertiesNV {
|
||||
let mut props_rt = vk::PhysicalDeviceRayTracingPropertiesNV::default();
|
||||
let mut props = vk::PhysicalDeviceProperties2::builder()
|
||||
.next(&mut props_rt)
|
||||
.build();
|
||||
|
||||
instance.get_physical_device_properties2(pdevice, &mut props);
|
||||
props_rt
|
||||
}
|
||||
|
||||
pub unsafe fn create_acceleration_structure(
|
||||
&self,
|
||||
create_info: &vk::AccelerationStructureCreateInfoNV,
|
||||
|
@ -59,7 +72,11 @@ impl RayTracing {
|
|||
) -> vk::MemoryRequirements2KHR {
|
||||
let mut requirements = mem::uninitialized();
|
||||
self.ray_tracing_fn
|
||||
.get_acceleration_structure_memory_requirements_nv(self.handle, info, &mut requirements);
|
||||
.get_acceleration_structure_memory_requirements_nv(
|
||||
self.handle,
|
||||
info,
|
||||
&mut requirements,
|
||||
);
|
||||
requirements
|
||||
}
|
||||
|
||||
|
@ -230,11 +247,7 @@ impl RayTracing {
|
|||
);
|
||||
}
|
||||
|
||||
pub unsafe fn compile_deferred(
|
||||
&self,
|
||||
pipeline: vk::Pipeline,
|
||||
shader: u32,
|
||||
) -> VkResult<()> {
|
||||
pub unsafe fn compile_deferred(&self, pipeline: vk::Pipeline, shader: u32) -> VkResult<()> {
|
||||
let err_code = self
|
||||
.ray_tracing_fn
|
||||
.compile_deferred_nv(self.handle, pipeline, shader);
|
||||
|
|
Loading…
Reference in a new issue