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

MSL: RayQuery implementation is incomplete #2115

Closed
Try opened this issue Feb 26, 2023 · 0 comments
Closed

MSL: RayQuery implementation is incomplete #2115

Try opened this issue Feb 26, 2023 · 0 comments
Labels
enhancement New feature to SPIRV-Cross is desired.

Comments

@Try
Copy link
Contributor

Try commented Feb 26, 2023

For function

void rayQueryInitializeEXT(rayQueryEXT rayQuery,
       accelerationStructureEXT topLevel,
       uint rayFlags, uint cullMask,  vec3 origin,
       float tMin, vec3 direction, float tMax);

uint rayFlags appear to be fully ignored. In translated MSL-shader, there is:

rayQuery.reset(ray(rayOrigin, rayDirection, 0.0, rayDistance), topLevelAS, intersection_params());

Proposed solution:
rayFlags can be mapped to intersection_params properties. spirv-cross should emit helper function that constructs intersection_params object.

intersection_params spvMakeIntersectionParams(uint flags) {
  intersection_params ip;
  ...
  return ip;
  }
// GL_EXT_ray_tracing
gl_RayFlagsNoneEXT -> (no actions needed)
gl_RayFlagsOpaqueEXT -> ip.force_opacity(forced_opacity::opaque)
gl_RayFlagsNoOpaqueEXT -> ip.force_opacity(forced_opacity::non_opaque)
gl_RayFlagsTerminateOnFirstHitEXT -> ip.accept_any_intersection(true)
gl_RayFlagsSkipClosestHitShaderEXT -> N/A
gl_RayFlagsCullBackFacingTrianglesEXT -> ip.set_triangle_cull_mode(triangle_cull_mode::back)
gl_RayFlagsCullFrontFacingTrianglesEXT -> ip.set_triangle_cull_mode(triangle_cull_mode::front)
gl_RayFlagsCullOpaqueEXT -> ip.set_opacity_cull_mode(opacity_cull_mode::opaque)
gl_RayFlagsCullNoOpaqueEXT ->  ip.set_opacity_cull_mode(opacity_cull_mode::non_opaque)
// GL_EXT_ray_flags_primitive_culling
gl_RayFlagsSkipTrianglesEXT -> ip.set_geometry_cull_mode(geometry_cull_mode::triangle)
gl_RayFlagsSkipAABBEXT -> ip.set_geometry_cull_mode(geometry_cull_mode::bounding_box)
@HansKristian-Work HansKristian-Work added the enhancement New feature to SPIRV-Cross is desired. label Feb 27, 2023
Try added a commit to Try/SPIRV-Cross that referenced this issue Jul 3, 2023
@Try Try closed this as completed Jul 15, 2023
devshgraphicsprogramming pushed a commit to devshgraphicsprogramming/SPIRV-Cross that referenced this issue Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature to SPIRV-Cross is desired.
Projects
None yet
Development

No branches or pull requests

2 participants