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

Handle naga's SpecialTypes #54

Open
JMS55 opened this issue Sep 8, 2023 · 5 comments
Open

Handle naga's SpecialTypes #54

JMS55 opened this issue Sep 8, 2023 · 5 comments

Comments

@JMS55
Copy link
Contributor

JMS55 commented Sep 8, 2023

Ray tracing APIs do not currently work with naga_oil. DerivedModule throws out special_type info.

@robtfm
Copy link
Collaborator

robtfm commented Sep 10, 2023

a minimal example would be really useful - just the wgsl.

@JMS55
Copy link
Contributor Author

JMS55 commented Sep 11, 2023

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);
}

@MiniaczQ
Copy link

MiniaczQ commented Jan 19, 2024

If I understood what's going on correctly when experimenting, naga can interpret acceleration_structure type, but it cannot write it again in WGSL.

@JMS55
Copy link
Contributor Author

JMS55 commented Feb 18, 2024

@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: JMS55@9bcdd3b

@JMS55
Copy link
Contributor Author

JMS55 commented Feb 18, 2024

The fix for being unable to write the acceleration structure binding is gfx-rs/wgpu#5261, but using RayIntersection across modules and stuff is still and issue and needs to be fixed by populating the special types.

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

No branches or pull requests

3 participants