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

Support for VK_KHR_ray_tracing_pipeline #2455

Open
Ivan-Kudryavtsev opened this issue Jan 19, 2024 · 11 comments
Open

Support for VK_KHR_ray_tracing_pipeline #2455

Ivan-Kudryavtsev opened this issue Jan 19, 2024 · 11 comments

Comments

@Ivan-Kudryavtsev
Copy link

I'm interested in contributing towards adding support for VK_KHR_ray_tracing_pipeline, but I don't 100% understand what would be required to make this happen.

VK_KHR_acceleration_structure is already supported, and it's obvious that a RayTracingPipeline struct would be required.
Would anyone be able to advise what other work would need to be done for pipelined ray-tracing support?

Many thanks!

@Rua
Copy link
Contributor

Rua commented Jan 19, 2024

This is something I've been thinking about as well. My current plan is to split this into two separate PRs, each of which implements a subset of the features. First, implement the RayTracingPipeline type and its vkGetRayTracing* methods. Then, in the next PR, implement all the command buffer commands.

Of course, the ray tracing pipeline object is useless without any commands to use it. Splitting the PRs is only to make the problem a bit more manageable, so that the additions are more self-contained and easier to check and test. Divide and conquer, in other words. It also means that the whole thing doesn't have to be added by one person, the work can be divided too.

@Ivan-Kudryavtsev
Copy link
Author

That sounds very sensible to me.

To clarify - the vkGetRayTracing* methods are these?

  • vkGetRayTracingShaderGroupStackSizeKHR
  • vkGetRayTracingShaderGroupHandlesKHR
  • vkGetRayTracingCaptureReplayShaderGroupHandlesKHR

I've done a bit more digging - I'm not clear on if the AccelerationStructure is suitable for use at the moment - indeed, in coverage it says "Host acceleration structure operations" are not supported but I'm not clear on what that means precisely.

The shader binding table-related items are also a bit esoteric but I think I should be able to get to work on this soon.

@Ivan-Kudryavtsev
Copy link
Author

I'm also noticing that the Ash PipelineBindPoint enum does not contain RAY_TRACING_KHR - is this likely to be a problem?

@Rua
Copy link
Contributor

Rua commented Jan 23, 2024

To clarify - the vkGetRayTracing* methods are these?

* `vkGetRayTracingShaderGroupStackSizeKHR`

* `vkGetRayTracingShaderGroupHandlesKHR`

* `vkGetRayTracingCaptureReplayShaderGroupHandlesKHR`

Yes.

indeed, in coverage it says "Host acceleration structure operations" are not supported but I'm not clear on what that means precisely.

The acceleration structure operations come in two forms: the vkCmd* prefixed ones, which are recorded onto command buffers and then executed on the device, and the vk* prefixed ones, which are executed by the host rather than device. The latter kind is not very well supported by Vulkan drivers, so they were skipped for the moment.

I'm also noticing that the Ash PipelineBindPoint enum does not contain RAY_TRACING_KHR - is this likely to be a problem?

It's listed in the Ash documentation: https://docs.rs/ash/latest/ash/vk/struct.PipelineBindPoint.html. Where were you looking for it?

@Ivan-Kudryavtsev
Copy link
Author

Ah thank you, that's my mistake. I was looking in the enums where the graphics and compute enums are defined - slipped my mind it's an extension.

@Ivan-Kudryavtsev
Copy link
Author

Ivan-Kudryavtsev commented Feb 3, 2024

EDIT: I've just realised it's device features which are distinct from device extensions!

I'm testing creating a pipeline and I've run into a bit of a roadblock with shader compilation:
trying to load a shader module with GL_EXT_ray_tracing : enable is panicking:

called `Result::unwrap()` on an `Err` value: a validation error occurred

Caused by:
    create_info.code: uses the SPIR-V capability `RayTracingKHR`

Requires one of:
    feature `ray_tracing_pipeline`

Vulkan VUIDs:
    VUID-VkShaderModuleCreateInfo-pCode-08742

I'm having some trouble tracking down what kind of "feature" is meant here - khr_ray_tracing_pipeline is enabled on the device. I assume it relates to SPIR-V in some way but I've not been able to track it down.

@Rua
Copy link
Contributor

Rua commented Feb 3, 2024

You're not the first person to be confused about "features", so I'm wondering if naming them "device features" here would help make it clear.

@Ivan-Kudryavtsev
Copy link
Author

That seems like a good idea to me.

@Rua
Copy link
Contributor

Rua commented Feb 3, 2024

Yep, someone else just came to the Vulkano discord confused about the same thing! Clearly a rename is in order, haha

@spapinistarkware
Copy link

What's the status on this? Can I help?

@Ivan-Kudryavtsev
Copy link
Author

I have a working fork, but it's not feature complete. I'll get it on the main repo soon.

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

No branches or pull requests

3 participants