-
Notifications
You must be signed in to change notification settings - Fork 929
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
[wgpu-hal] Initial Vulkan ray query and acceleration structure support #3020
Conversation
Besides documentation and dummy implementations for the other backends, I think this is ready for review. |
…y implementation, run cargo clippy, fix wgpu/wgpu build
…me links to implementation resources.
…u into hal-acceleration-structures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great work - have no massive comments. tbh I don't fully understand RT apis as I haven't used them, but from what I know about them, this design seems sane and low overhead.
|
||
let geometry_info = geometry_info.build(); | ||
|
||
let range = &[range][..]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What on earth?
align_mask: if desc | ||
.usage | ||
.contains(crate::BufferUses::TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT) | ||
{ | ||
16 | ||
} else { | ||
req.alignment | ||
} - 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's pull the if statement into a variable.
vk::WriteDescriptorSetAccelerationStructureKHR::builder() | ||
.acceleration_structures(&raw_acceleration_structures[raw_start..]); | ||
|
||
// todo: Dereference the struct to get around lifetime issues. Safe as long as we never resize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need to do this, let's add an assertion that we always have room on push.
instance_custom_index_and_mask: pack_24_8(0, 0xff), | ||
instance_shader_binding_table_record_offset_and_flags: pack_24_8(0, 0), | ||
acceleration_structure_reference: unsafe { | ||
device.get_acceleration_structure_device_address(&blas) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the kind of thing we'd hide at the wgpu-core level?
const ACCELERATION_STRUCTURE_SCRATCH = 1 << 10; | ||
const BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT = 1 << 11; | ||
const TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT = 1 << 12; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These probably need to be added to either INCLUSIVE or EXCLUSIVE in some way?
Poke from triage |
This PR is currently on-pause because I don't have the time to work on it along with everything else I'm doing. I don't think it'll take much to get it to a mergeable state and if someone else wants to work on that then I'm happy to review their changes. I wish there was a way to indicate this on github, lots of people (understandably) seem to be afraid to touch someone else's PR if it's still open |
@cwfitzgerald is there a list of TODOs left on this before being mergeable? I'd like to pick this up |
@seabassjh love to have this be picked up - the main ones are the comments on the PR |
I imagine there's some work to be done to resolve #3044 etc as well |
I would like to help out. |
@daniel-keitel if you link me your changes I can review them and merge them into this branch |
@expenses I created a pull request on your fork. |
Hi @daniel-keitel, sorry I missed this. It might be better if you created a new PR on wgpu and then the discussion moved over to there. |
Closing on favor of 3507 |
Checklist
cargo clippy
.RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown
if applicable.Connections
#1040
Description
Still a work in progress, but I can ray-trace instanced triangles now:
Needs a cleanup and support for acceleration structure updates.
Testing
Explain how this change is tested.