1#version 460 2#extension GL_EXT_ray_query : require 3#extension GL_EXT_ray_tracing : require 4#extension GL_EXT_ray_flags_primitive_culling : require 5layout(primitive_culling); 6 7layout(set = 0, binding = 0) uniform accelerationStructureEXT AS; 8 9layout(set = 0, binding = 1) uniform Params 10{ 11 uint ray_flags; 12 uint cull_mask; 13 vec3 origin; 14 float tmin; 15 vec3 dir; 16 float tmax; 17 float thit; 18 uvec2 bda; 19}; 20 21rayQueryEXT q2[2]; 22 23void main() 24{ 25 rayQueryEXT q; 26 bool res; 27 uint type; 28 float fval; 29 vec3 fvals; 30 int ival; 31 mat4x3 matrices; 32 33 rayQueryInitializeEXT(q, AS, ray_flags, cull_mask, origin, tmin, dir, tmax); 34 rayQueryInitializeEXT(q2[1], accelerationStructureEXT(bda), ray_flags, cull_mask, origin, tmin, dir, tmax); 35 36 res = rayQueryProceedEXT(q); 37 rayQueryTerminateEXT(q2[0]); 38 rayQueryGenerateIntersectionEXT(q, thit); 39 rayQueryConfirmIntersectionEXT(q2[1]); 40 fval = rayQueryGetRayTMinEXT(q); 41 type = rayQueryGetRayFlagsEXT(q2[0]); 42 fvals = rayQueryGetWorldRayDirectionEXT(q); 43 fvals = rayQueryGetWorldRayOriginEXT(q); 44 type = rayQueryGetIntersectionTypeEXT(q2[1], true); 45 res = rayQueryGetIntersectionCandidateAABBOpaqueEXT(q2[1]); 46 fval = rayQueryGetIntersectionTEXT(q2[1], false); 47 ival = rayQueryGetIntersectionInstanceCustomIndexEXT(q, true); 48 ival = rayQueryGetIntersectionInstanceIdEXT(q2[0], false); 49 type = rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(q, true); 50 ival = rayQueryGetIntersectionGeometryIndexEXT(q2[1], false); 51 ival = rayQueryGetIntersectionPrimitiveIndexEXT(q, true); 52 fvals.xy = rayQueryGetIntersectionBarycentricsEXT(q2[0], false); 53 res = rayQueryGetIntersectionFrontFaceEXT(q, true); 54 fvals = rayQueryGetIntersectionObjectRayDirectionEXT(q, false); 55 fvals = rayQueryGetIntersectionObjectRayOriginEXT(q2[0], true); 56 matrices = rayQueryGetIntersectionObjectToWorldEXT(q, false); 57 matrices = rayQueryGetIntersectionWorldToObjectEXT(q2[1], true); 58} 59