diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index e03682959a..0f5ed0cd4d 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -4512,7 +4512,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { case OpCode::CheckAccessFullyMapped: A(pI1); A(pI32); - A(pI32); + A(pETy); break; case OpCode::GetDimensions: A(pDim); @@ -4600,9 +4600,9 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pI32); A(pRes); A(pRes); - A(pF32); - A(pF32); - A(pF32); + A(pETy); + A(pETy); + A(pETy); A(pI1); break; @@ -4661,36 +4661,36 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pI8); break; case OpCode::SampleIndex: - A(pI32); + A(pETy); A(pI32); break; case OpCode::Coverage: - A(pI32); + A(pETy); A(pI32); break; case OpCode::InnerCoverage: - A(pI32); + A(pETy); A(pI32); break; // Compute/Mesh/Amplification/Node shader case OpCode::ThreadId: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::GroupId: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::ThreadIdInGroup: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::FlattenedThreadIdInGroup: - A(pI32); + A(pETy); A(pI32); break; @@ -4711,13 +4711,13 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pI8); break; case OpCode::GSInstanceID: - A(pI32); + A(pETy); A(pI32); break; // Double precision case OpCode::MakeDouble: - A(pF64); + A(pETy); A(pI32); A(pI32); A(pI32); @@ -4725,7 +4725,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { case OpCode::SplitDouble: A(pSDT); A(pI32); - A(pF64); + A(pETy); break; // Domain and hull shader @@ -4747,7 +4747,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { // Domain shader case OpCode::DomainLocation: - A(pF32); + A(pETy); A(pI32); A(pI8); break; @@ -4762,13 +4762,13 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pETy); break; case OpCode::OutputControlPointID: - A(pI32); + A(pETy); A(pI32); break; // Hull, Domain and Geometry shaders case OpCode::PrimitiveID: - A(pI32); + A(pETy); A(pI32); break; @@ -4942,7 +4942,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { // Graphics shader case OpCode::ViewID: - A(pI32); + A(pETy); A(pI32); break; @@ -4972,71 +4972,71 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { // Raytracing object space uint System Values case OpCode::InstanceID: - A(pI32); + A(pETy); A(pI32); break; case OpCode::InstanceIndex: - A(pI32); + A(pETy); A(pI32); break; // Raytracing hit uint System Values case OpCode::HitKind: - A(pI32); + A(pETy); A(pI32); break; // Raytracing uint System Values case OpCode::RayFlags: - A(pI32); + A(pETy); A(pI32); break; // Ray Dispatch Arguments case OpCode::DispatchRaysIndex: - A(pI32); + A(pETy); A(pI32); A(pI8); break; case OpCode::DispatchRaysDimensions: - A(pI32); + A(pETy); A(pI32); A(pI8); break; // Ray Vectors case OpCode::WorldRayOrigin: - A(pF32); + A(pETy); A(pI32); A(pI8); break; case OpCode::WorldRayDirection: - A(pF32); + A(pETy); A(pI32); A(pI8); break; // Ray object space Vectors case OpCode::ObjectRayOrigin: - A(pF32); + A(pETy); A(pI32); A(pI8); break; case OpCode::ObjectRayDirection: - A(pF32); + A(pETy); A(pI32); A(pI8); break; // Ray Transforms case OpCode::ObjectToWorld: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); break; case OpCode::WorldToObject: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); @@ -5044,11 +5044,11 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { // RayT case OpCode::RayTMin: - A(pF32); + A(pETy); A(pI32); break; case OpCode::RayTCurrent: - A(pF32); + A(pETy); A(pI32); break; @@ -5105,7 +5105,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { // Raytracing object space uint System Values case OpCode::PrimitiveIndex: - A(pI32); + A(pETy); A(pI32); break; @@ -5120,16 +5120,16 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pF16); break; case OpCode::Dot4AddI8Packed: + A(pETy); A(pI32); - A(pI32); - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::Dot4AddU8Packed: + A(pETy); A(pI32); - A(pI32); - A(pI32); + A(pETy); A(pI32); A(pI32); break; @@ -5289,7 +5289,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pF32); break; case OpCode::RayQuery_Proceed: - A(pI1); + A(pETy); A(pI32); A(pI32); break; @@ -5310,162 +5310,162 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pF32); break; case OpCode::RayQuery_CommittedStatus: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidateType: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidateObjectToWorld3x4: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_CandidateWorldToObject3x4: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_CommittedObjectToWorld3x4: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_CommittedWorldToObject3x4: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_CandidateProceduralPrimitiveNonOpaque: - A(pI1); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidateTriangleFrontFace: - A(pI1); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CommittedTriangleFrontFace: - A(pI1); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidateTriangleBarycentrics: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_CommittedTriangleBarycentrics: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_RayFlags: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_WorldRayOrigin: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_WorldRayDirection: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_RayTMin: - A(pF32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidateTriangleRayT: - A(pF32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CommittedRayT: - A(pF32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidateInstanceIndex: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidateInstanceID: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidateGeometryIndex: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidatePrimitiveIndex: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CandidateObjectRayOrigin: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_CandidateObjectRayDirection: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_CommittedInstanceIndex: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CommittedInstanceID: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CommittedGeometryIndex: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CommittedPrimitiveIndex: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CommittedObjectRayOrigin: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); break; case OpCode::RayQuery_CommittedObjectRayDirection: - A(pF32); + A(pETy); A(pI32); A(pI32); A(pI8); @@ -5473,18 +5473,18 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { // Raytracing object space uint System Values, raytracing tier 1.1 case OpCode::GeometryIndex: - A(pI32); + A(pETy); A(pI32); break; // Inline Ray Query case OpCode::RayQuery_CandidateInstanceContributionToHitGroupIndex: - A(pI32); + A(pETy); A(pI32); A(pI32); break; case OpCode::RayQuery_CommittedInstanceContributionToHitGroupIndex: - A(pI32); + A(pETy); A(pI32); A(pI32); break; @@ -5532,7 +5532,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { // Helper Lanes case OpCode::IsHelperLane: - A(pI1); + A(pETy); A(pI32); break; @@ -5784,11 +5784,11 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { // Extended Command Information case OpCode::StartVertexLocation: - A(pI32); + A(pETy); A(pI32); break; case OpCode::StartInstanceLocation: - A(pI32); + A(pETy); A(pI32); break; @@ -5878,100 +5878,100 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pI32); break; case OpCode::HitObject_IsMiss: - A(pI1); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_IsHit: - A(pI1); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_IsNop: - A(pI1); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_RayFlags: - A(pI32); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_RayTMin: - A(pF32); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_RayTCurrent: - A(pF32); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_WorldRayOrigin: - A(pF32); + A(pETy); A(pI32); A(pHit); A(pI32); break; case OpCode::HitObject_WorldRayDirection: - A(pF32); + A(pETy); A(pI32); A(pHit); A(pI32); break; case OpCode::HitObject_ObjectRayOrigin: - A(pF32); + A(pETy); A(pI32); A(pHit); A(pI32); break; case OpCode::HitObject_ObjectRayDirection: - A(pF32); + A(pETy); A(pI32); A(pHit); A(pI32); break; case OpCode::HitObject_ObjectToWorld3x4: - A(pF32); + A(pETy); A(pI32); A(pHit); A(pI32); A(pI32); break; case OpCode::HitObject_WorldToObject3x4: - A(pF32); + A(pETy); A(pI32); A(pHit); A(pI32); A(pI32); break; case OpCode::HitObject_GeometryIndex: - A(pI32); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_InstanceIndex: - A(pI32); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_InstanceID: - A(pI32); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_PrimitiveIndex: - A(pI32); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_HitKind: - A(pI32); + A(pETy); A(pI32); A(pHit); break; case OpCode::HitObject_ShaderTableIndex: - A(pI32); + A(pETy); A(pI32); A(pHit); break; @@ -6314,6 +6314,8 @@ llvm::Type *OP::GetOverloadType(OpCode opCode, llvm::Function *F) { case OpCode::UDiv: case OpCode::UAddc: case OpCode::USubb: + case OpCode::CheckAccessFullyMapped: + case OpCode::SplitDouble: case OpCode::WaveActiveAllEqual: case OpCode::CreateHandleForLib: case OpCode::WaveMatch: @@ -6329,16 +6331,17 @@ llvm::Type *OP::GetOverloadType(OpCode opCode, llvm::Function *F) { if (FT->getNumParams() <= 5) return nullptr; return FT->getParamType(5); - case OpCode::TraceRay: - case OpCode::HitObject_TraceRay: - if (FT->getNumParams() <= 15) - return nullptr; - return FT->getParamType(15); + case OpCode::CalculateLOD: case OpCode::ReportHit: case OpCode::HitObject_FromRayQueryWithAttrs: if (FT->getNumParams() <= 3) return nullptr; return FT->getParamType(3); + case OpCode::TraceRay: + case OpCode::HitObject_TraceRay: + if (FT->getNumParams() <= 15) + return nullptr; + return FT->getParamType(15); case OpCode::CreateHandle: case OpCode::BufferUpdateCounter: case OpCode::GetDimensions: @@ -6439,97 +6442,7 @@ llvm::Type *OP::GetOverloadType(OpCode opCode, llvm::Function *F) { case OpCode::ReservedC9: case OpCode::ExperimentalNop: return Type::getVoidTy(Ctx); - case OpCode::CheckAccessFullyMapped: - case OpCode::SampleIndex: - case OpCode::Coverage: - case OpCode::InnerCoverage: - case OpCode::ThreadId: - case OpCode::GroupId: - case OpCode::ThreadIdInGroup: - case OpCode::FlattenedThreadIdInGroup: - case OpCode::GSInstanceID: - case OpCode::OutputControlPointID: - case OpCode::PrimitiveID: - case OpCode::ViewID: - case OpCode::InstanceID: - case OpCode::InstanceIndex: - case OpCode::HitKind: - case OpCode::RayFlags: - case OpCode::DispatchRaysIndex: - case OpCode::DispatchRaysDimensions: - case OpCode::PrimitiveIndex: - case OpCode::Dot4AddI8Packed: - case OpCode::Dot4AddU8Packed: - case OpCode::RayQuery_CommittedStatus: - case OpCode::RayQuery_CandidateType: - case OpCode::RayQuery_RayFlags: - case OpCode::RayQuery_CandidateInstanceIndex: - case OpCode::RayQuery_CandidateInstanceID: - case OpCode::RayQuery_CandidateGeometryIndex: - case OpCode::RayQuery_CandidatePrimitiveIndex: - case OpCode::RayQuery_CommittedInstanceIndex: - case OpCode::RayQuery_CommittedInstanceID: - case OpCode::RayQuery_CommittedGeometryIndex: - case OpCode::RayQuery_CommittedPrimitiveIndex: - case OpCode::GeometryIndex: - case OpCode::RayQuery_CandidateInstanceContributionToHitGroupIndex: - case OpCode::RayQuery_CommittedInstanceContributionToHitGroupIndex: - case OpCode::StartVertexLocation: - case OpCode::StartInstanceLocation: - case OpCode::HitObject_RayFlags: - case OpCode::HitObject_GeometryIndex: - case OpCode::HitObject_InstanceIndex: - case OpCode::HitObject_InstanceID: - case OpCode::HitObject_PrimitiveIndex: - case OpCode::HitObject_HitKind: - case OpCode::HitObject_ShaderTableIndex: - return IntegerType::get(Ctx, 32); - case OpCode::CalculateLOD: - case OpCode::DomainLocation: - case OpCode::WorldRayOrigin: - case OpCode::WorldRayDirection: - case OpCode::ObjectRayOrigin: - case OpCode::ObjectRayDirection: - case OpCode::ObjectToWorld: - case OpCode::WorldToObject: - case OpCode::RayTMin: - case OpCode::RayTCurrent: - case OpCode::RayQuery_CandidateObjectToWorld3x4: - case OpCode::RayQuery_CandidateWorldToObject3x4: - case OpCode::RayQuery_CommittedObjectToWorld3x4: - case OpCode::RayQuery_CommittedWorldToObject3x4: - case OpCode::RayQuery_CandidateTriangleBarycentrics: - case OpCode::RayQuery_CommittedTriangleBarycentrics: - case OpCode::RayQuery_WorldRayOrigin: - case OpCode::RayQuery_WorldRayDirection: - case OpCode::RayQuery_RayTMin: - case OpCode::RayQuery_CandidateTriangleRayT: - case OpCode::RayQuery_CommittedRayT: - case OpCode::RayQuery_CandidateObjectRayOrigin: - case OpCode::RayQuery_CandidateObjectRayDirection: - case OpCode::RayQuery_CommittedObjectRayOrigin: - case OpCode::RayQuery_CommittedObjectRayDirection: - case OpCode::HitObject_RayTMin: - case OpCode::HitObject_RayTCurrent: - case OpCode::HitObject_WorldRayOrigin: - case OpCode::HitObject_WorldRayDirection: - case OpCode::HitObject_ObjectRayOrigin: - case OpCode::HitObject_ObjectRayDirection: - case OpCode::HitObject_ObjectToWorld3x4: - case OpCode::HitObject_WorldToObject3x4: - return Type::getFloatTy(Ctx); - case OpCode::MakeDouble: - case OpCode::SplitDouble: - return Type::getDoubleTy(Ctx); - case OpCode::RayQuery_Proceed: - case OpCode::RayQuery_CandidateProceduralPrimitiveNonOpaque: - case OpCode::RayQuery_CandidateTriangleFrontFace: - case OpCode::RayQuery_CommittedTriangleFrontFace: - case OpCode::IsHelperLane: case OpCode::QuadVote: - case OpCode::HitObject_IsMiss: - case OpCode::HitObject_IsHit: - case OpCode::HitObject_IsNop: return IntegerType::get(Ctx, 1); case OpCode::CBufferLoadLegacy: case OpCode::Sample: diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 80356580b0..f85fc45013 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -162,10 +162,45 @@ def process_oload_types(self): self.num_oloads = 0 + # TODO: Overload Note: There are operations that really didn't need + # overload types, and originally did not use any overload types in the + # operands, but specified a single overload type in the oload_types. + # These have been updated to use the overload type in the appropriate + # place, rather than changing the overload type to "v", because Changing + # the oload_types to "v" would change the name of the function in DXIL, + # which could be breaking for some DXIL consumers, depending on how they + # interpret the DXIL. So, there are "TODO: Overload Note:" comments on + # certain DXIL op definitions to indicate these cases. + # These could be cleaned up in the future, but it's unlikely to ever be + # a priority, or worth the risk. + + # Other cases specified one overload type and could potentially have + # used the specified overload, but were not currently using it in the + # operands (like system value getters). These have been updated to use + # the overload type in the operands, without adding the comment, and may + # add overload support in the future (like for half or int16). + + def uses_oload_types(inst): + "Return true if any operand uses an overload type." + for op in inst.ops: + # All overload types start with a '$' + if op.llvm_type[0] == "$": + return True + # Early out for void overloads. if self.oload_types == "v": + if uses_oload_types(self): + raise ValueError( + f"void overloads 'v' used with overloaded operand type(s) for '({self.name})'" + ) return + if not uses_oload_types(self): + raise ValueError( + f"'({self.name})' specifies overloads ({self.oload_types}), " + + "but no overload types used in operands" + ) + if self.oload_types == "": raise ValueError( f"overload for '{self.name}' should not be empty - use void if n/a" @@ -2456,6 +2491,11 @@ def UFI(name, **mappings): ], counters=("atomic",), ) + # TODO: Overload Note: CheckAccessFullyMapped is overloaded "i", but + # shouldn't be. Operand 2 used to be "u32", but since overloaded + # functions should use an overload type, it currently uses "$o". "u32" + # shouldn't even exist, so if fixing this, we should change the + # overloads to "v" and operand 2 to "i32". add_dxil_op( "CheckAccessFullyMapped", "CheckAccessFullyMapped", @@ -2471,7 +2511,7 @@ def UFI(name, **mappings): ), db_dxil_param( 2, - "u32", + "$o", "status", "status result from the Sample, Gather or Load operation", ), @@ -2667,6 +2707,9 @@ def UFI(name, **mappings): ) # Pixel shader + # TODO: Overload Note: CalculateLOD is overloaded "f", but didn't use + # any overload type. Operands 4-6 used to be "f", but have been changed + # to use the overload type "$o". add_dxil_op( "CalculateLOD", "CalculateLOD", @@ -2677,9 +2720,9 @@ def UFI(name, **mappings): db_dxil_param(0, "f", "", "level of detail"), db_dxil_param(2, "res", "handle", "resource handle"), db_dxil_param(3, "res", "sampler", "sampler handle"), - db_dxil_param(4, "f", "coord0", "coordinate"), - db_dxil_param(5, "f", "coord1", "coordinate"), - db_dxil_param(6, "f", "coord2", "coordinate"), + db_dxil_param(4, "$o", "coord0", "coordinate"), + db_dxil_param(5, "$o", "coord1", "coordinate"), + db_dxil_param(6, "$o", "coord2", "coordinate"), db_dxil_param( 7, "i1", @@ -2835,7 +2878,7 @@ def UFI(name, **mappings): "returns the sample index in a sample-frequency pixel shader", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( "Coverage", @@ -2843,7 +2886,7 @@ def UFI(name, **mappings): "returns the coverage mask input in a pixel shader", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( "InnerCoverage", @@ -2851,7 +2894,7 @@ def UFI(name, **mappings): "returns underestimated coverage input from conservative rasterization in a pixel shader", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) # Compute shader. @@ -2862,7 +2905,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "thread ID component"), + db_dxil_param(0, "$o", "", "thread ID component"), db_dxil_param(2, "i32", "component", "component to read (x,y,z)"), ], ) @@ -2873,7 +2916,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "group ID component"), + db_dxil_param(0, "$o", "", "group ID component"), db_dxil_param(2, "i32", "component", "component to read"), ], ) @@ -2884,7 +2927,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "thread ID in group component"), + db_dxil_param(0, "$o", "", "thread ID in group component"), db_dxil_param(2, "i32", "component", "component to read (x,y,z)"), ], ) @@ -2894,7 +2937,7 @@ def UFI(name, **mappings): "provides a flattened index for a given thread within a given group (SV_GroupIndex)", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) # Geometry shader @@ -2940,10 +2983,12 @@ def UFI(name, **mappings): "GSInstanceID", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) # Double precision + # TODO: Overload Note: MakeDouble is overloaded "d", but didn't use any + # overload type. The result has been set to "$o" for consistency. add_dxil_op( "MakeDouble", "MakeDouble", @@ -2951,11 +2996,13 @@ def UFI(name, **mappings): "d", "rn", [ - db_dxil_param(0, "d", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i32", "lo", "low part of double"), db_dxil_param(3, "i32", "hi", "high part of double"), ], ) + # TODO: Overload Note: SplitDouble is overloaded "d", but didn't use any + # overload type. Operand 2 has been set to "$o" for consistency. add_dxil_op( "SplitDouble", "SplitDouble", @@ -2964,7 +3011,7 @@ def UFI(name, **mappings): "rn", [ db_dxil_param(0, "splitdouble", "", "result"), - db_dxil_param(2, "d", "value", "value to split"), + db_dxil_param(2, "$o", "value", "value to split"), ], ) @@ -3007,7 +3054,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i8", "component", "input", is_const=True), ], ) @@ -3034,7 +3081,7 @@ def UFI(name, **mappings): "OutputControlPointID", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( "PrimitiveID", @@ -3042,7 +3089,7 @@ def UFI(name, **mappings): "PrimitiveID", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( @@ -3479,7 +3526,7 @@ def UFI(name, **mappings): "returns the view index", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) # End of DXIL 1.1 opcodes. @@ -3574,7 +3621,7 @@ def UFI(name, **mappings): "The user-provided InstanceID on the bottom-level acceleration structure instance within the top-level structure", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( @@ -3583,7 +3630,7 @@ def UFI(name, **mappings): "The autogenerated index of the current instance in the top-level structure", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( @@ -3592,7 +3639,7 @@ def UFI(name, **mappings): "Returns the value passed as HitKind in ReportIntersection(). If intersection was reported by fixed-function triangle intersection, HitKind will be one of HIT_KIND_TRIANGLE_FRONT_FACE or HIT_KIND_TRIANGLE_BACK_FACE.", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( @@ -3601,7 +3648,7 @@ def UFI(name, **mappings): "uint containing the current ray flags.", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( @@ -3611,7 +3658,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i8", "col", "column, relative to the element"), ], ) @@ -3623,7 +3670,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i8", "col", "column, relative to the element"), ], ) @@ -3635,7 +3682,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i8", "col", "column, relative to the element"), ], ) @@ -3647,7 +3694,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i8", "col", "column, relative to the element"), ], ) @@ -3659,7 +3706,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i8", "col", "column, relative to the element"), ], ) @@ -3671,7 +3718,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i8", "col", "column, relative to the element"), ], ) @@ -3683,7 +3730,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i32", "row", "row, relative to the element"), db_dxil_param(3, "i8", "col", "column, relative to the element"), ], @@ -3696,7 +3743,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "result"), + db_dxil_param(0, "$o", "", "result"), db_dxil_param(2, "i32", "row", "row, relative to the element"), db_dxil_param(3, "i8", "col", "column, relative to the element"), ], @@ -3708,7 +3755,7 @@ def UFI(name, **mappings): "float representing the parametric starting point for the ray.", "f", "rn", - [db_dxil_param(0, "f", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( @@ -3717,7 +3764,7 @@ def UFI(name, **mappings): "float representing the current parametric ending point for the ray", "f", "ro", - [db_dxil_param(0, "f", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( @@ -3787,7 +3834,7 @@ def UFI(name, **mappings): db_dxil_param(15, "f", "TMax", "Tmax of the ray"), db_dxil_param( 16, - "udt", + "$udt", "payload", "User-defined intersection attribute structure", ), @@ -3813,7 +3860,7 @@ def UFI(name, **mappings): ), db_dxil_param( 4, - "udt", + "$udt", "Attributes", "User-defined intersection attribute structure", ), @@ -3836,7 +3883,7 @@ def UFI(name, **mappings): ), db_dxil_param( 3, - "udt", + "$udt", "Parameter", "User-defined parameters to pass to the callable shader,This parameter structure must match the parameter structure used in the callable shader pointed to in the shader table", ), @@ -3851,7 +3898,7 @@ def UFI(name, **mappings): "ro", [ db_dxil_param(0, "res", "", "result"), - db_dxil_param(2, "obj", "Resource", "resource to create the handle"), + db_dxil_param(2, "$obj", "Resource", "resource to create the handle"), ], ) @@ -3862,7 +3909,7 @@ def UFI(name, **mappings): "PrimitiveIndex for raytracing shaders", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) # End of DXIL 1.3 opcodes. @@ -3898,8 +3945,8 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "accumulated result"), - db_dxil_param(2, "i32", "acc", "input accumulator"), + db_dxil_param(0, "$o", "", "accumulated result"), + db_dxil_param(2, "$o", "acc", "input accumulator"), db_dxil_param(3, "i32", "a", "first packed 4 x i8 for dot product"), db_dxil_param(4, "i32", "b", "second packed 4 x i8 for dot product"), ], @@ -3913,8 +3960,8 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "accumulated result"), - db_dxil_param(2, "i32", "acc", "input accumulator"), + db_dxil_param(0, "$o", "", "accumulated result"), + db_dxil_param(2, "$o", "acc", "input accumulator"), db_dxil_param(3, "i32", "a", "first packed 4 x u8 for dot product"), db_dxil_param(4, "i32", "b", "second packed 4 x u8 for dot product"), ], @@ -4277,7 +4324,7 @@ def UFI(name, **mappings): "1", "", [ - db_dxil_param(0, "i1", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4328,7 +4375,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4340,7 +4387,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4352,7 +4399,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i32", "row", "row [0..2], relative to the element"), db_dxil_param(4, "i8", "col", "column [0..3], relative to the element"), @@ -4366,7 +4413,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i32", "row", "row [0..2], relative to the element"), db_dxil_param(4, "i8", "col", "column [0..3], relative to the element"), @@ -4380,7 +4427,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i32", "row", "row [0..2], relative to the element"), db_dxil_param(4, "i8", "col", "column [0..3], relative to the element"), @@ -4394,7 +4441,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i32", "row", "row [0..2], relative to the element"), db_dxil_param(4, "i8", "col", "column [0..3], relative to the element"), @@ -4408,7 +4455,7 @@ def UFI(name, **mappings): "1", "ro", [ - db_dxil_param(0, "i1", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4420,7 +4467,7 @@ def UFI(name, **mappings): "1", "ro", [ - db_dxil_param(0, "i1", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4432,7 +4479,7 @@ def UFI(name, **mappings): "1", "ro", [ - db_dxil_param(0, "i1", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4444,7 +4491,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i8", "component", "component [0..2]", is_const=True), ], @@ -4457,7 +4504,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i8", "component", "component [0..2]", is_const=True), ], @@ -4470,7 +4517,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4482,7 +4529,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i8", "component", "component [0..2]", is_const=True), ], @@ -4495,7 +4542,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i8", "component", "component [0..2]", is_const=True), ], @@ -4508,7 +4555,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4520,7 +4567,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4532,7 +4579,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4544,7 +4591,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4556,7 +4603,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4568,7 +4615,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4580,7 +4627,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4592,7 +4639,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i8", "component", "component [0..2]", is_const=True), ], @@ -4605,7 +4652,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i8", "component", "component [0..2]", is_const=True), ], @@ -4618,7 +4665,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4630,7 +4677,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4642,7 +4689,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4654,7 +4701,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4666,7 +4713,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i8", "component", "component [0..2]", is_const=True), ], @@ -4679,7 +4726,7 @@ def UFI(name, **mappings): "f", "ro", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), db_dxil_param(3, "i8", "component", "component [0..2]", is_const=True), ], @@ -4691,7 +4738,7 @@ def UFI(name, **mappings): "The autogenerated index of the current geometry in the bottom-level structure", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( @@ -4701,7 +4748,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4713,7 +4760,7 @@ def UFI(name, **mappings): "i", "ro", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -4821,13 +4868,16 @@ def UFI(name, **mappings): ], ) + # TODO: Overload Note: IsHelperLane specifies overloads "1", but does + # not need to be overloaded. For consistency, the return type uses $o + # for the definition, which will always be i1. add_dxil_op( "IsHelperLane", "IsHelperLane", "returns true on helper lanes in pixel shaders", "1", "ro", - [db_dxil_param(0, "i1", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) # End of DXIL 1.6 opcodes. @@ -5341,7 +5391,7 @@ def UFI(name, **mappings): "returns the BaseVertexLocation from DrawIndexedInstanced or StartVertexLocation from DrawInstanced", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) add_dxil_op( @@ -5350,7 +5400,7 @@ def UFI(name, **mappings): "returns the StartInstanceLocation from Draw*Instanced", "i", "rn", - [db_dxil_param(0, "i32", "", "result")], + [db_dxil_param(0, "$o", "", "result")], ) # End of DXIL 1.8 opcodes. @@ -5444,7 +5494,7 @@ def UFI(name, **mappings): db_dxil_param(15, "f", "TMax", "Tmax of the ray"), db_dxil_param( 16, - "udt", + "$udt", "payload", "User-defined payload structure", ), @@ -5482,7 +5532,7 @@ def UFI(name, **mappings): "HitKind", "User-specified value in range of 0-127 to identify the type of hit", ), - db_dxil_param(4, "udt", "CommittedAttribs", "Committed attributes"), + db_dxil_param(4, "$udt", "CommittedAttribs", "Committed attributes"), ], ) @@ -5527,7 +5577,7 @@ def UFI(name, **mappings): db_dxil_param(2, "hit_object", "hitObject", "hit"), db_dxil_param( 3, - "udt", + "$udt", "payload", "User-defined payload structure", ), @@ -5560,7 +5610,7 @@ def UFI(name, **mappings): "1", "rn", [ - db_dxil_param(0, "i1", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5572,7 +5622,7 @@ def UFI(name, **mappings): "1", "rn", [ - db_dxil_param(0, "i1", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5584,7 +5634,7 @@ def UFI(name, **mappings): "1", "rn", [ - db_dxil_param(0, "i1", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5596,7 +5646,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5608,7 +5658,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5620,7 +5670,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5632,7 +5682,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), db_dxil_param(3, "i32", "component", "component [0..2]", is_const=True), ], @@ -5645,7 +5695,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), db_dxil_param(3, "i32", "component", "component [0..2]", is_const=True), ], @@ -5658,7 +5708,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), db_dxil_param(3, "i32", "component", "component [0..2]", is_const=True), ], @@ -5671,7 +5721,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), db_dxil_param(3, "i32", "component", "component [0..2]", is_const=True), ], @@ -5684,7 +5734,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), db_dxil_param( 3, @@ -5710,7 +5760,7 @@ def UFI(name, **mappings): "f", "rn", [ - db_dxil_param(0, "f", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), db_dxil_param( 3, @@ -5736,7 +5786,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5748,7 +5798,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5760,7 +5810,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5772,7 +5822,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5784,7 +5834,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5796,7 +5846,7 @@ def UFI(name, **mappings): "i", "rn", [ - db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(0, "$o", "", "operation result"), db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) @@ -5839,7 +5889,7 @@ def UFI(name, **mappings): retvoid_param, db_dxil_param(2, "hit_object", "hitObject", "hit"), db_dxil_param( - 3, "udt", "attributes", "pointer to store the attributes to" + 3, "$udt", "attributes", "pointer to store the attributes to" ), ], ) @@ -6110,10 +6160,12 @@ def finalize_dxil_operations(self): ) self.verify_dense(i.ops, lambda x: x.pos, lambda x: i.name) - # Verify that all operations in each class have the same signature. + self.verify_dxil_op_classes() + + def verify_dxil_op_classes(self): + "Verify that all DXIL operations in each class have the same signature." import itertools - class_sort_func = lambda x, y: x < y class_key_func = lambda x: x.dxil_class instr_ordered_by_class = sorted(self.get_dxil_ops(), key=class_key_func) instr_grouped_by_class = itertools.groupby( @@ -6121,20 +6173,39 @@ def finalize_dxil_operations(self): ) def calc_oload_sig(inst): - result = "" - for o in inst.ops: - result += o.llvm_type + # if function class is ever overloaded, no "v" oload should be used + oload = inst.oload_types == "v" and "void" or "overloaded" + result = f"{inst.fn_attr}|{oload}(" + result += ",".join([o.llvm_type for o in inst.ops]) + ")" return result + inconsistencies = [] for k, g in instr_grouped_by_class: + inconsistencies_in_class = [] group = list(g) if len(group) > 1: first = group[0] - first_group = calc_oload_sig(first) + first_sig = calc_oload_sig(first) for other in group[1:]: - other_group = calc_oload_sig(other) - # TODO: uncomment assert when opcodes are fixed - # assert first_group == other_group, "overload signature %s for instruction %s differs from %s in %s" % (first.name, first_group, other.name, other_group) + if other.name == "WavePrefixBitCount": + # known exception - this op is overloaded but has different signature for "v" oload + continue + other_sig = calc_oload_sig(other) + if first_sig != other_sig: + inconsistencies_in_class.append((other, other_sig)) + if inconsistencies_in_class: + inconsistencies.append( + "Inconsistent overload signatures for DXIL op class " + + f"{first.dxil_class} first: {first.name} '{first_sig}', others:\n" + + "\n".join( + [ + f" {other.name} '{other_sig}'" + for other, other_sig in inconsistencies_in_class + ] + ) + ) + if inconsistencies: + raise RuntimeError("\n".join(inconsistencies)) def populate_extended_docs(self): "Update the documentation with text from external files." diff --git a/utils/hct/hctdb_instrhelp.py b/utils/hct/hctdb_instrhelp.py index 33c87e25ef..b703772ebc 100644 --- a/utils/hct/hctdb_instrhelp.py +++ b/utils/hct/hctdb_instrhelp.py @@ -612,7 +612,6 @@ def print_opfunc_table(self): "i32c": "A(pI32C);", "i64": "A(pI64);", "i8": "A(pI8);", - "$u4": "A(pI4S);", "pf32": "A(pPF32);", "res": "A(pRes);", "splitdouble": "A(pSDT);", @@ -631,15 +630,11 @@ def print_opfunc_table(self): "u8": "A(pI8);", "v": "A(pV);", "$vec4": "VEC4(pETy);", - "w": "A(pWav);", "SamplePos": "A(pPos);", - "udt": "A(udt);", - "obj": "A(obj);", + "$udt": "A(udt);", + "$obj": "A(obj);", "resproperty": "A(resProperty);", "resbind": "A(resBind);", - "waveMat": "A(pWaveMatPtr);", - "waveMatProps": "A(pWaveMatProps);", - "$gsptr": "A(pGSEltPtrTy);", "nodehandle": "A(pNodeHandle);", "noderecordhandle": "A(pNodeRecordHandle);", "nodeproperty": "A(nodeProperty);", @@ -674,8 +669,8 @@ def print_opfunc_oload_type(self): elt_ty = "$o" res_ret_ty = "$r" cb_ret_ty = "$cb" - udt_ty = "udt" - obj_ty = "obj" + udt_ty = "$udt" + obj_ty = "$obj" vec_ty = "$vec" gsptr_ty = "$gsptr" extended_ty = "$x" @@ -769,7 +764,7 @@ def print_opfunc_oload_type(self): "v": "Type::getVoidTy(Ctx)", # No other types should be referenced here. } - assert ty in type_code_texts, "llvm type %s is unknown" % (ty) + assert ty in type_code_texts, f"llvm type {ty} is unknown, '{instr.name}'" ty_code = type_code_texts[ty] if ty_code not in single_dict: