glslang/Test/rayQuery-types.comp
Daniel Koch c0bcfaf3ba
Fix SPV return type of rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT (#2484)
Issue #2483

According to GLSL spec the prototype is:
        uint rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQueryEXT q, bool committed);

but that was incorrectly getting translated to SPIRV as an `int`, and this was
causing SPIR-V validation errors when used.

Added explicit testing for the return types of all the builtin functions in GL_EXT_ray_query
2020-12-12 10:34:24 -07:00

46 lines
2.3 KiB
Plaintext

#version 460
#extension GL_EXT_ray_query : require
layout(local_size_x = 16, local_size_y = 8, local_size_z = 1) in;
layout(binding = 0, set = 0) uniform accelerationStructureEXT tlas;
void main()
{
rayQueryEXT rayQuery;
rayQueryInitializeEXT(rayQuery, // Ray query
tlas, // Top-level acceleration structure
0, // Ray flags
0xFF, // 8-bit instance mask
vec3(0), // Ray origin
0.0, // Minimum t-value
vec3(1, 0, 0), // Ray direction
10000.0); // Maximum t-value
// yes this is silly, just want to verify the return types
bool rq_proceed = rayQueryProceedEXT(rayQuery);
while(rq_proceed)
{
rq_proceed = rayQueryProceedEXT(rayQuery);
}
const uint intersectionType = rayQueryGetIntersectionTypeEXT(rayQuery, true);
const float rayTMin = rayQueryGetRayTMinEXT(rayQuery);
const uint rayFlags = rayQueryGetRayFlagsEXT(rayQuery);
const vec3 worldRayOrigin = rayQueryGetWorldRayOriginEXT(rayQuery);
const vec3 worldDirection = rayQueryGetWorldRayDirectionEXT(rayQuery);
const float intersectionT = rayQueryGetIntersectionTEXT(rayQuery, true);
const int customIndex = rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true);
const int instanceId = rayQueryGetIntersectionInstanceIdEXT(rayQuery, true);
const uint sbtOffset = rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQuery, true);
const int geometryIndex = rayQueryGetIntersectionGeometryIndexEXT(rayQuery, true);
const int primitiveIndex = rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true);
const vec2 barys = rayQueryGetIntersectionBarycentricsEXT(rayQuery, true);
const bool frontface = rayQueryGetIntersectionFrontFaceEXT(rayQuery, true);
const bool aabbOpaque = rayQueryGetIntersectionCandidateAABBOpaqueEXT(rayQuery);
const vec3 objRayDirection = rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true);
const vec3 objRayOrigin = rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true);
const mat4x3 objToWorld = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, true);
const mat4x3 worldToObj = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, true);
}