diff --git a/docs/api-specs/ray_tracing.md b/docs/api-specs/ray_tracing.md index a4038547d..4c69e476d 100644 --- a/docs/api-specs/ray_tracing.md +++ b/docs/api-specs/ray_tracing.md @@ -25,7 +25,7 @@ A [`Blas`] can be created with [`Device::create_blas`]. A [`Tlas`] can be created with [`Device::create_tlas`]. The [`Tlas`] reference can be placed in a bind group to be used in a shader. A reference to a [`Blas`] can -be used to create [`TlasInstance`] alongside a transformation matrix, a custom index +be used to create [`TlasInstance`] alongside a transformation matrix, custom data (this can be any data that should be given to the shader on a hit) which only the first 24 bits may be set, and a mask to filter hits in the shader. @@ -75,7 +75,7 @@ fn render(/*whatever args you need to render*/) { } let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); - /* do other preparations on th TlasInstance.*/ + /* do other preparations on the TlasInstance.*/ encoder.build_acceleration_structures(iter::empty(), iter::once(&tlas_package)); /* more render code */ queue.submit(Some(encoder.finish())); @@ -93,11 +93,13 @@ fn render(/*whatever args you need to render*/) { ## `naga`'s raytracing API: -`naga` supports ray queries (also known as inline raytracing) only. Ray tracing pipelines are currently unsupported. -Naming is mostly taken from vulkan. +`naga` supports ray queries (also known as inline raytracing) only. To enable basic ray query functions you must add +`enable wgpu_ray_query` to the shader, ray queries and acceleration structures also support tags which require extra +`enable` extensions (see Acceleration structure tags for more info). Ray tracing pipelines +are currently unsupported. Naming is mostly taken from vulkan. ```wgsl -// - Initializes the `ray_query` to check where (if anywhere) the ray defined by `ray_desc` hits in `acceleration_structure +// - Initializes the `ray_query` to check where (if anywhere) the ray defined by `ray_desc` hits in `acceleration_structure` rayQueryInitialize(rq: ptr, acceleration_structure: acceleration_structure, ray_desc: RayDesc) // Overload. rayQueryInitialize(rq: ptr>, acceleration_structure: acceleration_structure, ray_desc: RayDesc) @@ -268,3 +270,14 @@ const RAY_QUERY_INTERSECTION_GENERATED = 2; // if the ray intersects the bounding box for a custom object. const RAY_QUERY_INTERSECTION_AABB = 3; ``` + +### Acceleration structure tags + +These are tags that can be added to a acceleration structure (`acceleration_structure` -> +`acceleration_structure<... insert tags here! ...>`) and to a ray query (`ray_query` -> +`ray_query<... insert tags here! ...>`). These require more features. + + +| Tag | Requirements | Description | +| --- | ------------ | -- | +| `vertex_return`| `enable wgpu_ray_query_vertex_return` | Allows getting the vertices of the hit triangle when using ray queries |