Skip to content

Commit efbfa78

Browse files
Add Slang-specific intrinsics for integer pack/unpack (#6459)
* update hlsl meta * update test * use slang syntax in meta file * improve meta file * fix pack clamp u8 * remove builtin packed types, use typealias instead * fix wgsl pack clamp * fix formatting --------- Co-authored-by: Yong He <yonghe@outlook.com>
1 parent 618b4c7 commit efbfa78

28 files changed

+361
-484
lines changed

source/slang-core-module/slang-embedded-core-module-source.cpp

-31
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ enum BaseTypeConversionRank : uint8_t
5656
kBaseTypeConversionRank_Int32,
5757
kBaseTypeConversionRank_IntPtr,
5858
kBaseTypeConversionRank_Int64,
59-
60-
// Packed type conversion ranks where the overall rank order does not apply.
61-
// They must be explicitly casted to another type.
62-
kBaseTypeConversionRank_Int8x4Packed,
63-
kBaseTypeConversionRank_UInt8x4Packed,
64-
6559
kBaseTypeConversionRank_Error,
6660
};
6761

@@ -155,17 +149,6 @@ static const BaseTypeConversionInfo kBaseTypes[] = {
155149
UINT_MASK,
156150
kBaseTypeConversionKind_Unsigned,
157151
kBaseTypeConversionRank_IntPtr},
158-
159-
{"int8_t4_packed",
160-
BaseType::Int8x4Packed,
161-
0,
162-
kBaseTypeConversionKind_Unsigned,
163-
kBaseTypeConversionRank_Int8x4Packed},
164-
{"uint8_t4_packed",
165-
BaseType::UInt8x4Packed,
166-
0,
167-
kBaseTypeConversionKind_Unsigned,
168-
kBaseTypeConversionRank_UInt8x4Packed},
169152
};
170153

171154
void Session::finalizeSharedASTBuilder()
@@ -192,12 +175,6 @@ void Session::finalizeSharedASTBuilder()
192175
globalAstBuilder->getBuiltinType(baseType.tag);
193176
}
194177

195-
static bool isConversionRankPackedType(BaseTypeConversionRank rank)
196-
{
197-
return (rank == BaseTypeConversionRank::kBaseTypeConversionRank_Int8x4Packed) ||
198-
(rank == BaseTypeConversionRank::kBaseTypeConversionRank_UInt8x4Packed);
199-
}
200-
201178
// Given two base types, we need to be able to compute the cost of converting between them.
202179
ConversionCost getBaseTypeConversionCost(
203180
BaseTypeConversionInfo const& toInfo,
@@ -210,14 +187,6 @@ ConversionCost getBaseTypeConversionCost(
210187
return kConversionCost_None;
211188
}
212189

213-
// Handle special case for packed types, where they must be explicitly casted to another type.
214-
bool isToPackedType = isConversionRankPackedType(toInfo.conversionRank);
215-
bool isFromPackedType = isConversionRankPackedType(fromInfo.conversionRank);
216-
if (isToPackedType || isFromPackedType)
217-
{
218-
return kConversionCost_GeneralConversion;
219-
}
220-
221190
// Conversions within the same kind are easist to handle
222191
if (toInfo.conversionKind == fromInfo.conversionKind)
223192
{

0 commit comments

Comments
 (0)