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 SPV_KHR_ray_tracing_position_fetch in naga #6763

Open
Vecvec opened this issue Dec 16, 2024 · 1 comment
Open

support SPV_KHR_ray_tracing_position_fetch in naga #6763

Vecvec opened this issue Dec 16, 2024 · 1 comment
Labels
area: naga front-end feature: raytracing Issues with the Ray Tracing Native Feature lang: WGSL WebGPU Shading Language naga Shader Translator type: enhancement New feature or request

Comments

@Vecvec
Copy link
Contributor

Vecvec commented Dec 16, 2024

Is your feature request related to a problem? Please describe.
spirv supports SPV_KHR_ray_tracing_position_fetch which can be very useful if one does not want to keep vertex & index buffers around

Describe the solution you'd like
The feature to be supported

Describe alternatives you've considered
Not supporting it, it's only on spirv - Con: uses one or two of the (valuable) buffer spaces in a shader.

Additional context
Previous suggestion for API (see #1040 (comment))

var acc_w_vertex_return: acceleration_structure<vertex_return>;
var normal_acc: acceleration_structure;
// only allowed to be initialised by acceleration_structure<vertex_return>
var rq_w_vertex_return: ray_query<vertex_return>;
// allowed to be initialised by both
var normal_rq: ray_query;

//function to get vertices from latest hit, same conditions as rayQueryGet*Intersection
fn get{Committed/Candidate}HitVertexPositions(rq: ptr<function, ray_query<vertex_return>>) -> array<vec3<f32>, 3>

I've partially implemented this already, with getCommittedHitVertexPositions implemented

@cwfitzgerald cwfitzgerald added naga Shader Translator area: naga front-end lang: WGSL WebGPU Shading Language feature: raytracing Issues with the Ray Tracing Native Feature type: enhancement New feature or request labels Dec 16, 2024
@Vecvec
Copy link
Contributor Author

Vecvec commented Jan 8, 2025

I'm not entirely sure how metal works, but looking at the metal feature set tables it seems that we can access an unlimited number of buffers from a shader if they are in an argument buffer. I think this means we could emulate this on metal since we can go around the maximum requirements here. I may be wrong though as I have no metal experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga front-end feature: raytracing Issues with the Ray Tracing Native Feature lang: WGSL WebGPU Shading Language naga Shader Translator type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants