Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the new VK_KHR_ray_tracing extension #277

Closed
2 tasks
MaikKlein opened this issue Mar 17, 2020 · 7 comments · Fixed by #341
Closed
2 tasks

Add support for the new VK_KHR_ray_tracing extension #277

MaikKlein opened this issue Mar 17, 2020 · 7 comments · Fixed by #341

Comments

@MaikKlein
Copy link
Member

See https://www.khronos.org/blog/ray-tracing-in-vulkan

  • Generate vk.rs with the new xml
  • Expose a "high level" extension for VK_KHR_ray_tracing
    • I expect this to be a lot of work, a basic version would be good enough for now.
@msiglreith
Copy link
Contributor

Relevant PR for reference: #278

@cheako
Copy link

cheako commented Mar 24, 2020

SOLVED: .as_slice() works, sorry. So the docs are wrong it's not the same as &s[..].

cmd_build_acceleration_structure() Takes a slice of slice and it's kinda hard to build one of those! Unless I'm missing some rust foo.

The goal here is to take high level types and add them to the command buffer so they aren't dropped until after the command buffer.

    pub fn build_acceleration_structure(
        &self,
        src_acceleration_structure: Option<vk::AccelerationStructureKHR>,
        dst_acceleration_structure: vk::AccelerationStructureKHR,
        pp_geometries: *const *const vk::AccelerationStructureGeometryKHR,
        scratch_data: Buffer<T>,
        info: &[vk::AccelerationStructureBuildGeometryInfoKHR],
        offset_infos: &[&[Buffer<T>]],
    ) {
        let contents = self.contents.borrow_mut();
        let offset_infos: &[&[ash::vk::AccelerationStructureBuildOffsetInfoKHR]] = &offset_infos
            .iter()
            .map(|offset_infos| {
                &offset_infos
                    .iter()
                    .map(|buffer| {
                        contents.push(CommandBufferContents::Buffer(buffer.clone()));
                        vk::AccelerationStructureBuildOffsetInfoKHR::builder()
                    })
                    .collect::<Vec<_>>()[..]
            })
            .collect::<Vec<_>>()[..];
        unsafe {
            self.0
                .ray_tracing
                .cmd_build_acceleration_structure(***self, infos, &offset_infos);
        };
    }

@cheako
Copy link

cheako commented Mar 25, 2020

The type for pp_geometries is wrong... Can be either *[T] or *[*T].

@cheako
Copy link

cheako commented Mar 30, 2020

Example: It builds, but I don't have the hardware to run it.
Edit: https://gitlab.com/cheako/ash-rt/-/tree/faa9aebdc2d89729524654d8b5175b94648716ed

@dylanede
Copy link

Looks like VK_KHR_deferred_host_operations and VK_KHR_pipeline_library need to be added as well since they're dependencies of VK_KHR_ray_tracing, although one can use VK_KHR_ray_tracing without touching functions, structures and flags added by those extensions. Without them I get this message from the validation layer:

Validation Error: [ VUID-vkCreateDevice-ppEnabledExtensionNames-01387 ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x12537a2c | Missing extensions required by the device extension VK_KHR_ray_tracing: VK_KHR_deferred_host_operations, VK_KHR_pipeline_library. The Vulkan spec states: All required extensions for each extension in the VkDeviceCreateInfo::ppEnabledExtensionNames list must also be present in that list (https://vulkan.lunarg.com/doc/view/1.2.148.0/windows/1.2-extensions/vkspec.html#VUID-vkCreateDevice-ppEnabledExtensionNames-01387)

@cheako
Copy link

cheako commented Oct 11, 2020

Perhaps there should be a sticky issue just to track missing extensions... because there won't exactly be a whole lot of them at any one time.

@filnet
Copy link
Contributor

filnet commented Oct 11, 2020

I started working on adding support for the performance_query extension only to realize that my GPU did not support it.
Seems like almost no GPU supports this extension.

Edit: my comment is there in case the sticky issue gets created. performance_query should be added to the list of missing extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants