GL_EXT_ray_tracing_position_fetch

This commit is contained in:
Eric Werness 2022-06-08 17:29:38 -07:00 committed by arcady-lunarg
parent d6e9d3bb4e
commit 9d8c7b75c9
18 changed files with 461 additions and 194 deletions

View File

@ -54,5 +54,6 @@ static const char* const E_SPV_KHR_workgroup_memory_explicit_layout = "SPV_KHR_w
static const char* const E_SPV_KHR_subgroup_uniform_control_flow = "SPV_KHR_subgroup_uniform_control_flow";
static const char* const E_SPV_KHR_fragment_shader_barycentric = "SPV_KHR_fragment_shader_barycentric";
static const char* const E_SPV_AMD_shader_early_and_late_fragment_tests = "SPV_AMD_shader_early_and_late_fragment_tests";
static const char* const E_SPV_KHR_ray_tracing_position_fetch = "SPV_KHR_ray_tracing_position_fetch";
#endif // #ifndef GLSLextKHR_H

38
SPIRV/GlslangToSpv.cpp Normal file → Executable file
View File

@ -1010,6 +1010,8 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
return spv::BuiltInRayTmaxKHR;
case glslang::EbvCullMask:
return spv::BuiltInCullMaskKHR;
case glslang::EbvPositionFetch:
return spv::BuiltInHitTriangleVertexPositionsKHR;
case glslang::EbvInstanceCustomIndex:
return spv::BuiltInInstanceCustomIndexKHR;
case glslang::EbvHitT:
@ -1857,12 +1859,15 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
builder.addCapability(spv::CapabilityRayTracingNV);
builder.addExtension("SPV_NV_ray_tracing");
}
if (glslangIntermediate->getStage() != EShLangRayGen && glslangIntermediate->getStage() != EShLangCallable)
{
if (glslangIntermediate->getStage() != EShLangRayGen && glslangIntermediate->getStage() != EShLangCallable) {
if (extensions.find("GL_EXT_ray_cull_mask") != extensions.end()) {
builder.addCapability(spv::CapabilityRayCullMaskKHR);
builder.addExtension("SPV_KHR_ray_cull_mask");
}
if (extensions.find("GL_EXT_ray_tracing_position_fetch") != extensions.end()) {
builder.addCapability(spv::CapabilityRayTracingPositionFetchKHR);
builder.addExtension("SPV_KHR_ray_tracing_position_fetch");
}
}
break;
}
@ -3301,6 +3306,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
builder.addExtension(spv::E_SPV_NV_shader_invocation_reorder);
builder.addCapability(spv::CapabilityShaderInvocationReorderNV);
break;
case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
builder.addExtension(spv::E_SPV_KHR_ray_tracing_position_fetch);
builder.addCapability(spv::CapabilityRayQueryPositionFetchKHR);
noReturnValue = true;
break;
#endif
case glslang::EOpDebugPrintf:
@ -3479,6 +3489,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
if (arg == 0 && glslangOperands.size() != 2)
lvalue = true;
break;
case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
if (arg == 0 || arg == 2)
lvalue = true;
break;
#endif
default:
break;
@ -3571,7 +3585,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayDirection ||
glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayOrigin ||
glslangOp == glslang::EOpRayQueryGetIntersectionObjectToWorld ||
glslangOp == glslang::EOpRayQueryGetIntersectionWorldToObject
glslangOp == glslang::EOpRayQueryGetIntersectionWorldToObject ||
glslangOp == glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT
)) {
bool cond = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getBConst();
operands.push_back(builder.makeIntConstant(cond ? 1 : 0));
@ -3637,6 +3652,19 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
builder.createNoResultOp(spv::OpCooperativeMatrixStoreNV, idImmOps);
result = 0;
} else if (node->getOp() == glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT) {
std::vector<spv::IdImmediate> 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(3), 0);
// do the op
spv::Id result = builder.createOp(spv::OpRayQueryGetIntersectionTriangleVertexPositionsKHR, typeId, idImmOps);
// store the result to the pointer (out param 'm')
builder.createStore(result, operands[2]);
result = 0;
} else
#endif
if (atomic) {
@ -5561,6 +5589,10 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
if (i == 7)
lvalue = true;
break;
case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
if (i == 2)
lvalue = true;
break;
default:
break;
}

8
SPIRV/doc.cpp Normal file → Executable file
View File

@ -404,6 +404,7 @@ const char* BuiltInString(int builtIn)
case BuiltInRayTminKHR: return "RayTminKHR";
case BuiltInRayTmaxKHR: return "RayTmaxKHR";
case BuiltInCullMaskKHR: return "CullMaskKHR";
case BuiltInHitTriangleVertexPositionsKHR: return "HitTriangleVertexPositionsKHR";
case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR";
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
@ -950,6 +951,8 @@ const char* CapabilityString(int info)
case CapabilityRayQueryKHR: return "RayQueryKHR";
case CapabilityRayTracingProvisionalKHR: return "RayTracingProvisionalKHR";
case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
case CapabilityRayTracingPositionFetchKHR: return "RayTracingPositionFetchKHR";
case CapabilityRayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR";
case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV";
case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV";
case CapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR";
@ -1452,6 +1455,7 @@ const char* OpcodeString(int op)
case OpRayQueryGetWorldRayOriginKHR: return "OpRayQueryGetWorldRayOriginKHR";
case OpRayQueryGetIntersectionObjectToWorldKHR: return "OpRayQueryGetIntersectionObjectToWorldKHR";
case OpRayQueryGetIntersectionWorldToObjectKHR: return "OpRayQueryGetIntersectionWorldToObjectKHR";
case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: return "OpRayQueryGetIntersectionTriangleVertexPositionsKHR";
case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
@ -3025,6 +3029,10 @@ void Parameterize()
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionTriangleVertexPositionsKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionTriangleVertexPositionsKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].setResultAndType(true, true);
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'");
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'");
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Granularity'");

View File

@ -26,7 +26,7 @@
// the Binary Section of the SPIR-V specification.
// Enumeration tokens for SPIR-V, in various styles:
// C, C++, C++11, JSON, Lua, Python, C#, D
// C, C++, C++11, JSON, Lua, Python, C#, D, Beef
//
// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL
// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL
@ -36,6 +36,8 @@
// - C# will use enum classes in the Specification class located in the "Spv" namespace,
// e.g.: Spv.Specification.SourceLanguage.GLSL
// - D will have tokens under the "spv" module, e.g: spv.SourceLanguage.GLSL
// - Beef will use enum classes in the Specification class located in the "Spv" namespace,
// e.g.: Spv.Specification.SourceLanguage.GLSL
//
// Some tokens act like mask values, which can be OR'd together,
// while others are mutually exclusive. The mask-like ones have
@ -66,6 +68,7 @@ enum SourceLanguage {
SourceLanguageOpenCL_CPP = 4,
SourceLanguageHLSL = 5,
SourceLanguageCPP_for_OpenCL = 6,
SourceLanguageSYCL = 7,
SourceLanguageMax = 0x7fffffff,
};
@ -192,6 +195,8 @@ enum ExecutionMode {
ExecutionModeNoGlobalOffsetINTEL = 5895,
ExecutionModeNumSIMDWorkitemsINTEL = 5896,
ExecutionModeSchedulerTargetFmaxMhzINTEL = 5903,
ExecutionModeStreamingInterfaceINTEL = 6154,
ExecutionModeNamedBarrierCountINTEL = 6417,
ExecutionModeMax = 0x7fffffff,
};
@ -449,6 +454,7 @@ enum FunctionParameterAttribute {
FunctionParameterAttributeNoCapture = 5,
FunctionParameterAttributeNoWrite = 6,
FunctionParameterAttributeNoReadWrite = 7,
FunctionParameterAttributeRuntimeAlignedINTEL = 5940,
FunctionParameterAttributeMax = 0x7fffffff,
};
@ -558,12 +564,27 @@ enum Decoration {
DecorationPrefetchINTEL = 5902,
DecorationStallEnableINTEL = 5905,
DecorationFuseLoopsInFunctionINTEL = 5907,
DecorationMathOpDSPModeINTEL = 5909,
DecorationAliasScopeINTEL = 5914,
DecorationNoAliasINTEL = 5915,
DecorationInitiationIntervalINTEL = 5917,
DecorationMaxConcurrencyINTEL = 5918,
DecorationPipelineEnableINTEL = 5919,
DecorationBufferLocationINTEL = 5921,
DecorationIOPipeStorageINTEL = 5944,
DecorationFunctionFloatingPointModeINTEL = 6080,
DecorationSingleElementVectorINTEL = 6085,
DecorationVectorComputeCallableFunctionINTEL = 6087,
DecorationMediaBlockIOINTEL = 6140,
DecorationConduitKernelArgumentINTEL = 6175,
DecorationRegisterMapKernelArgumentINTEL = 6176,
DecorationMMHostInterfaceAddressWidthINTEL = 6177,
DecorationMMHostInterfaceDataWidthINTEL = 6178,
DecorationMMHostInterfaceLatencyINTEL = 6179,
DecorationMMHostInterfaceReadWriteModeINTEL = 6180,
DecorationMMHostInterfaceMaxBurstINTEL = 6181,
DecorationMMHostInterfaceWaitRequestINTEL = 6182,
DecorationStableKernelArgumentINTEL = 6183,
DecorationMax = 0x7fffffff,
};
@ -609,8 +630,8 @@ enum BuiltIn {
BuiltInSubgroupLocalInvocationId = 41,
BuiltInVertexIndex = 42,
BuiltInInstanceIndex = 43,
BuiltInCoreCountARM = 4161,
BuiltInCoreIDARM = 4160,
BuiltInCoreCountARM = 4161,
BuiltInCoreMaxIDARM = 4162,
BuiltInWarpIDARM = 4163,
BuiltInWarpMaxIDARM = 4164,
@ -691,6 +712,7 @@ enum BuiltIn {
BuiltInHitKindKHR = 5333,
BuiltInHitKindNV = 5333,
BuiltInCurrentRayTimeNV = 5334,
BuiltInHitTriangleVertexPositionsKHR = 5335,
BuiltInIncomingRayFlagsKHR = 5351,
BuiltInIncomingRayFlagsNV = 5351,
BuiltInRayGeometryIndexKHR = 5352,
@ -732,6 +754,8 @@ enum LoopControlShift {
LoopControlMaxInterleavingINTELShift = 21,
LoopControlSpeculatedIterationsINTELShift = 22,
LoopControlNoFusionINTELShift = 23,
LoopControlLoopCountINTELShift = 24,
LoopControlMaxReinvocationDelayINTELShift = 25,
LoopControlMax = 0x7fffffff,
};
@ -754,6 +778,8 @@ enum LoopControlMask {
LoopControlMaxInterleavingINTELMask = 0x00200000,
LoopControlSpeculatedIterationsINTELMask = 0x00400000,
LoopControlNoFusionINTELMask = 0x00800000,
LoopControlLoopCountINTELMask = 0x01000000,
LoopControlMaxReinvocationDelayINTELMask = 0x02000000,
};
enum FunctionControlShift {
@ -826,6 +852,8 @@ enum MemoryAccessShift {
MemoryAccessMakePointerVisibleKHRShift = 4,
MemoryAccessNonPrivatePointerShift = 5,
MemoryAccessNonPrivatePointerKHRShift = 5,
MemoryAccessAliasScopeINTELMaskShift = 16,
MemoryAccessNoAliasINTELMaskShift = 17,
MemoryAccessMax = 0x7fffffff,
};
@ -840,6 +868,8 @@ enum MemoryAccessMask {
MemoryAccessMakePointerVisibleKHRMask = 0x00000010,
MemoryAccessNonPrivatePointerMask = 0x00000020,
MemoryAccessNonPrivatePointerKHRMask = 0x00000020,
MemoryAccessAliasScopeINTELMaskMask = 0x00010000,
MemoryAccessNoAliasINTELMaskMask = 0x00020000,
};
enum Scope {
@ -1033,6 +1063,7 @@ enum Capability {
CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311,
CapabilityStorageTexelBufferArrayNonUniformIndexing = 5312,
CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312,
CapabilityRayTracingPositionFetchKHR = 5336,
CapabilityRayTracingNV = 5340,
CapabilityRayTracingMotionBlurNV = 5341,
CapabilityVulkanMemoryModel = 5345,
@ -1050,8 +1081,10 @@ enum Capability {
CapabilityFragmentShaderPixelInterlockEXT = 5378,
CapabilityDemoteToHelperInvocation = 5379,
CapabilityDemoteToHelperInvocationEXT = 5379,
CapabilityRayTracingOpacityMicromapEXT = 5381,
CapabilityShaderInvocationReorderNV = 5383,
CapabilityBindlessTextureNV = 5390,
CapabilityRayQueryPositionFetchKHR = 5391,
CapabilitySubgroupShuffleINTEL = 5568,
CapabilitySubgroupBufferBlockIOINTEL = 5569,
CapabilitySubgroupImageBlockIOINTEL = 5570,
@ -1084,9 +1117,13 @@ enum Capability {
CapabilityFPGAMemoryAccessesINTEL = 5898,
CapabilityFPGAClusterAttributesINTEL = 5904,
CapabilityLoopFuseINTEL = 5906,
CapabilityFPGADSPControlINTEL = 5908,
CapabilityMemoryAccessAliasingINTEL = 5910,
CapabilityFPGAInvocationPipeliningAttributesINTEL = 5916,
CapabilityFPGABufferLocationINTEL = 5920,
CapabilityArbitraryPrecisionFixedPointINTEL = 5922,
CapabilityUSMStorageClassesINTEL = 5935,
CapabilityRuntimeAlignedAttributeINTEL = 5939,
CapabilityIOPipesINTEL = 5943,
CapabilityBlockingPipesINTEL = 5945,
CapabilityFPGARegINTEL = 5948,
@ -1100,12 +1137,16 @@ enum Capability {
CapabilityDotProductKHR = 6019,
CapabilityRayCullMaskKHR = 6020,
CapabilityBitInstructions = 6025,
CapabilityGroupNonUniformRotateKHR = 6026,
CapabilityAtomicFloat32AddEXT = 6033,
CapabilityAtomicFloat64AddEXT = 6034,
CapabilityLongConstantCompositeINTEL = 6089,
CapabilityOptNoneINTEL = 6094,
CapabilityAtomicFloat16AddEXT = 6095,
CapabilityDebugInfoModuleINTEL = 6114,
CapabilitySplitBarrierINTEL = 6141,
CapabilityFPGAArgumentInterfacesINTEL = 6174,
CapabilityGroupUniformArithmeticKHR = 6400,
CapabilityMax = 0x7fffffff,
};
@ -1120,6 +1161,7 @@ enum RayFlagsShift {
RayFlagsCullNoOpaqueKHRShift = 7,
RayFlagsSkipTrianglesKHRShift = 8,
RayFlagsSkipAABBsKHRShift = 9,
RayFlagsForceOpacityMicromap2StateEXTShift = 10,
RayFlagsMax = 0x7fffffff,
};
@ -1135,6 +1177,7 @@ enum RayFlagsMask {
RayFlagsCullNoOpaqueKHRMask = 0x00000080,
RayFlagsSkipTrianglesKHRMask = 0x00000100,
RayFlagsSkipAABBsKHRMask = 0x00000200,
RayFlagsForceOpacityMicromap2StateEXTMask = 0x00000400,
};
enum RayQueryIntersection {
@ -1561,6 +1604,7 @@ enum Op {
OpSubgroupAllKHR = 4428,
OpSubgroupAnyKHR = 4429,
OpSubgroupAllEqualKHR = 4430,
OpGroupNonUniformRotateKHR = 4431,
OpSubgroupReadInvocationKHR = 4432,
OpTraceRayKHR = 4445,
OpExecuteCallableKHR = 4446,
@ -1642,6 +1686,7 @@ enum Op {
OpTraceNV = 5337,
OpTraceMotionNV = 5338,
OpTraceRayMotionNV = 5339,
OpRayQueryGetIntersectionTriangleVertexPositionsKHR = 5340,
OpTypeAccelerationStructureKHR = 5341,
OpTypeAccelerationStructureNV = 5341,
OpExecuteCallableNV = 5344,
@ -1862,6 +1907,9 @@ enum Op {
OpArbitraryFloatPowRINTEL = 5881,
OpArbitraryFloatPowNINTEL = 5882,
OpLoopControlINTEL = 5887,
OpAliasDomainDeclINTEL = 5911,
OpAliasScopeDeclINTEL = 5912,
OpAliasScopeListDeclINTEL = 5913,
OpFixedSqrtINTEL = 5923,
OpFixedRecipINTEL = 5924,
OpFixedRsqrtINTEL = 5925,
@ -1900,10 +1948,23 @@ enum Op {
OpTypeStructContinuedINTEL = 6090,
OpConstantCompositeContinuedINTEL = 6091,
OpSpecConstantCompositeContinuedINTEL = 6092,
OpControlBarrierArriveINTEL = 6142,
OpControlBarrierWaitINTEL = 6143,
OpGroupIMulKHR = 6401,
OpGroupFMulKHR = 6402,
OpGroupBitwiseAndKHR = 6403,
OpGroupBitwiseOrKHR = 6404,
OpGroupBitwiseXorKHR = 6405,
OpGroupLogicalAndKHR = 6406,
OpGroupLogicalOrKHR = 6407,
OpGroupLogicalXorKHR = 6408,
OpMax = 0x7fffffff,
};
#ifdef SPV_ENABLE_UTILITY_CODE
#ifndef __cplusplus
#include <stdbool.h>
#endif
inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
*hasResult = *hasResultType = false;
switch (opcode) {
@ -2258,6 +2319,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break;
case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break;
case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break;
case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break;
case OpTraceRayKHR: *hasResult = false; *hasResultType = false; break;
case OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break;
@ -2288,10 +2350,43 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpFragmentMaskFetchAMD: *hasResult = true; *hasResultType = true; break;
case OpFragmentFetchAMD: *hasResult = true; *hasResultType = true; break;
case OpReadClockKHR: *hasResult = true; *hasResultType = true; break;
case OpHitObjectRecordHitMotionNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordHitWithIndexMotionNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordMissMotionNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectGetWorldToObjectNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetObjectToWorldNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetObjectRayDirectionNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetObjectRayOriginNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectTraceRayMotionNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectGetShaderRecordBufferHandleNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetShaderBindingTableRecordIndexNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectRecordEmptyNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectTraceRayNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordHitNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordHitWithIndexNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordMissNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectExecuteShaderNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectGetCurrentTimeNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetAttributesNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectGetHitKindNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetPrimitiveIndexNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetGeometryIndexNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetInstanceIdNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetInstanceCustomIndexNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetWorldRayDirectionNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetWorldRayOriginNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetRayTMaxNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetRayTMinNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectIsEmptyNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectIsHitNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectIsMissNV: *hasResult = true; *hasResultType = true; break;
case OpReorderThreadWithHitObjectNV: *hasResult = false; *hasResultType = false; break;
case OpReorderThreadWithHintNV: *hasResult = false; *hasResultType = false; break;
case OpTypeHitObjectNV: *hasResult = true; *hasResultType = false; break;
case OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break;
case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break;
case OpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break;
case OpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break;
case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break;
case OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break;
case OpReportIntersectionNV: *hasResult = true; *hasResultType = true; break;
case OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break;
@ -2299,6 +2394,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpTraceNV: *hasResult = false; *hasResultType = false; break;
case OpTraceMotionNV: *hasResult = false; *hasResultType = false; break;
case OpTraceRayMotionNV: *hasResult = false; *hasResultType = false; break;
case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break;
case OpTypeAccelerationStructureNV: *hasResult = true; *hasResultType = false; break;
case OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break;
case OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break;
@ -2515,6 +2611,9 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpArbitraryFloatPowRINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatPowNINTEL: *hasResult = true; *hasResultType = true; break;
case OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break;
case OpAliasDomainDeclINTEL: *hasResult = true; *hasResultType = false; break;
case OpAliasScopeDeclINTEL: *hasResult = true; *hasResultType = false; break;
case OpAliasScopeListDeclINTEL: *hasResult = true; *hasResultType = false; break;
case OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break;
@ -2553,23 +2652,64 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpTypeStructContinuedINTEL: *hasResult = false; *hasResultType = false; break;
case OpConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break;
case OpSpecConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break;
case OpControlBarrierArriveINTEL: *hasResult = false; *hasResultType = false; break;
case OpControlBarrierWaitINTEL: *hasResult = false; *hasResultType = false; break;
case OpGroupIMulKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupFMulKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupBitwiseAndKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupBitwiseOrKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupBitwiseXorKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupLogicalAndKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupLogicalOrKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupLogicalXorKHR: *hasResult = true; *hasResultType = true; break;
}
}
#endif /* SPV_ENABLE_UTILITY_CODE */
// Overload operator| for mask bit combining
// Overload bitwise operators for mask bit combining
inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); }
inline ImageOperandsMask operator&(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) & unsigned(b)); }
inline ImageOperandsMask operator^(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) ^ unsigned(b)); }
inline ImageOperandsMask operator~(ImageOperandsMask a) { return ImageOperandsMask(~unsigned(a)); }
inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); }
inline FPFastMathModeMask operator&(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) & unsigned(b)); }
inline FPFastMathModeMask operator^(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) ^ unsigned(b)); }
inline FPFastMathModeMask operator~(FPFastMathModeMask a) { return FPFastMathModeMask(~unsigned(a)); }
inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); }
inline SelectionControlMask operator&(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) & unsigned(b)); }
inline SelectionControlMask operator^(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) ^ unsigned(b)); }
inline SelectionControlMask operator~(SelectionControlMask a) { return SelectionControlMask(~unsigned(a)); }
inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); }
inline LoopControlMask operator&(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) & unsigned(b)); }
inline LoopControlMask operator^(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) ^ unsigned(b)); }
inline LoopControlMask operator~(LoopControlMask a) { return LoopControlMask(~unsigned(a)); }
inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); }
inline FunctionControlMask operator&(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) & unsigned(b)); }
inline FunctionControlMask operator^(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) ^ unsigned(b)); }
inline FunctionControlMask operator~(FunctionControlMask a) { return FunctionControlMask(~unsigned(a)); }
inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); }
inline MemorySemanticsMask operator&(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) & unsigned(b)); }
inline MemorySemanticsMask operator^(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) ^ unsigned(b)); }
inline MemorySemanticsMask operator~(MemorySemanticsMask a) { return MemorySemanticsMask(~unsigned(a)); }
inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); }
inline MemoryAccessMask operator&(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) & unsigned(b)); }
inline MemoryAccessMask operator^(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) ^ unsigned(b)); }
inline MemoryAccessMask operator~(MemoryAccessMask a) { return MemoryAccessMask(~unsigned(a)); }
inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); }
inline KernelProfilingInfoMask operator&(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) & unsigned(b)); }
inline KernelProfilingInfoMask operator^(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) ^ unsigned(b)); }
inline KernelProfilingInfoMask operator~(KernelProfilingInfoMask a) { return KernelProfilingInfoMask(~unsigned(a)); }
inline RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) | unsigned(b)); }
inline RayFlagsMask operator&(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) & unsigned(b)); }
inline RayFlagsMask operator^(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) ^ unsigned(b)); }
inline RayFlagsMask operator~(RayFlagsMask a) { return RayFlagsMask(~unsigned(a)); }
inline FragmentShadingRateMask operator|(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) | unsigned(b)); }
inline FragmentShadingRateMask operator&(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) & unsigned(b)); }
inline FragmentShadingRateMask operator^(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) ^ unsigned(b)); }
inline FragmentShadingRateMask operator~(FragmentShadingRateMask a) { return FragmentShadingRateMask(~unsigned(a)); }
} // end namespace spv
#endif // #ifndef spirv_HPP

View File

@ -1,12 +1,14 @@
rayQuery-allOps.comp
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 258
// Id's are bound by 275
Capability Shader
Capability RayQueryKHR
Capability RayTraversalPrimitiveCullingKHR
Capability RayQueryPositionFetchKHR
Extension "SPV_KHR_ray_query"
Extension "SPV_KHR_ray_tracing_position_fetch"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
@ -14,6 +16,7 @@ rayQuery-allOps.comp
Source GLSL 460
SourceExtension "GL_EXT_ray_flags_primitive_culling"
SourceExtension "GL_EXT_ray_query"
SourceExtension "GL_EXT_ray_tracing_position_fetch"
Name 4 "main"
Name 6 "doSomething("
Name 10 "Ray"
@ -35,16 +38,17 @@ rayQuery-allOps.comp
Name 83 "_mat3x4"
Name 143 "t"
Name 156 "committedStatus"
Name 241 "o"
Name 243 "d"
Name 253 "Ray"
MemberName 253(Ray) 0 "pos"
MemberName 253(Ray) 1 "tmin"
MemberName 253(Ray) 2 "dir"
MemberName 253(Ray) 3 "tmax"
Name 255 "Rays"
MemberName 255(Rays) 0 "rays"
Name 257 ""
Name 184 "positions"
Name 258 "o"
Name 260 "d"
Name 270 "Ray"
MemberName 270(Ray) 0 "pos"
MemberName 270(Ray) 1 "tmin"
MemberName 270(Ray) 2 "dir"
MemberName 270(Ray) 3 "tmax"
Name 272 "Rays"
MemberName 272(Rays) 0 "rays"
Name 274 ""
MemberDecorate 15(Log) 0 Offset 0
MemberDecorate 15(Log) 1 Offset 4
Decorate 15(Log) BufferBlock
@ -52,15 +56,15 @@ rayQuery-allOps.comp
Decorate 17 Binding 0
Decorate 50(rtas) DescriptorSet 0
Decorate 50(rtas) Binding 1
MemberDecorate 253(Ray) 0 Offset 0
MemberDecorate 253(Ray) 1 Offset 12
MemberDecorate 253(Ray) 2 Offset 16
MemberDecorate 253(Ray) 3 Offset 28
Decorate 254 ArrayStride 32
MemberDecorate 255(Rays) 0 Offset 0
Decorate 255(Rays) BufferBlock
Decorate 257 DescriptorSet 0
Decorate 257 Binding 2
MemberDecorate 270(Ray) 0 Offset 0
MemberDecorate 270(Ray) 1 Offset 12
MemberDecorate 270(Ray) 2 Offset 16
MemberDecorate 270(Ray) 3 Offset 28
Decorate 271 ArrayStride 32
MemberDecorate 272(Rays) 0 Offset 0
Decorate 272(Rays) BufferBlock
Decorate 274 DescriptorSet 0
Decorate 274 Binding 2
2: TypeVoid
3: TypeFunction 2
8: TypeFloat 32
@ -105,13 +109,16 @@ rayQuery-allOps.comp
91: TypeVector 8(float) 2
144: 8(float) Constant 1056964608
175: 14(int) Constant 1
198: 14(int) Constant 2
231: 14(int) Constant 256
253(Ray): TypeStruct 9(fvec3) 8(float) 9(fvec3) 8(float)
254: TypeRuntimeArray 253(Ray)
255(Rays): TypeStruct 254
256: TypePointer Uniform 255(Rays)
257: 256(ptr) Variable Uniform
181: 14(int) Constant 3
182: TypeArray 9(fvec3) 181
183: TypePointer Function 182
215: 14(int) Constant 2
248: 14(int) Constant 256
270(Ray): TypeStruct 9(fvec3) 8(float) 9(fvec3) 8(float)
271: TypeRuntimeArray 270(Ray)
272(Rays): TypeStruct 271
273: TypePointer Uniform 272(Rays)
274: 273(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
43(ray): 25(ptr) Variable Function
@ -120,8 +127,9 @@ rayQuery-allOps.comp
83(_mat3x4): 82(ptr) Variable Function
143(t): 35(ptr) Variable Function
156(committedStatus): 68(ptr) Variable Function
241(o): 29(ptr) Variable Function
243(d): 29(ptr) Variable Function
184(positions): 183(ptr) Variable Function
258(o): 29(ptr) Variable Function
260(d): 29(ptr) Variable Function
44: 10(Ray) FunctionCall 12(makeRayDesc()
Store 43(ray) 44
51: 48 Load 50(rtas)
@ -303,110 +311,130 @@ rayQuery-allOps.comp
180: 2 FunctionCall 6(doSomething()
Branch 179
179: Label
Branch 162
161: Label
182: 18(int) RayQueryGetIntersectionGeometryIndexKHR 47(rayQuery) 23
183: 66(bool) SGreaterThan 182 19
SelectionMerge 185 None
BranchConditional 183 184 185
184: Label
186: 2 FunctionCall 6(doSomething()
Branch 185
185: Label
187: 18(int) RayQueryGetIntersectionInstanceIdKHR 47(rayQuery) 23
188: 66(bool) SGreaterThan 187 19
185: 182 RayQueryGetIntersectionTriangleVertexPositionsKHR 47(rayQuery) 23
Store 184(positions) 185
186: 35(ptr) AccessChain 184(positions) 19 20
187: 8(float) Load 186
188: 66(bool) FOrdLessThan 187 27
SelectionMerge 190 None
BranchConditional 188 189 190
189: Label
191: 2 FunctionCall 6(doSomething()
191: 35(ptr) AccessChain 184(positions) 31 175
192: 8(float) Load 191
193: 66(bool) FOrdGreaterThan 192 27
Branch 190
190: Label
192: 18(int) RayQueryGetIntersectionInstanceCustomIndexKHR 47(rayQuery) 23
193: 66(bool) SGreaterThan 192 19
SelectionMerge 195 None
BranchConditional 193 194 195
194: Label
196: 2 FunctionCall 6(doSomething()
Branch 195
194: 66(bool) Phi 188 179 193 189
SelectionMerge 196 None
BranchConditional 194 195 196
195: Label
197: 9(fvec3) RayQueryGetIntersectionObjectRayDirectionKHR 47(rayQuery) 23
199: 8(float) CompositeExtract 197 2
200: 66(bool) FOrdGreaterThan 199 27
197: 2 FunctionCall 6(doSomething()
Branch 196
196: Label
Branch 162
161: Label
199: 18(int) RayQueryGetIntersectionGeometryIndexKHR 47(rayQuery) 23
200: 66(bool) SGreaterThan 199 19
SelectionMerge 202 None
BranchConditional 200 201 202
201: Label
203: 2 FunctionCall 6(doSomething()
Branch 202
202: Label
204: 9(fvec3) RayQueryGetIntersectionObjectRayOriginKHR 47(rayQuery) 23
205: 8(float) CompositeExtract 204 0
206: 66(bool) FOrdGreaterThan 205 27
SelectionMerge 208 None
BranchConditional 206 207 208
204: 18(int) RayQueryGetIntersectionInstanceIdKHR 47(rayQuery) 23
205: 66(bool) SGreaterThan 204 19
SelectionMerge 207 None
BranchConditional 205 206 207
206: Label
208: 2 FunctionCall 6(doSomething()
Branch 207
207: Label
209: 2 FunctionCall 6(doSomething()
Branch 208
208: Label
210: 18(int) RayQueryGetIntersectionPrimitiveIndexKHR 47(rayQuery) 23
211: 66(bool) SGreaterThan 210 19
SelectionMerge 213 None
BranchConditional 211 212 213
209: 18(int) RayQueryGetIntersectionInstanceCustomIndexKHR 47(rayQuery) 23
210: 66(bool) SGreaterThan 209 19
SelectionMerge 212 None
BranchConditional 210 211 212
211: Label
213: 2 FunctionCall 6(doSomething()
Branch 212
212: Label
214: 2 FunctionCall 6(doSomething()
Branch 213
213: Label
215: 8(float) RayQueryGetIntersectionTKHR 47(rayQuery) 23
216: 66(bool) FOrdGreaterThan 215 27
SelectionMerge 218 None
BranchConditional 216 217 218
217: Label
219: 2 FunctionCall 6(doSomething()
Branch 218
214: 9(fvec3) RayQueryGetIntersectionObjectRayDirectionKHR 47(rayQuery) 23
216: 8(float) CompositeExtract 214 2
217: 66(bool) FOrdGreaterThan 216 27
SelectionMerge 219 None
BranchConditional 217 218 219
218: Label
220: 2 FunctionCall 6(doSomething()
Branch 219
219: Label
221: 9(fvec3) RayQueryGetIntersectionObjectRayOriginKHR 47(rayQuery) 23
222: 8(float) CompositeExtract 221 0
223: 66(bool) FOrdGreaterThan 222 27
SelectionMerge 225 None
BranchConditional 223 224 225
224: Label
226: 2 FunctionCall 6(doSomething()
Branch 225
225: Label
227: 18(int) RayQueryGetIntersectionPrimitiveIndexKHR 47(rayQuery) 23
228: 66(bool) SGreaterThan 227 19
SelectionMerge 230 None
BranchConditional 228 229 230
229: Label
231: 2 FunctionCall 6(doSomething()
Branch 230
230: Label
232: 8(float) RayQueryGetIntersectionTKHR 47(rayQuery) 23
233: 66(bool) FOrdGreaterThan 232 27
SelectionMerge 235 None
BranchConditional 233 234 235
234: Label
236: 2 FunctionCall 6(doSomething()
Branch 235
235: Label
Branch 162
162: Label
222: 35(ptr) AccessChain 83(_mat3x4) 19 20
223: 8(float) Load 222
224: 35(ptr) AccessChain 78(_mat4x3) 19 20
225: 8(float) Load 224
226: 66(bool) FOrdEqual 223 225
SelectionMerge 228 None
BranchConditional 226 227 228
227: Label
229: 2 FunctionCall 6(doSomething()
Branch 228
228: Label
230: 14(int) RayQueryGetRayFlagsKHR 47(rayQuery)
232: 66(bool) UGreaterThan 230 231
SelectionMerge 234 None
BranchConditional 232 233 234
233: Label
235: 2 FunctionCall 6(doSomething()
Branch 234
234: Label
236: 8(float) RayQueryGetRayTMinKHR 47(rayQuery)
237: 66(bool) FOrdGreaterThan 236 27
SelectionMerge 239 None
BranchConditional 237 238 239
238: Label
240: 2 FunctionCall 6(doSomething()
Branch 239
239: Label
242: 9(fvec3) RayQueryGetWorldRayOriginKHR 47(rayQuery)
Store 241(o) 242
244: 9(fvec3) RayQueryGetWorldRayDirectionKHR 47(rayQuery)
Store 243(d) 244
245: 35(ptr) AccessChain 241(o) 20
246: 8(float) Load 245
247: 35(ptr) AccessChain 243(d) 198
248: 8(float) Load 247
249: 66(bool) FOrdEqual 246 248
239: 35(ptr) AccessChain 83(_mat3x4) 19 20
240: 8(float) Load 239
241: 35(ptr) AccessChain 78(_mat4x3) 19 20
242: 8(float) Load 241
243: 66(bool) FOrdEqual 240 242
SelectionMerge 245 None
BranchConditional 243 244 245
244: Label
246: 2 FunctionCall 6(doSomething()
Branch 245
245: Label
247: 14(int) RayQueryGetRayFlagsKHR 47(rayQuery)
249: 66(bool) UGreaterThan 247 248
SelectionMerge 251 None
BranchConditional 249 250 251
250: Label
252: 2 FunctionCall 6(doSomething()
Branch 251
251: Label
253: 8(float) RayQueryGetRayTMinKHR 47(rayQuery)
254: 66(bool) FOrdGreaterThan 253 27
SelectionMerge 256 None
BranchConditional 254 255 256
255: Label
257: 2 FunctionCall 6(doSomething()
Branch 256
256: Label
259: 9(fvec3) RayQueryGetWorldRayOriginKHR 47(rayQuery)
Store 258(o) 259
261: 9(fvec3) RayQueryGetWorldRayDirectionKHR 47(rayQuery)
Store 260(d) 261
262: 35(ptr) AccessChain 258(o) 20
263: 8(float) Load 262
264: 35(ptr) AccessChain 260(d) 215
265: 8(float) Load 264
266: 66(bool) FOrdEqual 263 265
SelectionMerge 268 None
BranchConditional 266 267 268
267: Label
269: 2 FunctionCall 6(doSomething()
Branch 268
268: Label
Return
FunctionEnd
6(doSomething(): 2 Function None 3

View File

@ -1,19 +1,22 @@
spv.ext.AnyHitShader.rahit
// Module Version 10400
// Generated by (magic number): 8000b
// Id's are bound by 108
// Id's are bound by 116
Capability GroupNonUniform
Capability RayTracingKHR
Capability RayTracingPositionFetchKHR
Capability RayCullMaskKHR
Extension "SPV_KHR_ray_cull_mask"
Extension "SPV_KHR_ray_tracing"
Extension "SPV_KHR_ray_tracing_position_fetch"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint AnyHitKHR 4 "main" 11 14 20 23 26 33 36 39 42 47 50 53 58 64 67 70 82 85 99
EntryPoint AnyHitKHR 4 "main" 11 14 20 23 26 33 36 39 42 47 50 53 58 64 67 70 82 88 93 107
Source GLSL 460
SourceExtension "GL_EXT_ray_cull_mask"
SourceExtension "GL_EXT_ray_tracing"
SourceExtension "GL_EXT_ray_tracing_position_fetch"
SourceExtension "GL_KHR_shader_subgroup_basic"
Name 4 "main"
Name 9 "v0"
@ -52,8 +55,10 @@ spv.ext.AnyHitShader.rahit
Name 78 "v17"
Name 81 "v18"
Name 82 "gl_CullMaskEXT"
Name 85 "incomingPayload"
Name 99 "gl_SubgroupSize"
Name 84 "v19"
Name 88 "gl_HitTriangleVertexPositionsEXT"
Name 93 "incomingPayload"
Name 107 "gl_SubgroupSize"
Decorate 11(gl_LaunchIDEXT) BuiltIn LaunchIdKHR
Decorate 14(gl_LaunchSizeEXT) BuiltIn LaunchSizeKHR
Decorate 20(gl_PrimitiveID) BuiltIn PrimitiveId
@ -71,10 +76,11 @@ spv.ext.AnyHitShader.rahit
Decorate 67(gl_WorldToObjectEXT) BuiltIn WorldToObjectKHR
Decorate 70(gl_GeometryIndexEXT) BuiltIn RayGeometryIndexKHR
Decorate 82(gl_CullMaskEXT) BuiltIn CullMaskKHR
Decorate 99(gl_SubgroupSize) RelaxedPrecision
Decorate 99(gl_SubgroupSize) BuiltIn SubgroupSize
Decorate 100 RelaxedPrecision
Decorate 101 RelaxedPrecision
Decorate 88(gl_HitTriangleVertexPositionsEXT) BuiltIn HitTriangleVertexPositionsKHR
Decorate 107(gl_SubgroupSize) RelaxedPrecision
Decorate 107(gl_SubgroupSize) BuiltIn SubgroupSize
Decorate 108 RelaxedPrecision
Decorate 109 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@ -115,15 +121,20 @@ spv.ext.AnyHitShader.rahit
73: TypeMatrix 72(fvec4) 3
74: TypePointer Function 73
82(gl_CullMaskEXT): 57(ptr) Variable Input
84: TypePointer IncomingRayPayloadKHR 72(fvec4)
85(incomingPayload): 84(ptr) Variable IncomingRayPayloadKHR
86: 28(float) Constant 1056964608
87: 72(fvec4) ConstantComposite 86 86 86 86
89: 16(int) Constant 1
90: TypeBool
95: 6(int) Constant 0
99(gl_SubgroupSize): 57(ptr) Variable Input
102: TypePointer IncomingRayPayloadKHR 28(float)
85: 6(int) Constant 3
86: TypeArray 29(fvec3) 85
87: TypePointer Input 86
88(gl_HitTriangleVertexPositionsEXT): 87(ptr) Variable Input
89: 16(int) Constant 0
92: TypePointer IncomingRayPayloadKHR 72(fvec4)
93(incomingPayload): 92(ptr) Variable IncomingRayPayloadKHR
94: 28(float) Constant 1056964608
95: 72(fvec4) ConstantComposite 94 94 94 94
97: 16(int) Constant 1
98: TypeBool
103: 6(int) Constant 0
107(gl_SubgroupSize): 57(ptr) Variable Input
110: TypePointer IncomingRayPayloadKHR 28(float)
4(main): 2 Function None 3
5: Label
9(v0): 8(ptr) Variable Function
@ -145,6 +156,7 @@ spv.ext.AnyHitShader.rahit
75(v16): 74(ptr) Variable Function
78(v17): 74(ptr) Variable Function
81(v18): 55(ptr) Variable Function
84(v19): 30(ptr) Variable Function
12: 7(ivec3) Load 11(gl_LaunchIDEXT)
Store 9(v0) 12
15: 7(ivec3) Load 14(gl_LaunchSizeEXT)
@ -185,20 +197,23 @@ spv.ext.AnyHitShader.rahit
Store 78(v17) 80
83: 6(int) Load 82(gl_CullMaskEXT)
Store 81(v18) 83
Store 85(incomingPayload) 87
88: 16(int) Load 18(v2)
91: 90(bool) IEqual 88 89
SelectionMerge 93 None
BranchConditional 91 92 93
92: Label
90: 32(ptr) AccessChain 88(gl_HitTriangleVertexPositionsEXT) 89
91: 29(fvec3) Load 90
Store 84(v19) 91
Store 93(incomingPayload) 95
96: 16(int) Load 18(v2)
99: 98(bool) IEqual 96 97
SelectionMerge 101 None
BranchConditional 99 100 101
100: Label
IgnoreIntersectionKHR
93: Label
100: 6(int) Load 99(gl_SubgroupSize)
101: 28(float) ConvertUToF 100
103: 102(ptr) AccessChain 85(incomingPayload) 95
104: 28(float) Load 103
105: 28(float) FAdd 104 101
106: 102(ptr) AccessChain 85(incomingPayload) 95
Store 106 105
101: Label
108: 6(int) Load 107(gl_SubgroupSize)
109: 28(float) ConvertUToF 108
111: 110(ptr) AccessChain 93(incomingPayload) 103
112: 28(float) Load 111
113: 28(float) FAdd 112 109
114: 110(ptr) AccessChain 93(incomingPayload) 103
Store 114 113
TerminateRayKHR
FunctionEnd

View File

@ -1,18 +1,21 @@
spv.ext.ClosestHitShader.rchit
// Module Version 10400
// Generated by (magic number): 8000b
// Id's are bound by 102
// Id's are bound by 109
Capability RayTracingKHR
Capability RayTracingPositionFetchKHR
Capability RayCullMaskKHR
Extension "SPV_KHR_ray_cull_mask"
Extension "SPV_KHR_ray_tracing"
Extension "SPV_KHR_ray_tracing_position_fetch"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint ClosestHitKHR 4 "main" 11 14 20 23 26 33 36 39 42 47 50 53 58 64 67 70 82 86 99 101
EntryPoint ClosestHitKHR 4 "main" 11 14 20 23 26 33 36 39 42 47 50 53 58 64 67 70 82 88 94 106 108
Source GLSL 460
SourceExtension "GL_EXT_ray_cull_mask"
SourceExtension "GL_EXT_ray_tracing"
SourceExtension "GL_EXT_ray_tracing_position_fetch"
Name 4 "main"
Name 9 "v0"
Name 11 "gl_LaunchIDEXT"
@ -50,9 +53,11 @@ spv.ext.ClosestHitShader.rchit
Name 78 "v17"
Name 81 "v18"
Name 82 "gl_CullMaskEXT"
Name 86 "accEXT"
Name 99 "incomingPayload"
Name 101 "localPayload"
Name 84 "v19"
Name 88 "gl_HitTriangleVertexPositionsEXT"
Name 94 "accEXT"
Name 106 "incomingPayload"
Name 108 "localPayload"
Decorate 11(gl_LaunchIDEXT) BuiltIn LaunchIdKHR
Decorate 14(gl_LaunchSizeEXT) BuiltIn LaunchSizeKHR
Decorate 20(gl_PrimitiveID) BuiltIn PrimitiveId
@ -70,8 +75,9 @@ spv.ext.ClosestHitShader.rchit
Decorate 67(gl_WorldToObjectEXT) BuiltIn WorldToObjectKHR
Decorate 70(gl_GeometryIndexEXT) BuiltIn RayGeometryIndexKHR
Decorate 82(gl_CullMaskEXT) BuiltIn CullMaskKHR
Decorate 86(accEXT) DescriptorSet 0
Decorate 86(accEXT) Binding 0
Decorate 88(gl_HitTriangleVertexPositionsEXT) BuiltIn HitTriangleVertexPositionsKHR
Decorate 94(accEXT) DescriptorSet 0
Decorate 94(accEXT) Binding 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@ -112,23 +118,27 @@ spv.ext.ClosestHitShader.rchit
73: TypeMatrix 72(fvec4) 3
74: TypePointer Function 73
82(gl_CullMaskEXT): 57(ptr) Variable Input
84: TypeAccelerationStructureKHR
85: TypePointer UniformConstant 84
86(accEXT): 85(ptr) Variable UniformConstant
88: 6(int) Constant 0
89: 6(int) Constant 1
90: 6(int) Constant 2
91: 6(int) Constant 3
92: 28(float) Constant 1056964608
93: 29(fvec3) ConstantComposite 92 92 92
94: 28(float) Constant 1065353216
95: 29(fvec3) ConstantComposite 94 94 94
96: 28(float) Constant 1061158912
97: 16(int) Constant 1
98: TypePointer IncomingRayPayloadKHR 72(fvec4)
99(incomingPayload): 98(ptr) Variable IncomingRayPayloadKHR
100: TypePointer RayPayloadKHR 72(fvec4)
101(localPayload): 100(ptr) Variable RayPayloadKHR
85: 6(int) Constant 3
86: TypeArray 29(fvec3) 85
87: TypePointer Input 86
88(gl_HitTriangleVertexPositionsEXT): 87(ptr) Variable Input
89: 16(int) Constant 0
92: TypeAccelerationStructureKHR
93: TypePointer UniformConstant 92
94(accEXT): 93(ptr) Variable UniformConstant
96: 6(int) Constant 0
97: 6(int) Constant 1
98: 6(int) Constant 2
99: 28(float) Constant 1056964608
100: 29(fvec3) ConstantComposite 99 99 99
101: 28(float) Constant 1065353216
102: 29(fvec3) ConstantComposite 101 101 101
103: 28(float) Constant 1061158912
104: 16(int) Constant 1
105: TypePointer IncomingRayPayloadKHR 72(fvec4)
106(incomingPayload): 105(ptr) Variable IncomingRayPayloadKHR
107: TypePointer RayPayloadKHR 72(fvec4)
108(localPayload): 107(ptr) Variable RayPayloadKHR
4(main): 2 Function None 3
5: Label
9(v0): 8(ptr) Variable Function
@ -150,6 +160,7 @@ spv.ext.ClosestHitShader.rchit
75(v16): 74(ptr) Variable Function
78(v17): 74(ptr) Variable Function
81(v18): 55(ptr) Variable Function
84(v19): 30(ptr) Variable Function
12: 7(ivec3) Load 11(gl_LaunchIDEXT)
Store 9(v0) 12
15: 7(ivec3) Load 14(gl_LaunchSizeEXT)
@ -190,7 +201,10 @@ spv.ext.ClosestHitShader.rchit
Store 78(v17) 80
83: 6(int) Load 82(gl_CullMaskEXT)
Store 81(v18) 83
87: 84 Load 86(accEXT)
TraceRayKHR 87 88 89 90 91 88 93 92 95 96 99(incomingPayload)
90: 32(ptr) AccessChain 88(gl_HitTriangleVertexPositionsEXT) 89
91: 29(fvec3) Load 90
Store 84(v19) 91
95: 92 Load 94(accEXT)
TraceRayKHR 95 96 97 98 85 96 100 99 102 103 106(incomingPayload)
Return
FunctionEnd

View File

@ -1,6 +1,7 @@
#version 460
#extension GL_EXT_ray_query : enable
#extension GL_EXT_ray_flags_primitive_culling : enable
#extension GL_EXT_ray_tracing_position_fetch : enable
layout(primitive_culling);
struct Ray
@ -147,6 +148,14 @@ void main()
{
doSomething();
}
{
vec3 positions[3];
rayQueryGetIntersectionTriangleVertexPositionsEXT(rayQuery, true, positions);
if (positions[0].x < 0 && positions[2].y > 0)
{
doSomething();
}
}
break;
case gl_RayQueryCommittedIntersectionGeneratedEXT :

2
Test/spv.ext.AnyHitShader.rahit Normal file → Executable file
View File

@ -2,6 +2,7 @@
#extension GL_EXT_ray_tracing : enable
#extension GL_KHR_shader_subgroup_basic : enable
#extension GL_EXT_ray_cull_mask : enable
#extension GL_EXT_ray_tracing_position_fetch : enable
layout(location = 1) rayPayloadInEXT vec4 incomingPayload;
void main()
@ -25,6 +26,7 @@ void main()
mat3x4 v16 = gl_ObjectToWorld3x4EXT;
mat3x4 v17 = gl_WorldToObject3x4EXT;
uint v18 = gl_CullMaskEXT;
vec3 v19 = gl_HitTriangleVertexPositionsEXT[0];
incomingPayload = vec4(0.5f);
if (v2 == 1) {
ignoreIntersectionEXT;

2
Test/spv.ext.ClosestHitShader.rchit Normal file → Executable file
View File

@ -1,6 +1,7 @@
#version 460
#extension GL_EXT_ray_tracing : enable
#extension GL_EXT_ray_cull_mask : enable
#extension GL_EXT_ray_tracing_position_fetch : enable
layout(binding = 0, set = 0) uniform accelerationStructureEXT accEXT;
layout(location = 0) rayPayloadEXT vec4 localPayload;
@ -26,5 +27,6 @@ void main()
mat3x4 v16 = gl_ObjectToWorld3x4EXT;
mat3x4 v17 = gl_WorldToObject3x4EXT;
uint v18 = gl_CullMaskEXT;
vec3 v19 = gl_HitTriangleVertexPositionsEXT[0];
traceRayEXT(accEXT, 0u, 1u, 2u, 3u, 0u, vec3(0.5f), 0.5f, vec3(1.0f), 0.75f, 1);
}

2
glslang/Include/BaseTypes.h Normal file → Executable file
View File

@ -325,6 +325,8 @@ enum TBuiltInVariable {
EbvWarpIDARM,
EbvWarpMaxIDARM,
EbvPositionFetch,
EbvLast
};

View File

@ -1090,6 +1090,9 @@ enum TOperator {
// Shader Clock Ops
EOpReadClockSubgroupKHR,
EOpReadClockDeviceKHR,
// GL_EXT_ray_tracing_position_fetch
EOpRayQueryGetIntersectionTriangleVertexPositionsEXT,
};
class TIntermTraverser;

8
glslang/MachineIndependent/Initialize.cpp Normal file → Executable file
View File

@ -4551,7 +4551,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
}
// Builtins for GL_NV_ray_tracing/GL_NV_ray_tracing_motion_blur/GL_EXT_ray_tracing/GL_EXT_ray_query/
// GL_NV_shader_invocation_reorder
// GL_NV_shader_invocation_reorder/GL_KHR_ray_tracing_position_Fetch
if (profile != EEsProfile && version >= 460) {
commonBuiltins.append("void rayQueryInitializeEXT(rayQueryEXT, accelerationStructureEXT, uint, uint, vec3, float, vec3, float);"
"void rayQueryTerminateEXT(rayQueryEXT);"
@ -4576,6 +4576,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"vec3 rayQueryGetIntersectionObjectRayOriginEXT(rayQueryEXT, bool);"
"mat4x3 rayQueryGetIntersectionObjectToWorldEXT(rayQueryEXT, bool);"
"mat4x3 rayQueryGetIntersectionWorldToObjectEXT(rayQueryEXT, bool);"
"void rayQueryGetIntersectionTriangleVertexPositionsEXT(rayQueryEXT, bool, out vec3[3]);"
"\n");
stageBuiltins[EShLangRayGen].append(
@ -6018,6 +6019,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in uint gl_IncomingRayFlagsEXT;"
"in float gl_CurrentRayTimeNV;"
"in uint gl_CullMaskEXT;"
"in vec3 gl_HitTriangleVertexPositionsEXT[3];"
"\n";
const char *missDecls =
"in uvec3 gl_LaunchIDNV;"
@ -8235,6 +8237,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("rayQueryGetIntersectionWorldToObjectEXT", 1, &E_GL_EXT_ray_query);
symbolTable.setFunctionExtensions("rayQueryGetWorldRayOriginEXT", 1, &E_GL_EXT_ray_query);
symbolTable.setFunctionExtensions("rayQueryGetWorldRayDirectionEXT", 1, &E_GL_EXT_ray_query);
symbolTable.setFunctionExtensions("rayQueryGetIntersectionTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch);
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);
@ -8932,6 +8935,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_IncomingRayFlagsNV", 1, &E_GL_NV_ray_tracing);
symbolTable.setVariableExtensions("gl_IncomingRayFlagsEXT", 1, &E_GL_EXT_ray_tracing);
symbolTable.setVariableExtensions("gl_CurrentRayTimeNV", 1, &E_GL_NV_ray_tracing_motion_blur);
symbolTable.setVariableExtensions("gl_HitTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch);
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
@ -9015,6 +9019,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_IncomingRayFlagsEXT", EbvIncomingRayFlags, symbolTable);
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
BuiltInVariable("gl_CurrentRayTimeNV", EbvCurrentRayTimeNV, symbolTable);
BuiltInVariable("gl_HitTriangleVertexPositionsEXT", EbvPositionFetch, symbolTable);
// GL_ARB_shader_ballot
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
@ -9939,6 +9944,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("rayQueryGetWorldRayOriginEXT", EOpRayQueryGetWorldRayOrigin);
symbolTable.relateToOperator("rayQueryGetIntersectionObjectToWorldEXT", EOpRayQueryGetIntersectionObjectToWorld);
symbolTable.relateToOperator("rayQueryGetIntersectionWorldToObjectEXT", EOpRayQueryGetIntersectionWorldToObject);
symbolTable.relateToOperator("rayQueryGetIntersectionTriangleVertexPositionsEXT", EOpRayQueryGetIntersectionTriangleVertexPositionsEXT);
}
symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid);

View File

@ -2467,6 +2467,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
case EOpRayQueryGetIntersectionObjectRayOrigin:
case EOpRayQueryGetIntersectionObjectToWorld:
case EOpRayQueryGetIntersectionWorldToObject:
case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
if (!(*argp)[1]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "committed", "");
break;

View File

@ -354,6 +354,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_spirv_intrinsics] = EBhDisable;
extensionBehavior[E_GL_EXT_mesh_shader] = EBhDisable;
extensionBehavior[E_GL_EXT_opacity_micromap] = EBhDisable;
extensionBehavior[E_GL_EXT_ray_tracing_position_fetch] = EBhDisable;
// OVR extensions
extensionBehavior[E_GL_OVR_multiview] = EBhDisable;
@ -522,6 +523,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_ray_query 1\n"
"#define GL_EXT_ray_flags_primitive_culling 1\n"
"#define GL_EXT_ray_cull_mask 1\n"
"#define GL_EXT_ray_tracing_position_fetch 1\n"
"#define GL_EXT_spirv_intrinsics 1\n"
"#define GL_EXT_mesh_shader 1\n"

1
glslang/MachineIndependent/Versions.h Normal file → Executable file
View File

@ -265,6 +265,7 @@ const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragmen
const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives";
const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint";
const char* const E_GL_NV_mesh_shader = "GL_NV_mesh_shader";
const char* const E_GL_EXT_ray_tracing_position_fetch = "GL_EXT_ray_tracing_position_fetch";
// ARM
const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins";

View File

@ -1097,6 +1097,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpRayQueryGetWorldRayOrigin: out.debug << "rayQueryGetWorldRayOriginEXT"; break;
case EOpRayQueryGetIntersectionObjectToWorld: out.debug << "rayQueryGetIntersectionObjectToWorldEXT"; break;
case EOpRayQueryGetIntersectionWorldToObject: out.debug << "rayQueryGetIntersectionWorldToObjectEXT"; break;
case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: out.debug << "rayQueryGetIntersectionTriangleVertexPositionsEXT"; break;
case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break;
case EOpCooperativeMatrixStore: out.debug << "Store cooperative matrix"; break;

View File

@ -5,14 +5,14 @@
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Tools",
"subdir" : "External/spirv-tools",
"commit" : "44d72a9b36702f093dd20815561a56778b2d181e"
"commit" : "baa46e103695080f56ac72847993f4ee9151cf63"
},
{
"name" : "spirv-tools/external/spirv-headers",
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Headers",
"subdir" : "External/spirv-tools/external/spirv-headers",
"commit" : "1feaf4414eb2b353764d01d88f8aa4bcc67b60db"
"commit" : "7f1d2f4158704337aff1f739c8e494afc5716e7e"
}
]
}