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

[spirv] Stop naga causing undefined behavior in rayQueryGet*Intersection #6752

Merged
merged 31 commits into from
Jan 17, 2025

Conversation

Vecvec
Copy link
Contributor

@Vecvec Vecvec commented Dec 16, 2024

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

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy. If applicable, add:
    • [n/a] --target wasm32-unknown-unknown
    • [n/a] --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@Vecvec Vecvec requested a review from a team December 16, 2024 05:12
@Vecvec Vecvec requested a review from a team as a code owner December 16, 2024 05:12
@jimblandy jimblandy self-assigned this Dec 18, 2024
Copy link
Member

@cwfitzgerald cwfitzgerald left a 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

tests/tests/ray_tracing/shader.rs Outdated Show resolved Hide resolved
tests/tests/ray_tracing/shader.rs Outdated Show resolved Hide resolved
tests/tests/ray_tracing/shader.rs Outdated Show resolved Hide resolved
tests/tests/ray_tracing/shader.wgsl Show resolved Hide resolved
@Vecvec Vecvec changed the title Stop naga causing undefined behavior in rayQueryGet*Intersection [spirv] Stop naga causing undefined behavior in rayQueryGet*Intersection Dec 24, 2024
@cwfitzgerald cwfitzgerald self-assigned this Jan 3, 2025
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks needfully verbose but fine.

I've done a pass on the naga side, would like a final lookover of the naga side before this lands.

@jimblandy

Copy link
Member

@jimblandy jimblandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Naga portion looks good. It's not pretty, but it's clean, and I don't see a better alternative.

…ehavior

# Conflicts:
#	CHANGELOG.md
#	tests/tests/ray_tracing/as_build.rs
@Vecvec
Copy link
Contributor Author

Vecvec commented Jan 16, 2025

I think the MacOS CI fail is unrelated - This doesn't change any code to do with MacOS.

@cwfitzgerald
Copy link
Member

Ooo we have a spuriously failing test!

@cwfitzgerald cwfitzgerald enabled auto-merge (squash) January 16, 2025 23:49
@cwfitzgerald cwfitzgerald merged commit bdef8c0 into gfx-rs:trunk Jan 17, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lavapipe causes access violation accessing intersection.world_to_object
3 participants