From 8a6b381c9afbfaf9fff851582539fab15ea480c0 Mon Sep 17 00:00:00 2001 From: alelenv Date: Wed, 5 Feb 2025 10:57:37 -0800 Subject: [PATCH] Add support for GL_NV_linear_swept_spheres. --- SPIRV/GLSL.ext.NV.h | 2 + SPIRV/GlslangToSpv.cpp | 201 ++++++++++++++++++- SPIRV/doc.cpp | 66 ++++++ SPIRV/spirv.hpp | 21 ++ Test/baseResults/spv.nv.lss-allops.frag.out | 90 +++++++++ Test/baseResults/spv.nv.lss-allops.rchit.out | 143 +++++++++++++ Test/baseResults/spv.nv.lss-allops.rgen.out | 108 ++++++++++ Test/baseResults/spv.nv.lss-allops.rmiss.out | 108 ++++++++++ Test/spv.nv.lss-allops.frag | 37 ++++ Test/spv.nv.lss-allops.rchit | 56 ++++++ Test/spv.nv.lss-allops.rgen | 47 +++++ Test/spv.nv.lss-allops.rmiss | 47 +++++ glslang/Include/BaseTypes.h | 14 ++ glslang/Include/intermediate.h | 15 ++ glslang/MachineIndependent/Initialize.cpp | 70 +++++++ glslang/MachineIndependent/ParseHelper.cpp | 5 + glslang/MachineIndependent/Versions.cpp | 1 + glslang/MachineIndependent/Versions.h | 1 + glslang/MachineIndependent/intermOut.cpp | 13 ++ gtests/Spv.FromFile.cpp | 7 + known_good.json | 4 +- 21 files changed, 1053 insertions(+), 3 deletions(-) create mode 100644 Test/baseResults/spv.nv.lss-allops.frag.out create mode 100644 Test/baseResults/spv.nv.lss-allops.rchit.out create mode 100644 Test/baseResults/spv.nv.lss-allops.rgen.out create mode 100644 Test/baseResults/spv.nv.lss-allops.rmiss.out create mode 100644 Test/spv.nv.lss-allops.frag create mode 100644 Test/spv.nv.lss-allops.rchit create mode 100644 Test/spv.nv.lss-allops.rgen create mode 100644 Test/spv.nv.lss-allops.rmiss diff --git a/SPIRV/GLSL.ext.NV.h b/SPIRV/GLSL.ext.NV.h index 77912ad8d5..d4a97b31fb 100644 --- a/SPIRV/GLSL.ext.NV.h +++ b/SPIRV/GLSL.ext.NV.h @@ -99,4 +99,6 @@ const char* const E_SPV_NV_cooperative_matrix2 = "SPV_NV_cooperative_matrix2"; //SPV_NV_cluster_acceleration_structure const char* const E_SPV_NV_cluster_acceleration_structure = "SPV_NV_cluster_acceleration_structure"; +//SPV_NV_linear_swept_spheres +const char* const E_SPV_NV_linear_swept_spheres = "SPV_NV_linear_swept_spheres"; #endif // #ifndef GLSLextNV_H diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 6e0e299b33..ee736042e2 100644 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -1033,6 +1033,30 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addCapability(spv::CapabilityRayTracingClusterAccelerationStructureNV); builder.addExtension("SPV_NV_cluster_acceleration_structure"); return spv::BuiltInClusterIDNV; + case glslang::EbvHitIsSphereNV: + builder.addCapability(spv::CapabilityRayTracingSpheresGeometryNV); + builder.addExtension("SPV_NV_linear_swept_spheres"); + return spv::BuiltInHitIsSphereNV; + case glslang::EbvHitIsLSSNV: + builder.addCapability(spv::CapabilityRayTracingLinearSweptSpheresGeometryNV); + builder.addExtension("SPV_NV_linear_swept_spheres"); + return spv::BuiltInHitIsLSSNV; + case glslang::EbvHitSpherePositionNV: + builder.addCapability(spv::CapabilityRayTracingSpheresGeometryNV); + builder.addExtension("SPV_NV_linear_swept_spheres"); + return spv::BuiltInHitSpherePositionNV; + case glslang::EbvHitSphereRadiusNV: + builder.addCapability(spv::CapabilityRayTracingSpheresGeometryNV); + builder.addExtension("SPV_NV_linear_swept_spheres"); + return spv::BuiltInHitSphereRadiusNV; + case glslang::EbvHitLSSPositionsNV: + builder.addCapability(spv::CapabilityRayTracingLinearSweptSpheresGeometryNV); + builder.addExtension("SPV_NV_linear_swept_spheres"); + return spv::BuiltInHitLSSPositionsNV; + case glslang::EbvHitLSSRadiiNV: + builder.addCapability(spv::CapabilityRayTracingLinearSweptSpheresGeometryNV); + builder.addExtension("SPV_NV_linear_swept_spheres"); + return spv::BuiltInHitLSSRadiiNV; // barycentrics case glslang::EbvBaryCoordNV: @@ -2668,6 +2692,10 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV: case glslang::EOpHitObjectGetShaderRecordBufferHandleNV: case glslang::EOpHitObjectGetClusterIdNV: + case glslang::EOpHitObjectGetSpherePositionNV: + case glslang::EOpHitObjectGetSphereRadiusNV: + case glslang::EOpHitObjectIsSphereHitNV: + case glslang::EOpHitObjectIsLSSHitNV: return true; default: return false; @@ -3426,6 +3454,53 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.addExtension(spv::E_SPV_NV_shader_invocation_reorder); builder.addCapability(spv::CapabilityShaderInvocationReorderNV); break; + + case glslang::EOpHitObjectGetLSSPositionsNV: + case glslang::EOpHitObjectGetLSSRadiiNV: + builder.addExtension(spv::E_SPV_NV_linear_swept_spheres); + builder.addCapability(spv::CapabilityShaderInvocationReorderNV); + builder.addCapability(spv::CapabilityRayTracingLinearSweptSpheresGeometryNV); + noReturnValue = true; + break; + + case glslang::EOpHitObjectGetSpherePositionNV: + case glslang::EOpHitObjectGetSphereRadiusNV: + case glslang::EOpHitObjectIsSphereHitNV: + builder.addExtension(spv::E_SPV_NV_linear_swept_spheres); + builder.addCapability(spv::CapabilityShaderInvocationReorderNV); + builder.addCapability(spv::CapabilityRayTracingSpheresGeometryNV); + break; + + case glslang::EOpHitObjectIsLSSHitNV: + builder.addExtension(spv::E_SPV_NV_linear_swept_spheres); + builder.addCapability(spv::CapabilityShaderInvocationReorderNV); + builder.addCapability(spv::CapabilityRayTracingLinearSweptSpheresGeometryNV); + break; + + case glslang::EOpRayQueryGetIntersectionLSSPositionsNV: + case glslang::EOpRayQueryGetIntersectionLSSRadiiNV: + builder.addExtension(spv::E_SPV_NV_linear_swept_spheres); + builder.addCapability(spv::CapabilityRayQueryKHR); + builder.addCapability(spv::CapabilityRayTracingLinearSweptSpheresGeometryNV); + noReturnValue = true; + break; + + case glslang::EOpRayQueryGetIntersectionSpherePositionNV: + case glslang::EOpRayQueryGetIntersectionSphereRadiusNV: + case glslang::EOpRayQueryIsSphereHitNV: + builder.addExtension(spv::E_SPV_NV_linear_swept_spheres); + builder.addCapability(spv::CapabilityRayQueryKHR); + builder.addCapability(spv::CapabilityRayTracingSpheresGeometryNV); + builder.addCapability(spv::CapabilityRayTracingLinearSweptSpheresGeometryNV); + break; + + case glslang::EOpRayQueryGetIntersectionLSSHitValueNV: + case glslang::EOpRayQueryIsLSSHitNV: + builder.addExtension(spv::E_SPV_NV_linear_swept_spheres); + builder.addCapability(spv::CapabilityRayQueryKHR); + builder.addCapability(spv::CapabilityRayTracingLinearSweptSpheresGeometryNV); + break; + case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: builder.addExtension(spv::E_SPV_KHR_ray_tracing_position_fetch); builder.addCapability(spv::CapabilityRayQueryPositionFetchKHR); @@ -3546,6 +3621,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt lvalue = true; break; + case glslang::EOpHitObjectGetLSSPositionsNV: + case glslang::EOpHitObjectGetLSSRadiiNV: + lvalue = true; + break; + case glslang::EOpRayQueryInitialize: case glslang::EOpRayQueryTerminate: case glslang::EOpRayQueryConfirmIntersection: @@ -3565,6 +3645,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpRayQueryGetIntersectionObjectToWorld: case glslang::EOpRayQueryGetIntersectionWorldToObject: case glslang::EOpRayQueryGetIntersectionClusterIdNV: + case glslang::EOpRayQueryGetIntersectionSpherePositionNV: + case glslang::EOpRayQueryGetIntersectionSphereRadiusNV: + case glslang::EOpRayQueryGetIntersectionLSSHitValueNV: + case glslang::EOpRayQueryIsSphereHitNV: + case glslang::EOpRayQueryIsLSSHitNV: if (arg == 0) lvalue = true; break; @@ -3680,6 +3765,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt lvalue = true; break; case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: + case glslang::EOpRayQueryGetIntersectionLSSPositionsNV: + case glslang::EOpRayQueryGetIntersectionLSSRadiiNV: if (arg == 0 || arg == 2) lvalue = true; break; @@ -3794,7 +3881,14 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt glslangOp == glslang::EOpRayQueryGetIntersectionObjectToWorld || glslangOp == glslang::EOpRayQueryGetIntersectionWorldToObject || glslangOp == glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT || - glslangOp == glslang::EOpRayQueryGetIntersectionClusterIdNV + glslangOp == glslang::EOpRayQueryGetIntersectionClusterIdNV || + glslangOp == glslang::EOpRayQueryGetIntersectionSpherePositionNV || + glslangOp == glslang::EOpRayQueryGetIntersectionSphereRadiusNV || + glslangOp == glslang::EOpRayQueryGetIntersectionLSSHitValueNV || + glslangOp == glslang::EOpRayQueryGetIntersectionLSSPositionsNV || + glslangOp == glslang::EOpRayQueryGetIntersectionLSSRadiiNV || + glslangOp == glslang::EOpRayQueryIsLSSHitNV || + glslangOp == glslang::EOpRayQueryIsSphereHitNV )) { bool cond = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getBConst(); operands.push_back(builder.makeIntConstant(cond ? 1 : 0)); @@ -3965,6 +4059,65 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt // store the result to the pointer (out param 'm') builder.createStore(result, operands[2]); result = 0; + } else if (node->getOp() == glslang::EOpRayQueryGetIntersectionLSSPositionsNV) { + std::vector idImmOps; + + idImmOps.push_back(spv::IdImmediate(true, operands[0])); // q + idImmOps.push_back(spv::IdImmediate(true, operands[1])); // committed + + spv::Id typeId = builder.makeArrayType(builder.makeVectorType(builder.makeFloatType(32), 3), + builder.makeUintConstant(2), 0); + // do the op + + spv::Op spvOp = spv::OpRayQueryGetIntersectionLSSPositionsNV; + + spv::Id result = builder.createOp(spvOp, typeId, idImmOps); + // store the result to the pointer (out param 'm') + builder.createStore(result, operands[2]); + result = 0; + } else if (node->getOp() == glslang::EOpRayQueryGetIntersectionLSSRadiiNV) { + std::vector idImmOps; + + idImmOps.push_back(spv::IdImmediate(true, operands[0])); // q + idImmOps.push_back(spv::IdImmediate(true, operands[1])); // committed + + spv::Id typeId = builder.makeArrayType(builder.makeFloatType(32), + builder.makeUintConstant(2), 0); + // do the op + + spv::Op spvOp = spv::OpRayQueryGetIntersectionLSSRadiiNV; + + spv::Id result = builder.createOp(spvOp, typeId, idImmOps); + // store the result to the pointer (out param 'm') + builder.createStore(result, operands[2]); + result = 0; + } else if (node->getOp() == glslang::EOpHitObjectGetLSSPositionsNV) { + std::vector idImmOps; + + idImmOps.push_back(spv::IdImmediate(true, operands[0])); // hitObject + + spv::Op spvOp = spv::OpHitObjectGetLSSPositionsNV; + spv::Id typeId = builder.makeArrayType(builder.makeVectorType(builder.makeFloatType(32), 3), + builder.makeUintConstant(2), 0); + + spv::Id result = builder.createOp(spvOp, typeId, idImmOps); + // store the result to the pointer (out param 'm') + builder.createStore(result, operands[1]); + result = 0; + } else if (node->getOp() == glslang::EOpHitObjectGetLSSRadiiNV) { + std::vector idImmOps; + + idImmOps.push_back(spv::IdImmediate(true, operands[0])); // hitObject + + spv::Op spvOp = spv::OpHitObjectGetLSSRadiiNV; + spv::Id typeId = builder.makeArrayType(builder.makeFloatType(32), + builder.makeUintConstant(2), 0); + + spv::Id result = builder.createOp(spvOp, typeId, idImmOps); + // store the result to the pointer (out param 'm') + builder.createStore(result, operands[1]); + result = 0; + } else if (node->getOp() == glslang::EOpCooperativeMatrixMulAdd) { uint32_t matrixOperands = 0; @@ -6169,6 +6322,8 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& lvalue = true; break; case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: + case glslang::EOpRayQueryGetIntersectionLSSPositionsNV: + case glslang::EOpRayQueryGetIntersectionLSSRadiiNV: if (i == 2) lvalue = true; break; @@ -7774,6 +7929,22 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe builder.addCapability(spv::CapabilityRayTracingClusterAccelerationStructureNV); break; + case glslang::EOpHitObjectGetSpherePositionNV: + unaryOp = spv::OpHitObjectGetSpherePositionNV; + break; + + case glslang::EOpHitObjectGetSphereRadiusNV: + unaryOp = spv::OpHitObjectGetSphereRadiusNV; + break; + + case glslang::EOpHitObjectIsSphereHitNV: + unaryOp = spv::OpHitObjectIsSphereHitNV; + break; + + case glslang::EOpHitObjectIsLSSHitNV: + unaryOp = spv::OpHitObjectIsLSSHitNV; + break; + case glslang::EOpFetchMicroTriangleVertexPositionNV: unaryOp = spv::OpFetchMicroTriangleVertexPositionNV; break; @@ -9368,6 +9539,26 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: typeId = builder.makeMatrixType(builder.makeFloatType(32), 4, 3); opCode = spv::OpRayQueryGetIntersectionWorldToObjectKHR; break; + case glslang::EOpRayQueryGetIntersectionSpherePositionNV: + typeId = builder.makeVectorType(builder.makeFloatType(32), 3); + opCode = spv::OpRayQueryGetIntersectionSpherePositionNV; + break; + case glslang::EOpRayQueryGetIntersectionSphereRadiusNV: + typeId = builder.makeFloatType(32); + opCode = spv::OpRayQueryGetIntersectionSphereRadiusNV; + break; + case glslang::EOpRayQueryGetIntersectionLSSHitValueNV: + typeId = builder.makeFloatType(32); + opCode = spv::OpRayQueryGetIntersectionLSSHitValueNV; + break; + case glslang::EOpRayQueryIsSphereHitNV: + typeId = builder.makeBoolType(); + opCode = spv::OpRayQueryIsSphereHitNV; + break; + case glslang::EOpRayQueryIsLSSHitNV: + typeId = builder.makeBoolType(); + opCode = spv::OpRayQueryIsLSSHitNV; + break; case glslang::EOpWritePackedPrimitiveIndices4x8NV: builder.createNoResultOp(spv::OpWritePackedPrimitiveIndices4x8NV, operands); return 0; @@ -9422,6 +9613,14 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: typeId = builder.makeBoolType(); opCode = spv::OpHitObjectIsHitNV; break; + case glslang::EOpHitObjectIsSphereHitNV: + typeId = builder.makeBoolType(); + opCode = spv::OpHitObjectIsSphereHitNV; + break; + case glslang::EOpHitObjectIsLSSHitNV: + typeId = builder.makeBoolType(); + opCode = spv::OpHitObjectIsLSSHitNV; + break; case glslang::EOpHitObjectGetRayTMinNV: typeId = builder.makeFloatType(32); opCode = spv::OpHitObjectGetRayTMinNV; diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index 490fee5398..1868f0e964 100644 --- a/SPIRV/doc.cpp +++ b/SPIRV/doc.cpp @@ -424,6 +424,12 @@ const char* BuiltInString(int builtIn) case BuiltInHitMicroTriangleVertexBarycentricsNV: return "HitMicroTriangleVertexBarycentricsNV"; case BuiltInHitKindFrontFacingMicroTriangleNV: return "HitKindFrontFacingMicroTriangleNV"; case BuiltInHitKindBackFacingMicroTriangleNV: return "HitKindBackFacingMicroTriangleNV"; + case BuiltInHitIsSphereNV: return "HitIsSphereNV"; + case BuiltInHitIsLSSNV: return "HitIsLSSNV"; + case BuiltInHitSpherePositionNV: return "HitSpherePositionNV"; + case BuiltInHitSphereRadiusNV: return "HitSphereRadiusNV"; + case BuiltInHitLSSPositionsNV: return "HitLSSPositionsNV"; + case BuiltInHitLSSRadiiNV: return "HitLLSSRadiiNV"; case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR"; case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR"; case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR"; @@ -1101,6 +1107,8 @@ const char* CapabilityString(int info) case CapabilityRayTracingClusterAccelerationStructureNV: return "RayTracingClusterAccelerationStructureNV"; + case CapabilityRayTracingSpheresGeometryNV: return "RayTracingSpheresGeometryNV"; + case CapabilityRayTracingLinearSweptSpheresGeometryNV: return "RayTracingLinearSweptSpheresGeometryNV"; default: return "Bad"; } } @@ -1555,6 +1563,14 @@ const char* OpcodeString(int op) case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: return "OpRayQueryGetIntersectionTriangleVertexPositionsKHR"; case OpRayQueryGetIntersectionClusterIdNV: return "OpRayQueryGetIntersectionClusterIdNV"; + case OpRayQueryGetIntersectionSpherePositionNV: return "OpRayQueryGetIntersectionSpherePositionNV"; + case OpRayQueryGetIntersectionSphereRadiusNV: return "OpRayQueryGetIntersectionSphereRadiusNV"; + case OpRayQueryGetIntersectionLSSHitValueNV: return "OpRayQueryGetIntersectionLSSHitValueNV"; + case OpRayQueryGetIntersectionLSSPositionsNV: return "OpRayQueryGetIntersectionLSSPositionsNV"; + case OpRayQueryGetIntersectionLSSRadiiNV: return "OpRayQueryGetIntersectionLSSRadiiNV"; + case OpRayQueryIsSphereHitNV: return "OpRayQueryIsSphereHitNV"; + case OpRayQueryIsLSSHitNV: return "OpRayQueryIsLSSHitNV"; + case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV"; case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV"; case OpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV"; @@ -1632,6 +1648,12 @@ const char* OpcodeString(int op) case OpHitObjectGetShaderBindingTableRecordIndexNV: return "OpHitObjectGetShaderBindingTableRecordIndexNV"; case OpHitObjectGetShaderRecordBufferHandleNV: return "OpHitObjectGetShaderRecordBufferHandleNV"; case OpHitObjectGetClusterIdNV: return "OpHitObjectGetClusterIdNV"; + case OpHitObjectGetSpherePositionNV: return "OpHitObjectGetSpherePositionNV"; + case OpHitObjectGetSphereRadiusNV: return "OpHitObjectGetSphereRadiusNV"; + case OpHitObjectGetLSSPositionsNV: return "OpHitObjectGetLSSPositionsNV"; + case OpHitObjectGetLSSRadiiNV: return "OpHitObjectGetLSSRadiiNV"; + case OpHitObjectIsSphereHitNV: return "OpHitObjectIsSphereHitNV"; + case OpHitObjectIsLSSHitNV: return "OpHitObjectIsLSSHitNV"; case OpFetchMicroTriangleVertexBarycentricNV: return "OpFetchMicroTriangleVertexBarycentricNV"; case OpFetchMicroTriangleVertexPositionNV: return "OpFetchMicroTriangleVertexPositionNV"; @@ -3222,6 +3244,33 @@ void Parameterize() InstructionDesc[OpRayQueryGetIntersectionClusterIdNV].operands.push(OperandId, "'RayQuery'"); InstructionDesc[OpRayQueryGetIntersectionClusterIdNV].operands.push(OperandId, "'Committed'"); InstructionDesc[OpRayQueryGetIntersectionClusterIdNV].setResultAndType(true, true); + InstructionDesc[OpRayQueryGetIntersectionSpherePositionNV].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionSpherePositionNV].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionSpherePositionNV].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionSphereRadiusNV].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionSphereRadiusNV].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionSphereRadiusNV].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionLSSHitValueNV].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionLSSHitValueNV].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionLSSHitValueNV].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionLSSPositionsNV].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionLSSPositionsNV].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionLSSPositionsNV].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionLSSRadiiNV].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionLSSRadiiNV].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionLSSRadiiNV].setResultAndType(true, true); + + InstructionDesc[OpRayQueryIsSphereHitNV].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryIsSphereHitNV].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryIsSphereHitNV].setResultAndType(true, true); + + InstructionDesc[OpRayQueryIsLSSHitNV].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryIsLSSHitNV].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryIsLSSHitNV].setResultAndType(true, true); InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'"); @@ -3544,6 +3593,23 @@ void Parameterize() InstructionDesc[OpHitObjectGetClusterIdNV].operands.push(OperandId, "'HitObject'"); InstructionDesc[OpHitObjectGetClusterIdNV].setResultAndType(true, true); + InstructionDesc[OpHitObjectGetSpherePositionNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetSpherePositionNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetSphereRadiusNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetSphereRadiusNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetLSSPositionsNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetLSSPositionsNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetLSSRadiiNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetLSSRadiiNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectIsSphereHitNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectIsSphereHitNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectIsLSSHitNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectIsLSSHitNV].setResultAndType(true, true); InstructionDesc[OpFetchMicroTriangleVertexBarycentricNV].operands.push(OperandId, "'Acceleration Structure'"); InstructionDesc[OpFetchMicroTriangleVertexBarycentricNV].operands.push(OperandId, "'Instance ID'"); diff --git a/SPIRV/spirv.hpp b/SPIRV/spirv.hpp index 6a94653772..40171b3040 100644 --- a/SPIRV/spirv.hpp +++ b/SPIRV/spirv.hpp @@ -780,12 +780,18 @@ enum BuiltIn { BuiltInIncomingRayFlagsKHR = 5351, BuiltInIncomingRayFlagsNV = 5351, BuiltInRayGeometryIndexKHR = 5352, + BuiltInHitIsSphereNV = 5359, + BuiltInHitIsLSSNV = 5360, + BuiltInHitSpherePositionNV = 5361, BuiltInWarpsPerSMNV = 5374, BuiltInSMCountNV = 5375, BuiltInWarpIDNV = 5376, BuiltInSMIDNV = 5377, + BuiltInHitLSSPositionsNV = 5396, BuiltInHitKindFrontFacingMicroTriangleNV = 5405, BuiltInHitKindBackFacingMicroTriangleNV = 5406, + BuiltInHitSphereRadiusNV = 5420, + BuiltInHitLSSRadiiNV = 5421, BuiltInClusterIDNV = 5436, BuiltInCullMaskKHR = 6021, BuiltInMax = 0x7fffffff, @@ -1172,6 +1178,8 @@ enum Capability { CapabilityAtomicFloat16VectorNV = 5404, CapabilityRayTracingDisplacementMicromapNV = 5409, CapabilityRawAccessChainsNV = 5414, + CapabilityRayTracingSpheresGeometryNV = 5418, + CapabilityRayTracingLinearSweptSpheresGeometryNV = 5419, CapabilityCooperativeMatrixReductionsNV = 5430, CapabilityCooperativeMatrixConversionsNV = 5431, CapabilityCooperativeMatrixPerElementOperationsNV = 5432, @@ -2033,6 +2041,19 @@ enum Op { OpConvertSampledImageToUNV = 5396, OpSamplerImageAddressingModeNV = 5397, OpRawAccessChainNV = 5398, + OpRayQueryGetIntersectionSpherePositionNV = 5427, + OpRayQueryGetIntersectionSphereRadiusNV = 5428, + OpRayQueryGetIntersectionLSSPositionsNV = 5429, + OpRayQueryGetIntersectionLSSRadiiNV = 5430, + OpRayQueryGetIntersectionLSSHitValueNV = 5431, + OpHitObjectGetSpherePositionNV = 5432, + OpHitObjectGetSphereRadiusNV = 5433, + OpHitObjectGetLSSPositionsNV = 5434, + OpHitObjectGetLSSRadiiNV = 5435, + OpHitObjectIsSphereHitNV = 5436, + OpHitObjectIsLSSHitNV = 5437, + OpRayQueryIsSphereHitNV = 5438, + OpRayQueryIsLSSHitNV = 5439, OpSubgroupShuffleINTEL = 5571, OpSubgroupShuffleDownINTEL = 5572, OpSubgroupShuffleUpINTEL = 5573, diff --git a/Test/baseResults/spv.nv.lss-allops.frag.out b/Test/baseResults/spv.nv.lss-allops.frag.out new file mode 100644 index 0000000000..cbec63efc0 --- /dev/null +++ b/Test/baseResults/spv.nv.lss-allops.frag.out @@ -0,0 +1,90 @@ +spv.nv.lss-allops.frag +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 47 + + Capability Shader + Capability RayQueryKHR + Capability RayTracingSpheresGeometryNV + Capability RayTracingLinearSweptSpheresGeometryNV + Extension "SPV_KHR_ray_query" + Extension "SPV_NV_linear_swept_spheres" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 12 + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + SourceExtension "GL_EXT_ray_query" + SourceExtension "GL_EXT_ray_tracing" + SourceExtension "GL_NV_linear_swept_spheres" + SourceExtension "GL_NV_shader_invocation_reorder" + Name 4 "main" + Name 9 "pos" + Name 12 "rq" + Name 22 "rad" + Name 29 "lss_pos" + Name 34 "lss_rad" + Name 37 "hitVal" + Name 41 "isSphereHit" + Name 44 "isLSSHit" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 3 + 8: TypePointer Function 7(fvec3) + 10: TypeRayQueryKHR + 11: TypePointer Private 10 + 12(rq): 11(ptr) Variable Private + 13: TypeBool + 14: 13(bool) ConstantTrue + 15: TypeInt 32 1 + 16: 15(int) Constant 1 + 18: 13(bool) ConstantFalse + 19: 15(int) Constant 0 + 21: TypePointer Function 6(float) + 25: TypeInt 32 0 + 26: 25(int) Constant 2 + 27: TypeArray 7(fvec3) 26 + 28: TypePointer Function 27 + 32: TypeArray 6(float) 26 + 33: TypePointer Function 32 + 40: TypePointer Function 13(bool) + 4(main): 2 Function None 3 + 5: Label + 9(pos): 8(ptr) Variable Function + 22(rad): 21(ptr) Variable Function + 29(lss_pos): 28(ptr) Variable Function + 34(lss_rad): 33(ptr) Variable Function + 37(hitVal): 21(ptr) Variable Function + 41(isSphereHit): 40(ptr) Variable Function + 44(isLSSHit): 40(ptr) Variable Function + 17: 7(fvec3) RayQueryGetIntersectionSpherePositionNV 12(rq) 16 + Store 9(pos) 17 + 20: 7(fvec3) RayQueryGetIntersectionSpherePositionNV 12(rq) 19 + Store 9(pos) 20 + 23: 6(float) RayQueryGetIntersectionSphereRadiusNV 12(rq) 16 + Store 22(rad) 23 + 24: 6(float) RayQueryGetIntersectionSphereRadiusNV 12(rq) 19 + Store 22(rad) 24 + 30: 27 RayQueryGetIntersectionLSSPositionsNV 12(rq) 16 + Store 29(lss_pos) 30 + 31: 27 RayQueryGetIntersectionLSSPositionsNV 12(rq) 19 + Store 29(lss_pos) 31 + 35: 32 RayQueryGetIntersectionLSSRadiiNV 12(rq) 16 + Store 34(lss_rad) 35 + 36: 32 RayQueryGetIntersectionLSSRadiiNV 12(rq) 19 + Store 34(lss_rad) 36 + 38: 6(float) RayQueryGetIntersectionLSSHitValueNV 12(rq) 16 + Store 37(hitVal) 38 + 39: 6(float) RayQueryGetIntersectionLSSHitValueNV 12(rq) 19 + Store 37(hitVal) 39 + 42: 13(bool) RayQueryIsSphereHitNV 12(rq) 16 + Store 41(isSphereHit) 42 + 43: 13(bool) RayQueryIsSphereHitNV 12(rq) 19 + Store 41(isSphereHit) 43 + 45: 13(bool) RayQueryIsLSSHitNV 12(rq) 16 + Store 44(isLSSHit) 45 + 46: 13(bool) RayQueryIsLSSHitNV 12(rq) 19 + Store 44(isLSSHit) 46 + Return + FunctionEnd diff --git a/Test/baseResults/spv.nv.lss-allops.rchit.out b/Test/baseResults/spv.nv.lss-allops.rchit.out new file mode 100644 index 0000000000..2a4b9dbaa5 --- /dev/null +++ b/Test/baseResults/spv.nv.lss-allops.rchit.out @@ -0,0 +1,143 @@ +spv.nv.lss-allops.rchit +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 73 + + Capability RayQueryKHR + Capability RayTracingKHR + Capability ShaderInvocationReorderNV + Capability RayTracingSpheresGeometryNV + Capability RayTracingLinearSweptSpheresGeometryNV + Extension "SPV_KHR_ray_query" + Extension "SPV_KHR_ray_tracing" + Extension "SPV_NV_linear_swept_spheres" + Extension "SPV_NV_shader_invocation_reorder" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint ClosestHitKHR 4 "main" 12 35 57 60 63 66 69 71 + Source GLSL 460 + SourceExtension "GL_EXT_ray_query" + SourceExtension "GL_EXT_ray_tracing" + SourceExtension "GL_NV_linear_swept_spheres" + SourceExtension "GL_NV_shader_invocation_reorder" + Name 4 "main" + Name 9 "pos" + Name 12 "hObj" + Name 15 "rad" + Name 21 "lss_pos" + Name 25 "lss_rad" + Name 29 "isSphereHit" + Name 31 "isLSSHit" + Name 35 "rq" + Name 49 "hitVal" + Name 57 "gl_HitSpherePositionNV" + Name 60 "gl_HitSphereRadiusNV" + Name 63 "gl_HitLSSPositionsNV" + Name 66 "gl_HitLSSRadiiNV" + Name 69 "gl_HitIsSphereNV" + Name 71 "gl_HitIsLSSNV" + Decorate 57(gl_HitSpherePositionNV) BuiltIn HitSpherePositionNV + Decorate 60(gl_HitSphereRadiusNV) BuiltIn HitSphereRadiusNV + Decorate 63(gl_HitLSSPositionsNV) BuiltIn HitLSSPositionsNV + Decorate 66(gl_HitLSSRadiiNV) BuiltIn HitLLSSRadiiNV + Decorate 69(gl_HitIsSphereNV) BuiltIn HitIsSphereNV + Decorate 71(gl_HitIsLSSNV) BuiltIn HitIsLSSNV + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 3 + 8: TypePointer Function 7(fvec3) + 10: TypeHitObjectNV + 11: TypePointer Private 10 + 12(hObj): 11(ptr) Variable Private + 14: TypePointer Function 6(float) + 17: TypeInt 32 0 + 18: 17(int) Constant 2 + 19: TypeArray 7(fvec3) 18 + 20: TypePointer Function 19 + 23: TypeArray 6(float) 18 + 24: TypePointer Function 23 + 27: TypeBool + 28: TypePointer Function 27(bool) + 33: TypeRayQueryKHR + 34: TypePointer Private 33 + 35(rq): 34(ptr) Variable Private + 36: 27(bool) ConstantTrue + 37: TypeInt 32 1 + 38: 37(int) Constant 1 + 40: 27(bool) ConstantFalse + 41: 37(int) Constant 0 + 56: TypePointer Input 7(fvec3) +57(gl_HitSpherePositionNV): 56(ptr) Variable Input + 59: TypePointer Input 6(float) +60(gl_HitSphereRadiusNV): 59(ptr) Variable Input + 62: TypePointer Input 19 +63(gl_HitLSSPositionsNV): 62(ptr) Variable Input + 65: TypePointer Input 23 +66(gl_HitLSSRadiiNV): 65(ptr) Variable Input + 68: TypePointer Input 27(bool) +69(gl_HitIsSphereNV): 68(ptr) Variable Input +71(gl_HitIsLSSNV): 68(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 9(pos): 8(ptr) Variable Function + 15(rad): 14(ptr) Variable Function + 21(lss_pos): 20(ptr) Variable Function + 25(lss_rad): 24(ptr) Variable Function + 29(isSphereHit): 28(ptr) Variable Function + 31(isLSSHit): 28(ptr) Variable Function + 49(hitVal): 14(ptr) Variable Function + 13: 7(fvec3) HitObjectGetSpherePositionNV 12(hObj) + Store 9(pos) 13 + 16: 6(float) HitObjectGetSphereRadiusNV 12(hObj) + Store 15(rad) 16 + 22: 19 HitObjectGetLSSPositionsNV 12(hObj) + Store 21(lss_pos) 22 + 26: 23 HitObjectGetLSSRadiiNV 12(hObj) + Store 25(lss_rad) 26 + 30: 27(bool) HitObjectIsSphereHitNV 12(hObj) + Store 29(isSphereHit) 30 + 32: 27(bool) HitObjectIsLSSHitNV 12(hObj) + Store 31(isLSSHit) 32 + 39: 7(fvec3) RayQueryGetIntersectionSpherePositionNV 35(rq) 38 + Store 9(pos) 39 + 42: 7(fvec3) RayQueryGetIntersectionSpherePositionNV 35(rq) 41 + Store 9(pos) 42 + 43: 6(float) RayQueryGetIntersectionSphereRadiusNV 35(rq) 38 + Store 15(rad) 43 + 44: 6(float) RayQueryGetIntersectionSphereRadiusNV 35(rq) 41 + Store 15(rad) 44 + 45: 19 RayQueryGetIntersectionLSSPositionsNV 35(rq) 38 + Store 21(lss_pos) 45 + 46: 19 RayQueryGetIntersectionLSSPositionsNV 35(rq) 41 + Store 21(lss_pos) 46 + 47: 23 RayQueryGetIntersectionLSSRadiiNV 35(rq) 38 + Store 25(lss_rad) 47 + 48: 23 RayQueryGetIntersectionLSSRadiiNV 35(rq) 41 + Store 25(lss_rad) 48 + 50: 6(float) RayQueryGetIntersectionLSSHitValueNV 35(rq) 38 + Store 49(hitVal) 50 + 51: 6(float) RayQueryGetIntersectionLSSHitValueNV 35(rq) 41 + Store 49(hitVal) 51 + 52: 27(bool) RayQueryIsSphereHitNV 35(rq) 38 + Store 29(isSphereHit) 52 + 53: 27(bool) RayQueryIsSphereHitNV 35(rq) 41 + Store 29(isSphereHit) 53 + 54: 27(bool) RayQueryIsLSSHitNV 35(rq) 38 + Store 31(isLSSHit) 54 + 55: 27(bool) RayQueryIsLSSHitNV 35(rq) 41 + Store 31(isLSSHit) 55 + 58: 7(fvec3) Load 57(gl_HitSpherePositionNV) + Store 9(pos) 58 + 61: 6(float) Load 60(gl_HitSphereRadiusNV) + Store 15(rad) 61 + 64: 19 Load 63(gl_HitLSSPositionsNV) + Store 21(lss_pos) 64 + 67: 23 Load 66(gl_HitLSSRadiiNV) + Store 25(lss_rad) 67 + 70: 27(bool) Load 69(gl_HitIsSphereNV) + Store 29(isSphereHit) 70 + 72: 27(bool) Load 71(gl_HitIsLSSNV) + Store 31(isLSSHit) 72 + Return + FunctionEnd diff --git a/Test/baseResults/spv.nv.lss-allops.rgen.out b/Test/baseResults/spv.nv.lss-allops.rgen.out new file mode 100644 index 0000000000..8336a590bd --- /dev/null +++ b/Test/baseResults/spv.nv.lss-allops.rgen.out @@ -0,0 +1,108 @@ +spv.nv.lss-allops.rgen +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 56 + + Capability RayQueryKHR + Capability RayTracingKHR + Capability ShaderInvocationReorderNV + Capability RayTracingSpheresGeometryNV + Capability RayTracingLinearSweptSpheresGeometryNV + Extension "SPV_KHR_ray_query" + Extension "SPV_KHR_ray_tracing" + Extension "SPV_NV_linear_swept_spheres" + Extension "SPV_NV_shader_invocation_reorder" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint RayGenerationKHR 4 "main" 12 35 + Source GLSL 460 + SourceExtension "GL_EXT_ray_query" + SourceExtension "GL_EXT_ray_tracing" + SourceExtension "GL_NV_linear_swept_spheres" + SourceExtension "GL_NV_shader_invocation_reorder" + Name 4 "main" + Name 9 "pos" + Name 12 "hObj" + Name 15 "rad" + Name 21 "lss_pos" + Name 25 "lss_rad" + Name 29 "isSphereHit" + Name 31 "isLSSHit" + Name 35 "rq" + Name 49 "hitVal" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 3 + 8: TypePointer Function 7(fvec3) + 10: TypeHitObjectNV + 11: TypePointer Private 10 + 12(hObj): 11(ptr) Variable Private + 14: TypePointer Function 6(float) + 17: TypeInt 32 0 + 18: 17(int) Constant 2 + 19: TypeArray 7(fvec3) 18 + 20: TypePointer Function 19 + 23: TypeArray 6(float) 18 + 24: TypePointer Function 23 + 27: TypeBool + 28: TypePointer Function 27(bool) + 33: TypeRayQueryKHR + 34: TypePointer Private 33 + 35(rq): 34(ptr) Variable Private + 36: 27(bool) ConstantTrue + 37: TypeInt 32 1 + 38: 37(int) Constant 1 + 40: 27(bool) ConstantFalse + 41: 37(int) Constant 0 + 4(main): 2 Function None 3 + 5: Label + 9(pos): 8(ptr) Variable Function + 15(rad): 14(ptr) Variable Function + 21(lss_pos): 20(ptr) Variable Function + 25(lss_rad): 24(ptr) Variable Function + 29(isSphereHit): 28(ptr) Variable Function + 31(isLSSHit): 28(ptr) Variable Function + 49(hitVal): 14(ptr) Variable Function + 13: 7(fvec3) HitObjectGetSpherePositionNV 12(hObj) + Store 9(pos) 13 + 16: 6(float) HitObjectGetSphereRadiusNV 12(hObj) + Store 15(rad) 16 + 22: 19 HitObjectGetLSSPositionsNV 12(hObj) + Store 21(lss_pos) 22 + 26: 23 HitObjectGetLSSRadiiNV 12(hObj) + Store 25(lss_rad) 26 + 30: 27(bool) HitObjectIsSphereHitNV 12(hObj) + Store 29(isSphereHit) 30 + 32: 27(bool) HitObjectIsLSSHitNV 12(hObj) + Store 31(isLSSHit) 32 + 39: 7(fvec3) RayQueryGetIntersectionSpherePositionNV 35(rq) 38 + Store 9(pos) 39 + 42: 7(fvec3) RayQueryGetIntersectionSpherePositionNV 35(rq) 41 + Store 9(pos) 42 + 43: 6(float) RayQueryGetIntersectionSphereRadiusNV 35(rq) 38 + Store 15(rad) 43 + 44: 6(float) RayQueryGetIntersectionSphereRadiusNV 35(rq) 41 + Store 15(rad) 44 + 45: 19 RayQueryGetIntersectionLSSPositionsNV 35(rq) 38 + Store 21(lss_pos) 45 + 46: 19 RayQueryGetIntersectionLSSPositionsNV 35(rq) 41 + Store 21(lss_pos) 46 + 47: 23 RayQueryGetIntersectionLSSRadiiNV 35(rq) 38 + Store 25(lss_rad) 47 + 48: 23 RayQueryGetIntersectionLSSRadiiNV 35(rq) 41 + Store 25(lss_rad) 48 + 50: 6(float) RayQueryGetIntersectionLSSHitValueNV 35(rq) 38 + Store 49(hitVal) 50 + 51: 6(float) RayQueryGetIntersectionLSSHitValueNV 35(rq) 41 + Store 49(hitVal) 51 + 52: 27(bool) RayQueryIsSphereHitNV 35(rq) 38 + Store 29(isSphereHit) 52 + 53: 27(bool) RayQueryIsSphereHitNV 35(rq) 41 + Store 29(isSphereHit) 53 + 54: 27(bool) RayQueryIsLSSHitNV 35(rq) 38 + Store 31(isLSSHit) 54 + 55: 27(bool) RayQueryIsLSSHitNV 35(rq) 41 + Store 31(isLSSHit) 55 + Return + FunctionEnd diff --git a/Test/baseResults/spv.nv.lss-allops.rmiss.out b/Test/baseResults/spv.nv.lss-allops.rmiss.out new file mode 100644 index 0000000000..f4787ee946 --- /dev/null +++ b/Test/baseResults/spv.nv.lss-allops.rmiss.out @@ -0,0 +1,108 @@ +spv.nv.lss-allops.rmiss +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 56 + + Capability RayQueryKHR + Capability RayTracingKHR + Capability ShaderInvocationReorderNV + Capability RayTracingSpheresGeometryNV + Capability RayTracingLinearSweptSpheresGeometryNV + Extension "SPV_KHR_ray_query" + Extension "SPV_KHR_ray_tracing" + Extension "SPV_NV_linear_swept_spheres" + Extension "SPV_NV_shader_invocation_reorder" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MissKHR 4 "main" 12 35 + Source GLSL 460 + SourceExtension "GL_EXT_ray_query" + SourceExtension "GL_EXT_ray_tracing" + SourceExtension "GL_NV_linear_swept_spheres" + SourceExtension "GL_NV_shader_invocation_reorder" + Name 4 "main" + Name 9 "pos" + Name 12 "hObj" + Name 15 "rad" + Name 21 "lss_pos" + Name 25 "lss_rad" + Name 29 "isSphereHit" + Name 31 "isLSSHit" + Name 35 "rq" + Name 49 "hitVal" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 3 + 8: TypePointer Function 7(fvec3) + 10: TypeHitObjectNV + 11: TypePointer Private 10 + 12(hObj): 11(ptr) Variable Private + 14: TypePointer Function 6(float) + 17: TypeInt 32 0 + 18: 17(int) Constant 2 + 19: TypeArray 7(fvec3) 18 + 20: TypePointer Function 19 + 23: TypeArray 6(float) 18 + 24: TypePointer Function 23 + 27: TypeBool + 28: TypePointer Function 27(bool) + 33: TypeRayQueryKHR + 34: TypePointer Private 33 + 35(rq): 34(ptr) Variable Private + 36: 27(bool) ConstantTrue + 37: TypeInt 32 1 + 38: 37(int) Constant 1 + 40: 27(bool) ConstantFalse + 41: 37(int) Constant 0 + 4(main): 2 Function None 3 + 5: Label + 9(pos): 8(ptr) Variable Function + 15(rad): 14(ptr) Variable Function + 21(lss_pos): 20(ptr) Variable Function + 25(lss_rad): 24(ptr) Variable Function + 29(isSphereHit): 28(ptr) Variable Function + 31(isLSSHit): 28(ptr) Variable Function + 49(hitVal): 14(ptr) Variable Function + 13: 7(fvec3) HitObjectGetSpherePositionNV 12(hObj) + Store 9(pos) 13 + 16: 6(float) HitObjectGetSphereRadiusNV 12(hObj) + Store 15(rad) 16 + 22: 19 HitObjectGetLSSPositionsNV 12(hObj) + Store 21(lss_pos) 22 + 26: 23 HitObjectGetLSSRadiiNV 12(hObj) + Store 25(lss_rad) 26 + 30: 27(bool) HitObjectIsSphereHitNV 12(hObj) + Store 29(isSphereHit) 30 + 32: 27(bool) HitObjectIsLSSHitNV 12(hObj) + Store 31(isLSSHit) 32 + 39: 7(fvec3) RayQueryGetIntersectionSpherePositionNV 35(rq) 38 + Store 9(pos) 39 + 42: 7(fvec3) RayQueryGetIntersectionSpherePositionNV 35(rq) 41 + Store 9(pos) 42 + 43: 6(float) RayQueryGetIntersectionSphereRadiusNV 35(rq) 38 + Store 15(rad) 43 + 44: 6(float) RayQueryGetIntersectionSphereRadiusNV 35(rq) 41 + Store 15(rad) 44 + 45: 19 RayQueryGetIntersectionLSSPositionsNV 35(rq) 38 + Store 21(lss_pos) 45 + 46: 19 RayQueryGetIntersectionLSSPositionsNV 35(rq) 41 + Store 21(lss_pos) 46 + 47: 23 RayQueryGetIntersectionLSSRadiiNV 35(rq) 38 + Store 25(lss_rad) 47 + 48: 23 RayQueryGetIntersectionLSSRadiiNV 35(rq) 41 + Store 25(lss_rad) 48 + 50: 6(float) RayQueryGetIntersectionLSSHitValueNV 35(rq) 38 + Store 49(hitVal) 50 + 51: 6(float) RayQueryGetIntersectionLSSHitValueNV 35(rq) 41 + Store 49(hitVal) 51 + 52: 27(bool) RayQueryIsSphereHitNV 35(rq) 38 + Store 29(isSphereHit) 52 + 53: 27(bool) RayQueryIsSphereHitNV 35(rq) 41 + Store 29(isSphereHit) 53 + 54: 27(bool) RayQueryIsLSSHitNV 35(rq) 38 + Store 31(isLSSHit) 54 + 55: 27(bool) RayQueryIsLSSHitNV 35(rq) 41 + Store 31(isLSSHit) 55 + Return + FunctionEnd diff --git a/Test/spv.nv.lss-allops.frag b/Test/spv.nv.lss-allops.frag new file mode 100644 index 0000000000..035c1dc9cf --- /dev/null +++ b/Test/spv.nv.lss-allops.frag @@ -0,0 +1,37 @@ +#version 460 +#extension GL_EXT_ray_tracing : enable +#extension GL_NV_linear_swept_spheres : enable +#extension GL_EXT_ray_query : enable +#extension GL_NV_shader_invocation_reorder : enable +void main() +{ + hitObjectNV hObj; + rayQueryEXT rq; + vec3 pos; + vec3 lss_pos[2]; + float rad; + float lss_rad[2]; + float hitVal; + bool isSphereHit, isLSSHit; + + pos = rayQueryGetIntersectionSpherePositionNV(rq, true); + pos = rayQueryGetIntersectionSpherePositionNV(rq, false); + + rad = rayQueryGetIntersectionSphereRadiusNV(rq, true); + rad = rayQueryGetIntersectionSphereRadiusNV(rq, false); + + rayQueryGetIntersectionLSSPositionsNV(rq, true, lss_pos); + rayQueryGetIntersectionLSSPositionsNV(rq, false, lss_pos); + + rayQueryGetIntersectionLSSRadiiNV(rq, true, lss_rad); + rayQueryGetIntersectionLSSRadiiNV(rq, false, lss_rad); + + hitVal = rayQueryGetIntersectionLSSHitValueNV(rq, true); + hitVal = rayQueryGetIntersectionLSSHitValueNV(rq, false); + + isSphereHit = rayQueryIsSphereHitNV(rq, true); + isSphereHit = rayQueryIsSphereHitNV(rq, false); + + isLSSHit = rayQueryIsLSSHitNV(rq, true); + isLSSHit = rayQueryIsLSSHitNV(rq, false); +} diff --git a/Test/spv.nv.lss-allops.rchit b/Test/spv.nv.lss-allops.rchit new file mode 100644 index 0000000000..35a903a8ff --- /dev/null +++ b/Test/spv.nv.lss-allops.rchit @@ -0,0 +1,56 @@ +#version 460 +#extension GL_EXT_ray_tracing : enable +#extension GL_NV_linear_swept_spheres : enable +#extension GL_EXT_ray_query : enable +#extension GL_NV_shader_invocation_reorder : enable +void main() +{ + hitObjectNV hObj; + rayQueryEXT rq; + vec3 pos; + vec3 lss_pos[2]; + float rad; + float lss_rad[2]; + float hitVal; + bool isSphereHit, isLSSHit; + + pos = hitObjectGetSpherePositionNV(hObj); + rad = hitObjectGetSphereRadiusNV(hObj); + + hitObjectGetLSSPositionsNV(hObj, lss_pos); + hitObjectGetLSSRadiiNV(hObj, lss_rad); + + isSphereHit = hitObjectIsSphereHitNV(hObj); + isLSSHit = hitObjectIsLSSHitNV(hObj); + + pos = rayQueryGetIntersectionSpherePositionNV(rq, true); + pos = rayQueryGetIntersectionSpherePositionNV(rq, false); + + rad = rayQueryGetIntersectionSphereRadiusNV(rq, true); + rad = rayQueryGetIntersectionSphereRadiusNV(rq, false); + + rayQueryGetIntersectionLSSPositionsNV(rq, true, lss_pos); + rayQueryGetIntersectionLSSPositionsNV(rq, false, lss_pos); + + rayQueryGetIntersectionLSSRadiiNV(rq, true, lss_rad); + rayQueryGetIntersectionLSSRadiiNV(rq, false, lss_rad); + + hitVal = rayQueryGetIntersectionLSSHitValueNV(rq, true); + hitVal = rayQueryGetIntersectionLSSHitValueNV(rq, false); + + isSphereHit = rayQueryIsSphereHitNV(rq, true); + isSphereHit = rayQueryIsSphereHitNV(rq, false); + + isLSSHit = rayQueryIsLSSHitNV(rq, true); + isLSSHit = rayQueryIsLSSHitNV(rq, false); + + pos = gl_HitSpherePositionNV; + rad = gl_HitSphereRadiusNV; + + lss_pos = gl_HitLSSPositionsNV; + lss_rad = gl_HitLSSRadiiNV; + + isSphereHit = gl_HitIsSphereNV; + isLSSHit = gl_HitIsLSSNV; + +} diff --git a/Test/spv.nv.lss-allops.rgen b/Test/spv.nv.lss-allops.rgen new file mode 100644 index 0000000000..c0801e1f3a --- /dev/null +++ b/Test/spv.nv.lss-allops.rgen @@ -0,0 +1,47 @@ +#version 460 +#extension GL_EXT_ray_tracing : enable +#extension GL_NV_linear_swept_spheres : enable +#extension GL_EXT_ray_query : enable +#extension GL_NV_shader_invocation_reorder : enable +void main() +{ + hitObjectNV hObj; + rayQueryEXT rq; + vec3 pos; + vec3 lss_pos[2]; + float rad; + float lss_rad[2]; + float hitVal; + bool isSphereHit, isLSSHit; + + pos = hitObjectGetSpherePositionNV(hObj); + rad = hitObjectGetSphereRadiusNV(hObj); + + hitObjectGetLSSPositionsNV(hObj, lss_pos); + hitObjectGetLSSRadiiNV(hObj, lss_rad); + + isSphereHit = hitObjectIsSphereHitNV(hObj); + isLSSHit = hitObjectIsLSSHitNV(hObj); + + pos = rayQueryGetIntersectionSpherePositionNV(rq, true); + pos = rayQueryGetIntersectionSpherePositionNV(rq, false); + + rad = rayQueryGetIntersectionSphereRadiusNV(rq, true); + rad = rayQueryGetIntersectionSphereRadiusNV(rq, false); + + rayQueryGetIntersectionLSSPositionsNV(rq, true, lss_pos); + rayQueryGetIntersectionLSSPositionsNV(rq, false, lss_pos); + + rayQueryGetIntersectionLSSRadiiNV(rq, true, lss_rad); + rayQueryGetIntersectionLSSRadiiNV(rq, false, lss_rad); + + hitVal = rayQueryGetIntersectionLSSHitValueNV(rq, true); + hitVal = rayQueryGetIntersectionLSSHitValueNV(rq, false); + + isSphereHit = rayQueryIsSphereHitNV(rq, true); + isSphereHit = rayQueryIsSphereHitNV(rq, false); + + isLSSHit = rayQueryIsLSSHitNV(rq, true); + isLSSHit = rayQueryIsLSSHitNV(rq, false); + +} diff --git a/Test/spv.nv.lss-allops.rmiss b/Test/spv.nv.lss-allops.rmiss new file mode 100644 index 0000000000..c0801e1f3a --- /dev/null +++ b/Test/spv.nv.lss-allops.rmiss @@ -0,0 +1,47 @@ +#version 460 +#extension GL_EXT_ray_tracing : enable +#extension GL_NV_linear_swept_spheres : enable +#extension GL_EXT_ray_query : enable +#extension GL_NV_shader_invocation_reorder : enable +void main() +{ + hitObjectNV hObj; + rayQueryEXT rq; + vec3 pos; + vec3 lss_pos[2]; + float rad; + float lss_rad[2]; + float hitVal; + bool isSphereHit, isLSSHit; + + pos = hitObjectGetSpherePositionNV(hObj); + rad = hitObjectGetSphereRadiusNV(hObj); + + hitObjectGetLSSPositionsNV(hObj, lss_pos); + hitObjectGetLSSRadiiNV(hObj, lss_rad); + + isSphereHit = hitObjectIsSphereHitNV(hObj); + isLSSHit = hitObjectIsLSSHitNV(hObj); + + pos = rayQueryGetIntersectionSpherePositionNV(rq, true); + pos = rayQueryGetIntersectionSpherePositionNV(rq, false); + + rad = rayQueryGetIntersectionSphereRadiusNV(rq, true); + rad = rayQueryGetIntersectionSphereRadiusNV(rq, false); + + rayQueryGetIntersectionLSSPositionsNV(rq, true, lss_pos); + rayQueryGetIntersectionLSSPositionsNV(rq, false, lss_pos); + + rayQueryGetIntersectionLSSRadiiNV(rq, true, lss_rad); + rayQueryGetIntersectionLSSRadiiNV(rq, false, lss_rad); + + hitVal = rayQueryGetIntersectionLSSHitValueNV(rq, true); + hitVal = rayQueryGetIntersectionLSSHitValueNV(rq, false); + + isSphereHit = rayQueryIsSphereHitNV(rq, true); + isSphereHit = rayQueryIsSphereHitNV(rq, false); + + isLSSHit = rayQueryIsLSSHitNV(rq, true); + isLSSHit = rayQueryIsLSSHitNV(rq, false); + +} diff --git a/glslang/Include/BaseTypes.h b/glslang/Include/BaseTypes.h index 044cf25666..1d33a69008 100644 --- a/glslang/Include/BaseTypes.h +++ b/glslang/Include/BaseTypes.h @@ -300,6 +300,13 @@ enum TBuiltInVariable { EbvHitKindFrontFacingMicroTriangleNV, EbvHitKindBackFacingMicroTriangleNV, + EbvHitIsSphereNV, + EbvHitIsLSSNV, + EbvHitSpherePositionNV, + EbvHitSphereRadiusNV, + EbvHitLSSPositionsNV, + EbvHitLSSRadiiNV, + //GL_EXT_mesh_shader EbvPrimitivePointIndicesEXT, EbvPrimitiveLineIndicesEXT, @@ -536,6 +543,13 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvHitKindFrontFacingMicroTriangleNV: return "HitKindFrontFacingMicroTriangleNV"; case EbvHitKindBackFacingMicroTriangleNV: return "HitKindBackFacingMicroTriangleNV"; + case EbvHitIsSphereNV: return "HitIsSphereNV"; + case EbvHitIsLSSNV: return "HitIsLSSNV"; + case EbvHitSpherePositionNV: return "HitSpherePositionNV"; + case EbvHitSphereRadiusNV: return "HitSphereRadiusNV"; + case EbvHitLSSPositionsNV: return "HitSpherePositionsNV"; + case EbvHitLSSRadiiNV: return "HitLSSRadiiNV"; + default: return "unknown built-in variable"; } } diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index 22fc6466fd..11f7b2a67b 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -971,6 +971,21 @@ enum TOperator { // GL_NV_cluster_acceleration_structure EOpRayQueryGetIntersectionClusterIdNV, EOpHitObjectGetClusterIdNV, + + // GL_NV_linear_swept_spheres + EOpRayQueryGetIntersectionSpherePositionNV, + EOpRayQueryGetIntersectionSphereRadiusNV, + EOpRayQueryGetIntersectionLSSHitValueNV, + EOpRayQueryGetIntersectionLSSPositionsNV, + EOpRayQueryGetIntersectionLSSRadiiNV, + EOpRayQueryIsSphereHitNV, + EOpRayQueryIsLSSHitNV, + EOpHitObjectGetSpherePositionNV, + EOpHitObjectGetSphereRadiusNV, + EOpHitObjectGetLSSPositionsNV, + EOpHitObjectGetLSSRadiiNV, + EOpHitObjectIsSphereHitNV, + EOpHitObjectIsLSSHitNV, }; inline bool IsOpNumericConv(const TOperator op) { diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 4b94039980..8aebdba4fa 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -5090,6 +5090,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "mat4x3 rayQueryGetIntersectionWorldToObjectEXT(rayQueryEXT, bool);" "void rayQueryGetIntersectionTriangleVertexPositionsEXT(rayQueryEXT, bool, out vec3[3]);" "int rayQueryGetIntersectionClusterIdNV(rayQueryEXT, bool);" + "vec3 rayQueryGetIntersectionSpherePositionNV(rayQueryEXT, bool);" + "float rayQueryGetIntersectionSphereRadiusNV(rayQueryEXT, bool);" + "float rayQueryGetIntersectionLSSHitValueNV(rayQueryEXT, bool);" + "void rayQueryGetIntersectionLSSPositionsNV(rayQueryEXT, bool, out vec3[2]);" + "void rayQueryGetIntersectionLSSRadiiNV(rayQueryEXT, bool, out float[2]);" + "bool rayQueryIsSphereHitNV(rayQueryEXT, bool);" + "bool rayQueryIsLSSHitNV(rayQueryEXT, bool);" "\n"); stageBuiltins[EShLangRayGen].append( @@ -5134,6 +5141,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void reorderThreadNV(hitObjectNV, uint, uint);" "vec3 fetchMicroTriangleVertexPositionNV(accelerationStructureEXT, int, int, int, ivec2);" "vec2 fetchMicroTriangleVertexBarycentricNV(accelerationStructureEXT, int, int, int, ivec2);" + "vec3 hitObjectGetSpherePositionNV(hitObjectNV);" + "float hitObjectGetSphereRadiusNV(hitObjectNV);" + "void hitObjectGetLSSPositionsNV(hitObjectNV, out vec3[2]);" + "void hitObjectGetLSSRadiiNV(hitObjectNV, out float[2]);" + "bool hitObjectIsSphereHitNV(hitObjectNV);" + "bool hitObjectIsLSSHitNV(hitObjectNV);" "\n"); stageBuiltins[EShLangIntersect].append( "bool reportIntersectionNV(float, uint);" @@ -5180,6 +5193,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);" "uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);" "int hitObjectGetClusterIdNV(hitObjectNV);" + "vec3 hitObjectGetSpherePositionNV(hitObjectNV);" + "float hitObjectGetSphereRadiusNV(hitObjectNV);" + "void hitObjectGetLSSPositionsNV(hitObjectNV, out vec3[2]);" + "void hitObjectGetLSSRadiiNV(hitObjectNV, out float[2]);" + "bool hitObjectIsSphereHitNV(hitObjectNV);" + "bool hitObjectIsLSSHitNV(hitObjectNV);" "\n"); stageBuiltins[EShLangMiss].append( "void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" @@ -5218,6 +5237,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);" "uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);" "int hitObjectGetClusterIdNV(hitObjectNV);" + "vec3 hitObjectGetSpherePositionNV(hitObjectNV);" + "float hitObjectGetSphereRadiusNV(hitObjectNV);" + "void hitObjectGetLSSPositionsNV(hitObjectNV, out vec3[2]);" + "void hitObjectGetLSSRadiiNV(hitObjectNV, out float[2]);" + "bool hitObjectIsSphereHitNV(hitObjectNV);" + "bool hitObjectIsLSSHitNV(hitObjectNV);" "\n"); stageBuiltins[EShLangCallable].append( "void executeCallableNV(uint, int);" @@ -6446,6 +6471,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "const uint gl_RayFlagsCullNoOpaqueNV = 128U;" "const uint gl_RayFlagsCullNoOpaqueEXT = 128U;" "const uint gl_RayFlagsSkipTrianglesEXT = 256U;" + "const uint gl_RayFlagsSkipBuiltinPrimitivesNV = 256U;" "const uint gl_RayFlagsSkipAABBEXT = 512U;" "const uint gl_RayFlagsForceOpacityMicromap2StateEXT = 1024U;" "const uint gl_HitKindFrontFacingTriangleEXT = 254U;" @@ -6544,6 +6570,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in vec3 gl_HitMicroTriangleVertexPositionsNV[3];" "in vec2 gl_HitMicroTriangleVertexBarycentricsNV[3];" "in int gl_ClusterIDNV;" + "in bool gl_HitIsSphereNV;" + "in bool gl_HitIsLSSNV;" + "in vec3 gl_HitSpherePositionNV;" + "in float gl_HitSphereRadiusNV;" + "in vec3 gl_HitLSSPositionsNV[2];" + "in float gl_HitLSSRadiiNV[2];" "\n"; const char *missDecls = @@ -8733,6 +8765,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("rayQueryGetWorldRayDirectionEXT", 1, &E_GL_EXT_ray_query); symbolTable.setFunctionExtensions("rayQueryGetIntersectionTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch); symbolTable.setFunctionExtensions("rayQueryGetIntersectionClusterIdNV", 1, &E_GL_NV_cluster_acceleration_structure); + symbolTable.setFunctionExtensions("rayQueryGetIntersectionSpherePositionNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("rayQueryGetIntersectionSphereRadiusNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("rayQueryGetIntersectionLSSHitValueNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("rayQueryGetIntersectionLSSPositionsNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("rayQueryGetIntersectionLSSRadiiNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("rayQueryIsSphereHitNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("rayQueryIsLSSHitNV", 1, &E_GL_NV_linear_swept_spheres); symbolTable.setVariableExtensions("gl_RayFlagsSkipAABBEXT", 1, &E_GL_EXT_ray_flags_primitive_culling); symbolTable.setVariableExtensions("gl_RayFlagsSkipTrianglesEXT", 1, &E_GL_EXT_ray_flags_primitive_culling); symbolTable.setVariableExtensions("gl_RayFlagsForceOpacityMicromap2StateEXT", 1, &E_GL_EXT_opacity_micromap); @@ -9508,6 +9547,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_HitMicroTriangleVertexPositionsNV", 1, &E_GL_NV_displacement_micromap); symbolTable.setVariableExtensions("gl_HitMicroTriangleVertexBarycentricsNV", 1, &E_GL_NV_displacement_micromap); symbolTable.setVariableExtensions("gl_ClusterIDNV", 1, &E_GL_NV_cluster_acceleration_structure); + symbolTable.setVariableExtensions("gl_HitKindSphereNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setVariableExtensions("gl_HitKindLSSNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setVariableExtensions("gl_HitSpherePositionNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setVariableExtensions("gl_HitSphereRadiusNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setVariableExtensions("gl_HitLSSPositionNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setVariableExtensions("gl_HitLSSRadiiNV", 1, &E_GL_NV_linear_swept_spheres); symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); @@ -9556,6 +9601,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("reorderThreadNV", 1, &E_GL_NV_shader_invocation_reorder); symbolTable.setFunctionExtensions("fetchMicroTriangleVertexPositionNV", 1, &E_GL_NV_displacement_micromap); symbolTable.setFunctionExtensions("fetchMicroTriangleVertexBarycentricNV", 1, &E_GL_NV_displacement_micromap); + symbolTable.setFunctionExtensions("hitObjectGetSpherePositionNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("hitObjectGetSphereRadiusNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("hitObjectGetLSSPositionsNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("hitObjectGetLSSRadiiNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("hitObjectIsSphereHitNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("hitObjectIsLSSHitNV", 1, &E_GL_NV_linear_swept_spheres); BuiltInVariable("gl_LaunchIDNV", EbvLaunchId, symbolTable); @@ -9598,6 +9649,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_HitKindFrontFacingMicroTriangleNV", EbvHitKindFrontFacingMicroTriangleNV, symbolTable); BuiltInVariable("gl_HitKindBackFacingMicroTriangleNV", EbvHitKindBackFacingMicroTriangleNV, symbolTable); BuiltInVariable("gl_ClusterIDNV", EbvClusterIDNV, symbolTable); + BuiltInVariable("gl_HitIsSphereNV", EbvHitIsSphereNV, symbolTable); + BuiltInVariable("gl_HitIsLSSNV", EbvHitIsLSSNV, symbolTable); + BuiltInVariable("gl_HitSpherePositionNV", EbvHitSpherePositionNV, symbolTable); + BuiltInVariable("gl_HitSphereRadiusNV", EbvHitSphereRadiusNV, symbolTable); + BuiltInVariable("gl_HitLSSPositionsNV", EbvHitLSSPositionsNV, symbolTable); + BuiltInVariable("gl_HitLSSRadiiNV", EbvHitLSSRadiiNV, symbolTable); // gl_HitT variables are aliases of their gl_RayTmax counterparts. RetargetVariable("gl_HitTNV", "gl_RayTmaxNV", symbolTable); @@ -10588,6 +10645,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("rayQueryGetIntersectionWorldToObjectEXT", EOpRayQueryGetIntersectionWorldToObject); symbolTable.relateToOperator("rayQueryGetIntersectionTriangleVertexPositionsEXT", EOpRayQueryGetIntersectionTriangleVertexPositionsEXT); symbolTable.relateToOperator("rayQueryGetIntersectionClusterIdNV", EOpRayQueryGetIntersectionClusterIdNV); + symbolTable.relateToOperator("rayQueryGetIntersectionSpherePositionNV", EOpRayQueryGetIntersectionSpherePositionNV); + symbolTable.relateToOperator("rayQueryGetIntersectionSphereRadiusNV", EOpRayQueryGetIntersectionSphereRadiusNV); + symbolTable.relateToOperator("rayQueryGetIntersectionLSSHitValueNV", EOpRayQueryGetIntersectionLSSHitValueNV); + symbolTable.relateToOperator("rayQueryGetIntersectionLSSPositionsNV", EOpRayQueryGetIntersectionLSSPositionsNV); + symbolTable.relateToOperator("rayQueryGetIntersectionLSSRadiiNV", EOpRayQueryGetIntersectionLSSRadiiNV); + symbolTable.relateToOperator("rayQueryIsSphereHitNV", EOpRayQueryIsSphereHitNV); + symbolTable.relateToOperator("rayQueryIsLSSHitNV", EOpRayQueryIsLSSHitNV); } symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid); @@ -10700,6 +10764,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("hitObjectGetShaderRecordBufferHandleNV", EOpHitObjectGetShaderRecordBufferHandleNV); symbolTable.relateToOperator("hitObjectGetClusterIdNV", EOpHitObjectGetClusterIdNV); symbolTable.relateToOperator("reorderThreadNV", EOpReorderThreadNV); + symbolTable.relateToOperator("hitObjectGetSpherePositionNV", EOpHitObjectGetSpherePositionNV); + symbolTable.relateToOperator("hitObjectGetSphereRadiusNV", EOpHitObjectGetSphereRadiusNV); + symbolTable.relateToOperator("hitObjectGetLSSPositionsNV", EOpHitObjectGetLSSPositionsNV); + symbolTable.relateToOperator("hitObjectGetLSSRadiiNV", EOpHitObjectGetLSSRadiiNV); + symbolTable.relateToOperator("hitObjectIsSphereHitNV", EOpHitObjectIsSphereHitNV); + symbolTable.relateToOperator("hitObjectIsLSSHitNV", EOpHitObjectIsLSSHitNV); } break; case EShLangIntersect: diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 6c24c73184..0992366473 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -2775,6 +2775,11 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan case EOpRayQueryGetIntersectionWorldToObject: case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: case EOpRayQueryGetIntersectionClusterIdNV: + case EOpRayQueryGetIntersectionSpherePositionNV: + case EOpRayQueryGetIntersectionSphereRadiusNV: + case EOpRayQueryGetIntersectionLSSHitValueNV: + case EOpRayQueryGetIntersectionLSSPositionsNV: + case EOpRayQueryGetIntersectionLSSRadiiNV: if (!(*argp)[1]->getAsConstantUnion()) error(loc, "argument must be compile-time constant", "committed", ""); break; diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 300da73a50..4e4246aa3a 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -314,6 +314,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_NV_shader_atomic_fp16_vector] = EBhDisable; extensionBehavior[E_GL_NV_cooperative_matrix2] = EBhDisable; extensionBehavior[E_GL_NV_cluster_acceleration_structure] = EBhDisable; + extensionBehavior[E_GL_NV_linear_swept_spheres] = EBhDisable; // ARM extensionBehavior[E_GL_ARM_shader_core_builtins] = EBhDisable; diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 551258a4eb..b7e2ba1dd5 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -288,6 +288,7 @@ const char* const E_GL_NV_shader_atomic_fp16_vector = "GL_NV_shader_ const char* const E_GL_NV_cooperative_matrix2 = "GL_NV_cooperative_matrix2"; const char* const E_GL_NV_cooperative_vector = "GL_NV_cooperative_vector"; const char* const E_GL_NV_cluster_acceleration_structure = "GL_NV_cluster_acceleration_structure"; +const char* const E_GL_NV_linear_swept_spheres = "GL_NV_linear_swept_spheres"; // ARM const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins"; diff --git a/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp index 8d4f0bb1a1..9415547d61 100644 --- a/glslang/MachineIndependent/intermOut.cpp +++ b/glslang/MachineIndependent/intermOut.cpp @@ -944,6 +944,13 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpRayQueryGetIntersectionWorldToObject: out.debug << "rayQueryGetIntersectionWorldToObjectEXT"; break; case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: out.debug << "rayQueryGetIntersectionTriangleVertexPositionsEXT"; break; case EOpRayQueryGetIntersectionClusterIdNV: out.debug << "rayQueryGetIntersectionClusterIdNV"; break; + case EOpRayQueryGetIntersectionSpherePositionNV: out.debug << "rayQueryGetIntersectionSpherePositionNV"; break; + case EOpRayQueryGetIntersectionSphereRadiusNV: out.debug << "rayQueryGetIntersectionSphereRadiusNV"; break; + case EOpRayQueryGetIntersectionLSSHitValueNV: out.debug << "rayQueryGetIntersectionLSSHitValueNV"; break; + case EOpRayQueryGetIntersectionLSSPositionsNV: out.debug << "rayQueryGetIntersectionLSSPositionsNV"; break; + case EOpRayQueryGetIntersectionLSSRadiiNV: out.debug << "rayQueryGetIntersectionLSSRadiiNV"; break; + case EOpRayQueryIsSphereHitNV: out.debug << "rayQueryIsSphereHitNV"; break; + case EOpRayQueryIsLSSHitNV: out.debug << "rayQueryIsLSSHitNV"; break; case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix KHR"; break; case EOpCooperativeMatrixStore: out.debug << "Store cooperative matrix KHR"; break; @@ -1001,6 +1008,12 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpReorderThreadNV: out.debug << "ReorderThreadNV"; break; case EOpFetchMicroTriangleVertexPositionNV: out.debug << "MicroTriangleVertexPositionNV"; break; case EOpFetchMicroTriangleVertexBarycentricNV: out.debug << "MicroTriangleVertexBarycentricNV"; break; + case EOpHitObjectGetSpherePositionNV: out.debug << "HitObjectGetSpherePositionNV"; break; + case EOpHitObjectGetSphereRadiusNV: out.debug << "HitObjectGetSphereRadiusNV"; break; + case EOpHitObjectGetLSSPositionsNV: out.debug << "HitObjectGetLSSPositionsNV"; break; + case EOpHitObjectGetLSSRadiiNV: out.debug << "HitObjectGetLSSRadiiNV"; break; + case EOpHitObjectIsSphereHitNV: out.debug << "HitObjectIsSphereHitNV"; break; + case EOpHitObjectIsLSSHitNV: out.debug << "HitObjectIsLSSHitNV"; break; case EOpSpirvInst: out.debug << "spirv_instruction"; break; case EOpStencilAttachmentReadEXT: out.debug << "stencilAttachmentReadEXT"; break; diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index ae8ae80f6b..7e63a7d05b 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -750,6 +750,13 @@ INSTANTIATE_TEST_SUITE_P( "spv.nv.cluster-allops.rahit", "spv.nv.cluster-allops.frag", + // SPV_NV_linear_swept_spheres + + "spv.nv.lss-allops.rgen", + "spv.nv.lss-allops.rchit", + "spv.nv.lss-allops.rmiss", + "spv.nv.lss-allops.frag", + })), FileNameAsCustomTestSuffix ); diff --git a/known_good.json b/known_good.json index 1563565da6..1cb0b253e0 100644 --- a/known_good.json +++ b/known_good.json @@ -5,14 +5,14 @@ "site" : "github", "subrepo" : "KhronosGroup/SPIRV-Tools", "subdir" : "External/spirv-tools", - "commit": "7cf95f1d50e1ac7b226697f6efe56734a4dce7ad" + "commit": "ce37fd67f83cd1e8793b988d2e4126bbf72b19dd" }, { "name" : "spirv-tools/external/spirv-headers", "site" : "github", "subrepo" : "KhronosGroup/SPIRV-Headers", "subdir" : "External/spirv-tools/external/spirv-headers", - "commit" : "003bcf4e0d1922fb45e9b07656ee3db7c156a675" + "commit" : "e7294a8ebed84f8c5bd3686c68dbe12a4e65b644" }, { "name": "googletest",