naga_oil
naga_oil copied to clipboard
Handle naga's SpecialTypes
Ray tracing APIs do not currently work with naga_oil. DerivedModule throws out special_type info.
a minimal example would be really useful - just the wgsl.
Try calling this function from a different module.
@group(0) @binding(0) var tlas: acceleration_structure;
fn trace_ray(ray_origin: vec3<f32>, ray_direction: vec3<f32>, ray_t_min: f32, ray_t_max: f32) -> RayIntersection {
let ray_flags = RAY_FLAG_NONE;
let ray_cull_mask = 0xFFu;
let ray = RayDesc(ray_flags, ray_cull_mask, ray_t_min, ray_t_max, ray_origin, ray_direction);
var rq: ray_query;
rayQueryInitialize(&rq, tlas, ray);
rayQueryProceed(&rq);
return rayQueryGetCommittedIntersection(&rq);
}
If I understood what's going on correctly when experimenting, naga can interpret acceleration_structure
type, but it cannot write it again in WGSL.
@robtfm I modified naga to support writing out acceleration_structure. However we still need to populate the RT SpecialTypes. I worked around it by hardcoding them: https://github.com/JMS55/naga_oil/commit/9bcdd3b90d3f2d78efcdde84b02332db2acb4668
The fix for being unable to write the acceleration structure binding is https://github.com/gfx-rs/wgpu/pull/5261, but using RayIntersection across modules and stuff is still and issue and needs to be fixed by populating the special types.