feat(core): support building custom geometry BLAS#9290
Conversation
|
We appreciate the effort here! I can't speak to the usefulness of the changes myself but I'm sure @Vecvec will have thoughts.
This kind of approach is unlikely to result in a merge unfortunately. We want contributors to know exactly what the code is doing, and be able to explain and defend the choices made. "Oh, AI did it" isn't a valid excuse for poor or unnecessary code. In particular, I doubt the MSL writer is really that broken. If it was, you would be better off first filing an issue explaining that and then making a separate PR once its been confirmed that major changes are required (or waiting for someone who is better versed handle the issue if they desire). |
|
@inner-daemons, from reading over the previously generated code, the previous method does not support AABB intersections (and probably non-opaque intersections too). Interestingly, yesterday I was actually re-writing the metal ray tracing backend to use intersection queries to try and isolate #9100 (though my initial draft did not help it at all, so its probably not that). It would probably need some polishing up before opening a PR, but if @dylanblokhuis would prefer it, I can do some more work on it. |
|
@Vecvec Looks like I misinterpreted this, and the MSL writer changes are needed and relevant, so you can ignore those doubts. Thanks for following up so quickly. |
Whatever you prefer! Perhaps the Naga MSL output from the Would be great to have ray queries working on the big three, then all the voxel game dev enthusiasts can use hardware ray tracing in their projects. |
|
@dylanblokhuis I've opened the patch for msl-out in #9304 |
|
Also, this will need some tests. You can find the ray tracing ones under |
|
@Vecvec I added tests |
|
I reverted the naga changes so the PR is only focused on |
Vecvec
left a comment
There was a problem hiding this comment.
Nothing major from a first read-through. Very excited to have this!
Vecvec
left a comment
There was a problem hiding this comment.
A few places where stride validation should be changed since stride doesn't affect initial size. Somewhere in build acceleration structures there should be stride validation which is now in create_blas. Otherwise seems good!
|
I didn't notice this earlier, but the example probably should have a readme in it. |
Added the README and changed up the stride location. |
Vecvec
left a comment
There was a problem hiding this comment.
I'm afraid I was unclear about where to put the validation. Once this is changed, I think everything should be good to merge.
I'm assuming you don't want to wait on #9304 because you have not rebased on it. If that is so, could you add a second line to aabb compute (either in the readme or on the expected fail) that explains that metal does not support aabb intersections yet so this example may not work on it.
I added this! |
Co-authored-by: Vecvec <vectorsofvectors@gmail.com>
Connections
#6762 #7701
Description
wgpu-halsupports building AABB BLASes butwgpu-coredoes not. This PR adds this functionality towgpu-core. This PR also includes a rewrite for the naga MSL writer to emit "correct" MSL for ray queries. (this part was heavily written by AI as I do not understand the naga internals at this time)Testing
I added a new example
ray_aabb_computeto test the custom geometry on macOS (metal) and Windows (dx12, vulkan). Raytracing tests don't work for macOS at the moment, socargo xtask textdoesn't validate the MSL changes to be working properly. Tests do pass on Windows.Squash or Rebase?
Squash
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry.