-
Notifications
You must be signed in to change notification settings - Fork 957
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
[spirv] Stop naga causing undefined behavior in rayQueryGet*Intersection
#6752
base: trunk
Are you sure you want to change the base?
Conversation
…rt-undefined-behavior # Conflicts: # tests/tests/ray_tracing/as_build.rs
…andidate. This is because the requirements of spirv undefined behaviour require it like this.
…rt-undefined-behavior # Conflicts: # CHANGELOG.md
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.
Some comments on the tests
out = Intersection( | ||
intersection.kind, | ||
intersection.t, | ||
intersection.instance_custom_index, | ||
intersection.instance_id, | ||
intersection.sbt_record_offset, | ||
intersection.geometry_index, | ||
intersection.primitive_index, | ||
intersection.barycentrics, | ||
u32(intersection.front_face), | ||
intersection.world_to_object, | ||
intersection.object_to_world, | ||
); |
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 values do these have if they are not valid to read? Similarly might it be useful to assert that the values are sane coming out of the api?
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.
The idea is these are always valid to read, it should just be zero.
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.
I'm not sure what happens on a mac though, it may still have undefined behavior.
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.
The way metal's API is designed seems to suggest that undefined behavior is unlikely (but I can't find anything in the specification that suggests this).
…to remove-rt-undefined-behavior
rayQueryGet*Intersection
rayQueryGet*Intersection
Connections
fixes #6731
Description
Naga previously unconditionally called operations that required the ray to hit something. This is undefined behavior according to the spirv raytracing spec. This caused seg-faults on lavapipe. This prevents that by separating the intersection getter into another function with conditional blocks.
Testing
added a test that previously failed (with a seg-fault) that now succeeds
Checklist
cargo fmt
.taplo format
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.