pub(crate) const CORE_OPS: [(&str, &str); 312] = [
("TempRegLoad", "(index)"),
("TempRegStore", "(index,value)"),
("MinPrecXRegLoad", "(regIndex,index,component)"),
("MinPrecXRegStore", "(regIndex,index,component,value)"),
("LoadInput", "(inputSigId,rowIndex,colIndex,gsVertexAxis)"),
("StoreOutput", "(outputSigId,rowIndex,colIndex,value)"),
("FAbs", "(value)"),
("Saturate", "(value)"),
("IsNaN", "(value)"),
("IsInf", "(value)"),
("IsFinite", "(value)"),
("IsNormal", "(value)"),
("Cos", "(value)"),
("Sin", "(value)"),
("Tan", "(value)"),
("Acos", "(value)"),
("Asin", "(value)"),
("Atan", "(value)"),
("Hcos", "(value)"),
("Hsin", "(value)"),
("Htan", "(value)"),
("Exp", "(value)"),
("Frc", "(value)"),
("Log", "(value)"),
("Sqrt", "(value)"),
("Rsqrt", "(value)"),
("Round_ne", "(value)"),
("Round_ni", "(value)"),
("Round_pi", "(value)"),
("Round_z", "(value)"),
("Bfrev", "(value)"),
("Countbits", "(value)"),
("FirstbitLo", "(value)"),
("FirstbitHi", "(value)"),
("FirstbitSHi", "(value)"),
("FMax", "(a,b)"),
("FMin", "(a,b)"),
("IMax", "(a,b)"),
("IMin", "(a,b)"),
("UMax", "(a,b)"),
("UMin", "(a,b)"),
("IMul", "(a,b)"),
("UMul", "(a,b)"),
("UDiv", "(a,b)"),
("UAddc", "(a,b)"),
("USubb", "(a,b)"),
("FMad", "(a,b,c)"),
("Fma", "(a,b,c)"),
("IMad", "(a,b,c)"),
("UMad", "(a,b,c)"),
("Msad", "(a,b,c)"),
("Ibfe", "(a,b,c)"),
("Ubfe", "(a,b,c)"),
("Bfi", "(width,offset,value,replacedValue)"),
("Dot2", "(ax,ay,bx,by)"),
("Dot3", "(ax,ay,az,bx,by,bz)"),
("Dot4", "(ax,ay,az,aw,bx,by,bz,bw)"),
("CreateHandle", "(resourceClass,rangeId,index,nonUniformIndex)"),
("CBufferLoad", "(handle,byteOffset,alignment)"),
("CBufferLoadLegacy", "(handle,regIndex)"),
("Sample", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,offset2,clamp)"),
("SampleBias", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,offset2,bias,clamp)"),
("SampleLevel", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,offset2,LOD)"),
("SampleGrad", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,offset2,ddx0,ddx1,ddx2,ddy0,ddy1,ddy2,clamp)"),
("SampleCmp", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,offset2,compareValue,clamp)"),
("SampleCmpLevelZero", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,offset2,compareValue)"),
("TextureLoad", "(srv,mipLevelOrSampleCount,coord0,coord1,coord2,offset0,offset1,offset2)"),
("TextureStore", "(srv,coord0,coord1,coord2,value0,value1,value2,value3,mask)"),
("BufferLoad", "(srv,index,wot)"),
("BufferStore", "(uav,coord0,coord1,value0,value1,value2,value3,mask)"),
("BufferUpdateCounter", "(uav,inc)"),
("CheckAccessFullyMapped", "(status)"),
("GetDimensions", "(handle,mipLevel)"),
("TextureGather", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,channel)"),
("TextureGatherCmp", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,channel,compareValue)"),
("Texture2DMSGetSamplePosition", "(srv,index)"),
("RenderTargetGetSamplePosition", "(index)"),
("RenderTargetGetSampleCount", "()"),
("AtomicBinOp", "(handle,atomicOp,offset0,offset1,offset2,newValue)"),
("AtomicCompareExchange", "(handle,offset0,offset1,offset2,compareValue,newValue)"),
("Barrier", "(barrierMode)"),
("CalculateLOD", "(handle,sampler,coord0,coord1,coord2,clamped)"),
("Discard", "(condition)"),
("DerivCoarseX", "(value)"),
("DerivCoarseY", "(value)"),
("DerivFineX", "(value)"),
("DerivFineY", "(value)"),
("EvalSnapped", "(inputSigId,inputRowIndex,inputColIndex,offsetX,offsetY)"),
("EvalSampleIndex", "(inputSigId,inputRowIndex,inputColIndex,sampleIndex)"),
("EvalCentroid", "(inputSigId,inputRowIndex,inputColIndex)"),
("SampleIndex", "()"),
("Coverage", "()"),
("InnerCoverage", "()"),
("ThreadId", "(component)"),
("GroupId", "(component)"),
("ThreadIdInGroup", "(component)"),
("FlattenedThreadIdInGroup", "()"),
("EmitStream", "(streamId)"),
("CutStream", "(streamId)"),
("EmitThenCutStream", "(streamId)"),
("GSInstanceID", "()"),
("MakeDouble", "(lo,hi)"),
("SplitDouble", "(value)"),
("LoadOutputControlPoint", "(inputSigId,row,col,index)"),
("LoadPatchConstant", "(inputSigId,row,col)"),
("DomainLocation", "(component)"),
("StorePatchConstant", "(outputSigID,row,col,value)"),
("OutputControlPointID", "()"),
("PrimitiveID", "()"),
("CycleCounterLegacy", "()"),
("WaveIsFirstLane", "()"),
("WaveGetLaneIndex", "()"),
("WaveGetLaneCount", "()"),
("WaveAnyTrue", "(cond)"),
("WaveAllTrue", "(cond)"),
("WaveActiveAllEqual", "(value)"),
("WaveActiveBallot", "(cond)"),
("WaveReadLaneAt", "(value,lane)"),
("WaveReadLaneFirst", "(value)"),
("WaveActiveOp", "(value,op,sop)"),
("WaveActiveBit", "(value,op)"),
("WavePrefixOp", "(value,op,sop)"),
("QuadReadLaneAt", "(value,quadLane)"),
("QuadOp", "(value,op)"),
("BitcastI16toF16", "(value)"),
("BitcastF16toI16", "(value)"),
("BitcastI32toF32", "(value)"),
("BitcastF32toI32", "(value)"),
("BitcastI64toF64", "(value)"),
("BitcastF64toI64", "(value)"),
("LegacyF32ToF16", "(value)"),
("LegacyF16ToF32", "(value)"),
("LegacyDoubleToFloat", "(value)"),
("LegacyDoubleToSInt32", "(value)"),
("LegacyDoubleToUInt32", "(value)"),
("WaveAllBitCount", "(value)"),
("WavePrefixBitCount", "(value)"),
("AttributeAtVertex", "(inputSigId,inputRowIndex,inputColIndex,VertexID)"),
("ViewID", "()"),
("RawBufferLoad", "(srv,index,elementOffset,mask,alignment)"),
("RawBufferStore", "(uav,index,elementOffset,value0,value1,value2,value3,mask,alignment)"),
("InstanceID", "()"),
("InstanceIndex", "()"),
("HitKind", "()"),
("RayFlags", "()"),
("DispatchRaysIndex", "(col)"),
("DispatchRaysDimensions", "(col)"),
("WorldRayOrigin", "(col)"),
("WorldRayDirection", "(col)"),
("ObjectRayOrigin", "(col)"),
("ObjectRayDirection", "(col)"),
("ObjectToWorld", "(row,col)"),
("WorldToObject", "(row,col)"),
("RayTMin", "()"),
("RayTCurrent", "()"),
("IgnoreHit", "()"),
("AcceptHitAndEndSearch", "()"),
("TraceRay", "(AccelerationStructure,RayFlags,InstanceInclusionMask,RayContributionToHitGroupIndex,MultiplierForGeometryContributionToShaderIndex,MissShaderIndex,Origin_X,Origin_Y,Origin_Z,TMin,Direction_X,Direction_Y,Direction_Z,TMax,payload)"),
("ReportHit", "(THit,HitKind,Attributes)"),
("CallShader", "(ShaderIndex,Parameter)"),
("CreateHandleForLib", "(Resource)"),
("PrimitiveIndex", "()"),
("Dot2AddHalf", "(acc,ax,ay,bx,by)"),
("Dot4AddI8Packed", "(acc,a,b)"),
("Dot4AddU8Packed", "(acc,a,b)"),
("WaveMatch", "(value)"),
("WaveMultiPrefixOp", "(value,mask0,mask1,mask2,mask3,op,sop)"),
("WaveMultiPrefixBitCount", "(value,mask0,mask1,mask2,mask3)"),
("SetMeshOutputCounts", "(numVertices,numPrimitives)"),
("EmitIndices", "(PrimitiveIndex,VertexIndex0,VertexIndex1,VertexIndex2)"),
("GetMeshPayload", "()"),
("StoreVertexOutput", "(outputSigId,rowIndex,colIndex,value,vertexIndex)"),
("StorePrimitiveOutput", "(outputSigId,rowIndex,colIndex,value,primitiveIndex)"),
("DispatchMesh", "(threadGroupCountX,threadGroupCountY,threadGroupCountZ,payload)"),
("WriteSamplerFeedback", "(feedbackTex,sampledTex,sampler,c0,c1,c2,c3,clamp)"),
("WriteSamplerFeedbackBias", "(feedbackTex,sampledTex,sampler,c0,c1,c2,c3,bias,clamp)"),
("WriteSamplerFeedbackLevel", "(feedbackTex,sampledTex,sampler,c0,c1,c2,c3,lod)"),
("WriteSamplerFeedbackGrad", "(feedbackTex,sampledTex,sampler,c0,c1,c2,c3,ddx0,ddx1,ddx2,ddy0,ddy1,ddy2,clamp)"),
("AllocateRayQuery", "(constRayFlags)"),
("RayQuery_TraceRayInline", "(rayQueryHandle,accelerationStructure,rayFlags,instanceInclusionMask,origin_X,origin_Y,origin_Z,tMin,direction_X,direction_Y,direction_Z,tMax)"),
("RayQuery_Proceed", "(rayQueryHandle)"),
("RayQuery_Abort", "(rayQueryHandle)"),
("RayQuery_CommitNonOpaqueTriangleHit", "(rayQueryHandle)"),
("RayQuery_CommitProceduralPrimitiveHit", "(rayQueryHandle,t)"),
("RayQuery_CommittedStatus", "(rayQueryHandle)"),
("RayQuery_CandidateType", "(rayQueryHandle)"),
("RayQuery_CandidateObjectToWorld3x4", "(rayQueryHandle,row,col)"),
("RayQuery_CandidateWorldToObject3x4", "(rayQueryHandle,row,col)"),
("RayQuery_CommittedObjectToWorld3x4", "(rayQueryHandle,row,col)"),
("RayQuery_CommittedWorldToObject3x4", "(rayQueryHandle,row,col)"),
("RayQuery_CandidateProceduralPrimitiveNonOpaque", "(rayQueryHandle)"),
("RayQuery_CandidateTriangleFrontFace", "(rayQueryHandle)"),
("RayQuery_CommittedTriangleFrontFace", "(rayQueryHandle)"),
("RayQuery_CandidateTriangleBarycentrics", "(rayQueryHandle,component)"),
("RayQuery_CommittedTriangleBarycentrics", "(rayQueryHandle,component)"),
("RayQuery_RayFlags", "(rayQueryHandle)"),
("RayQuery_WorldRayOrigin", "(rayQueryHandle,component)"),
("RayQuery_WorldRayDirection", "(rayQueryHandle,component)"),
("RayQuery_RayTMin", "(rayQueryHandle)"),
("RayQuery_CandidateTriangleRayT", "(rayQueryHandle)"),
("RayQuery_CommittedRayT", "(rayQueryHandle)"),
("RayQuery_CandidateInstanceIndex", "(rayQueryHandle)"),
("RayQuery_CandidateInstanceID", "(rayQueryHandle)"),
("RayQuery_CandidateGeometryIndex", "(rayQueryHandle)"),
("RayQuery_CandidatePrimitiveIndex", "(rayQueryHandle)"),
("RayQuery_CandidateObjectRayOrigin", "(rayQueryHandle,component)"),
("RayQuery_CandidateObjectRayDirection", "(rayQueryHandle,component)"),
("RayQuery_CommittedInstanceIndex", "(rayQueryHandle)"),
("RayQuery_CommittedInstanceID", "(rayQueryHandle)"),
("RayQuery_CommittedGeometryIndex", "(rayQueryHandle)"),
("RayQuery_CommittedPrimitiveIndex", "(rayQueryHandle)"),
("RayQuery_CommittedObjectRayOrigin", "(rayQueryHandle,component)"),
("RayQuery_CommittedObjectRayDirection", "(rayQueryHandle,component)"),
("GeometryIndex", "()"),
("RayQuery_CandidateInstanceContributionToHitGroupIndex", "(rayQueryHandle)"),
("RayQuery_CommittedInstanceContributionToHitGroupIndex", "(rayQueryHandle)"),
("AnnotateHandle", "(res,props)"),
("CreateHandleFromBinding", "(bind,index,nonUniformIndex)"),
("CreateHandleFromHeap", "(index,samplerHeap,nonUniformIndex)"),
("Unpack4x8", "(unpackMode,pk)"),
("Pack4x8", "(packMode,x,y,z,w)"),
("IsHelperLane", "()"),
("QuadVote", "(cond,op)"),
("TextureGatherRaw", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1)"),
("SampleCmpLevel", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,offset2,compareValue,lod)"),
("TextureStoreSample", "(srv,coord0,coord1,coord2,value0,value1,value2,value3,mask,sampleIdx)"),
("Reserved0", "()"),
("Reserved1", "()"),
("Reserved2", "()"),
("Reserved3", "()"),
("Reserved4", "()"),
("Reserved5", "()"),
("Reserved6", "()"),
("Reserved7", "()"),
("Reserved8", "()"),
("Reserved9", "()"),
("Reserved10", "()"),
("Reserved11", "()"),
("AllocateNodeOutputRecords", "(output,numRecords,perThread)"),
("GetNodeRecordPtr", "(recordhandle,arrayIndex)"),
("IncrementOutputCount", "(output,count,perThread)"),
("OutputComplete", "(output)"),
("GetInputRecordCount", "(input)"),
("FinishedCrossGroupSharing", "(input)"),
("BarrierByMemoryType", "(MemoryTypeFlags,SemanticFlags)"),
("BarrierByMemoryHandle", "(object,SemanticFlags)"),
("BarrierByNodeRecordHandle", "(object,SemanticFlags)"),
("CreateNodeOutputHandle", "(MetadataIdx)"),
("IndexNodeHandle", "(NodeOutputHandle,ArrayIndex)"),
("AnnotateNodeHandle", "(node,props)"),
("CreateNodeInputRecordHandle", "(MetadataIdx)"),
("AnnotateNodeRecordHandle", "(noderecord,props)"),
("NodeOutputIsValid", "(output)"),
("GetRemainingRecursionLevels", "()"),
("SampleCmpGrad", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,offset2,compareValue,ddx0,ddx1,ddx2,ddy0,ddy1,ddy2,clamp)"),
("SampleCmpBias", "(srv,sampler,coord0,coord1,coord2,coord3,offset0,offset1,offset2,compareValue,bias,clamp)"),
("StartVertexLocation", "()"),
("StartInstanceLocation", "()"),
("AllocateRayQuery2", "(constRayFlags,constRayQueryFlags)"),
("ReservedA0", "()"),
("ReservedA1", "()"),
("ReservedA2", "()"),
("HitObject_TraceRay", "(accelerationStructure,rayFlags,instanceInclusionMask,rayContributionToHitGroupIndex,multiplierForGeometryContributionToHitGroupIndex,missShaderIndex,Origin_X,Origin_Y,Origin_Z,TMin,Direction_X,Direction_Y,Direction_Z,TMax,payload)"),
("HitObject_FromRayQuery", "(rayQueryHandle)"),
("HitObject_FromRayQueryWithAttrs", "(rayQueryHandle,HitKind,CommittedAttribs)"),
("HitObject_MakeMiss", "(RayFlags,MissShaderIndex,Origin_X,Origin_Y,Origin_Z,TMin,Direction_X,Direction_Y,Direction_Z,TMax)"),
("HitObject_MakeNop", "()"),
("HitObject_Invoke", "(hitObject,payload)"),
("MaybeReorderThread", "(hitObject,coherenceHint,numCoherenceHintBitsFromLSB)"),
("HitObject_IsMiss", "(hitObject)"),
("HitObject_IsHit", "(hitObject)"),
("HitObject_IsNop", "(hitObject)"),
("HitObject_RayFlags", "(hitObject)"),
("HitObject_RayTMin", "(hitObject)"),
("HitObject_RayTCurrent", "(hitObject)"),
("HitObject_WorldRayOrigin", "(hitObject,component)"),
("HitObject_WorldRayDirection", "(hitObject,component)"),
("HitObject_ObjectRayOrigin", "(hitObject,component)"),
("HitObject_ObjectRayDirection", "(hitObject,component)"),
("HitObject_ObjectToWorld3x4", "(hitObject,row,col)"),
("HitObject_WorldToObject3x4", "(hitObject,row,col)"),
("HitObject_GeometryIndex", "(hitObject)"),
("HitObject_InstanceIndex", "(hitObject)"),
("HitObject_InstanceID", "(hitObject)"),
("HitObject_PrimitiveIndex", "(hitObject)"),
("HitObject_HitKind", "(hitObject)"),
("HitObject_ShaderTableIndex", "(hitObject)"),
("HitObject_SetShaderTableIndex", "(hitObject,shaderTableIndex)"),
("HitObject_LoadLocalRootTableConstant", "(hitObject,offset)"),
("HitObject_Attributes", "(hitObject,attributes)"),
("ReservedB28", "()"),
("ReservedB29", "()"),
("ReservedB30", "()"),
("ReservedC0", "()"),
("ReservedC1", "()"),
("ReservedC2", "()"),
("ReservedC3", "()"),
("ReservedC4", "()"),
("ReservedC5", "()"),
("ReservedC6", "()"),
("ReservedC7", "()"),
("ReservedC8", "()"),
("ReservedC9", "()"),
("RawBufferVectorLoad", "(buf,index,elementOffset,alignment)"),
("RawBufferVectorStore", "(uav,index,elementOffset,value0,alignment)"),
("ReservedD0", "()"),
("ReservedD1", "()"),
("ReservedD2", "()"),
("ReservedD3", "()"),
("VectorReduceAnd", "(a)"),
("VectorReduceOr", "(a)"),
("FDot", "(a,b)"),
];
pub(crate) const EXPERIMENTAL_OPS: [(&str, &str); 35] = [
("ExperimentalNop", "()"),
("GetGroupWaveIndex", "()"),
("GetGroupWaveCount", "()"),
("ClusterID", "()"),
("RayQuery_CandidateClusterID", "(rayQueryHandle)"),
("RayQuery_CommittedClusterID", "(rayQueryHandle)"),
("HitObject_ClusterID", "(hitObject)"),
("TriangleObjectPosition", "()"),
("RayQuery_CandidateTriangleObjectPosition", "(rayQueryHandle)"),
("RayQuery_CommittedTriangleObjectPosition", "(rayQueryHandle)"),
("HitObject_TriangleObjectPosition", "(hitObject)"),
("LinAlgMatrixMultiplyAccumulate", "(matrixA,matrixB,matrixC)"),
("LinAlgFillMatrix", "(value)"),
("LinAlgCopyConvertMatrix", "(srcMatrix,transpose)"),
("LinAlgMatrixLoadFromDescriptor", "(handle,offset,stride,layout,align)"),
("LinAlgMatrixLoadFromMemory", "(memory,offset,stride,layout)"),
("LinAlgMatrixLength", "(matrix)"),
("LinAlgMatrixGetCoordinate", "(matrix,threadLocalIndex)"),
("LinAlgMatrixGetElement", "(matrix,threadLocalIndex)"),
("LinAlgMatrixSetElement", "(matrix,threadLocalIndex,value)"),
("LinAlgMatrixStoreToDescriptor", "(matrix,handle,offset,stride,layout,align)"),
("LinAlgMatrixStoreToMemory", "(matrix,memory,offset,stride,layout)"),
("LinAlgMatrixQueryAccumulatorLayout", "()"),
("LinAlgMatrixMultiply", "(matrixA,matrixB)"),
("LinAlgMatrixAccumulate", "(matrixLHS,matrixRHS)"),
("LinAlgMatVecMul", "(matrix,isOutputSigned,inputVector,interpretation)"),
("LinAlgMatVecMulAdd", "(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector)"),
("LinAlgMatrixAccumulateToDescriptor", "(matrix,handle,offset,stride,layout,align)"),
("LinAlgMatrixAccumulateToMemory", "(matrix,memory,offset,stride,layout)"),
("LinAlgMatrixOuterProduct", "(vectorA,vectorB)"),
("LinAlgConvert", "(inputVector,inputInterpretation,outputInterpretation)"),
("LinAlgVectorAccumulateToDescriptor", "(handle,offset,align,vector)"),
("ReservedE0", "()"),
("DebugBreak", "()"),
("IsDebuggingEnabled", "()"),
];
pub(crate) fn operation(opcode: u32) -> Option<(&'static str, &'static str)> {
let index = usize::try_from(opcode & 0xFFFF).ok()?;
match opcode >> 16 {
0x0 => CORE_OPS.get(index).copied(),
0x8000 => EXPERIMENTAL_OPS.get(index).copied(),
_ => None,
}
}