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 getting hit vertex positions. #7141

Open
wants to merge 288 commits into
base: trunk
Choose a base branch
from

Conversation

Vecvec
Copy link
Contributor

@Vecvec Vecvec commented Feb 14, 2025

Connections
Fixes #6763

Description
Supports getting the vertices out of the ray query with a new function. In naga's extended WGSL language this requires acceleration_structure<vertex_return>, even though other shader languages don't require this, due to validation requirements. If we go the same route as other shader languages, the validation requirements (as far as I can tell) are get*HitVertexPositions tags ray query object. This ray_query then needs to find all uses of itself - iterating through all blocks it's valid in and finding any rayQueryInitialize and tagging all acceleration_structures. This alternate design could also lead to more user confusion. The implemented design instead disallows rayQueryInitialize initializing a ray_query<vertex_return> with a untaged acceleration structure and disallowing calling get*HitVertexPositions with an untagged ray_query.

Testing
Adds an example which demonstrates the use of the newly added function. Adds two tests for invalid uses of this flag.

Checklist

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

Vecvec added 19 commits January 16, 2025 12:32
# Conflicts:
#	naga/src/back/hlsl/writer.rs
#	naga/src/valid/handles.rs
#	naga/src/valid/mod.rs
#	wgpu-core/src/device/ray_tracing.rs
#	wgpu-core/src/ray_tracing.rs
#	wgpu-hal/src/dx12/conv.rs
#	wgpu-hal/src/dx12/device.rs
#	wgpu-hal/src/metal/device.rs
#	wgpu-hal/src/vulkan/adapter.rs
#	wgpu-types/src/lib.rs
…cing-get-vertex

# Conflicts:
#	naga/src/back/spv/ray.rs
#	naga/src/compact/types.rs
#	naga/src/proc/mod.rs
#	wgpu-hal/examples/ray-traced-triangle/main.rs
#	wgpu-hal/src/dx12/device.rs
…cing-get-vertex

# Conflicts:
#	wgpu-types/src/lib.rs
@Vecvec Vecvec requested a review from a team as a code owner February 14, 2025 19:43
…cing-get-vertex

# Conflicts:
#	etc/specs/ray_tracing.md
#	naga/src/back/spv/instructions.rs
#	wgpu-core/src/device/ray_tracing.rs
#	wgpu-core/src/ray_tracing.rs
#	wgpu-types/src/lib.rs
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.

support SPV_KHR_ray_tracing_position_fetch in naga
7 participants