Ray queries are available to all shader types, including graphics, compute and ray tracing pipelines. Ray queries are not able to launch additional shaders, instead returning traversal results to the calling shader.
This extension adds support for the following SPIR-V extension in Vulkan:
SPV_KHR_ray_queryExample of ray query in a GLSL shader, illustrating how to use ray queries to determine whether a given position (at ray origin) is in shadow or not, by tracing a ray towards the light, and checking for any intersections with geometry occluding the light.
rayQueryEXT rq;
rayQueryInitializeEXT(rq, accStruct, gl_RayFlagsTerminateOnFirstHitEXT, cullMask, origin, tMin, direction, tMax);
// Traverse the acceleration structure and store information about the first intersection (if any)
rayQueryProceedEXT(rq);
if (rayQueryGetIntersectionTypeEXT(rq, true) == gl_RayQueryCommittedIntersectionNoneEXT) {
// Not in shadow
}
VK_KHR_ray_queryVK_KHR_spirv_1_4 and VK_KHR_acceleration_structureSPV_KHR_ray_queryGLSL_EXT_ray_query| Modifier and Type | Field and Description |
|---|---|
| public static final String | VK_KHR_RAY_QUERY_EXTENSION_NAME
The extension name. |
| public static final int | VK_KHR_RAY_QUERY_SPEC_VERSION
The extension specification version. |
| public static final int | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR
Extends |
| Access | Constructor and Description |
|---|---|
| private |
| VK_KHR_RAY_QUERY_EXTENSION_NAME | back to summary |
|---|---|
| public static final String VK_KHR_RAY_QUERY_EXTENSION_NAME The extension name. | |
| VK_KHR_RAY_QUERY_SPEC_VERSION | back to summary |
|---|---|
| public static final int VK_KHR_RAY_QUERY_SPEC_VERSION The extension specification version. | |
| VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR | back to summary |
|---|---|
| public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR Extends | |
| KHRRayQuery | back to summary |
|---|---|
| private KHRRayQuery() | |