semantic: Clean up intrinsics
Declare enum <-> string mapping once. Don't use `default:` so the compiler moans when the enum is not catching cases. Change-Id: I4c8903ef75c76b1881971b66ec3b49667dcc2218 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/45340 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
03c01b5266
commit
1b51be56f0
|
@ -72,11 +72,11 @@ enum class IntrinsicType {
|
|||
kMix,
|
||||
kModf,
|
||||
kNormalize,
|
||||
kPack4x8Snorm,
|
||||
kPack4x8Unorm,
|
||||
kPack2x16Float,
|
||||
kPack2x16Snorm,
|
||||
kPack2x16Unorm,
|
||||
kPack2x16Float,
|
||||
kPack4x8Snorm,
|
||||
kPack4x8Unorm,
|
||||
kPow,
|
||||
kReflect,
|
||||
kReverseBits,
|
||||
|
@ -102,11 +102,11 @@ enum class IntrinsicType {
|
|||
kTextureSampleLevel,
|
||||
kTextureStore,
|
||||
kTrunc,
|
||||
kUnpack4x8Snorm,
|
||||
kUnpack4x8Unorm,
|
||||
kUnpack2x16Float,
|
||||
kUnpack2x16Snorm,
|
||||
kUnpack2x16Unorm,
|
||||
kUnpack2x16Float,
|
||||
kUnpack4x8Snorm,
|
||||
kUnpack4x8Unorm,
|
||||
};
|
||||
|
||||
/// Matches the IntrisicType by name
|
||||
|
|
|
@ -28,346 +28,108 @@ const char* Intrinsic::str() const {
|
|||
return semantic::str(type_);
|
||||
}
|
||||
|
||||
/// Name matches the spelling in the WGSL spec including case.
|
||||
#define INTRINSIC_LIST() \
|
||||
INTRINSIC(IntrinsicType::kNone, "<not-an-intrinsic>") \
|
||||
INTRINSIC(IntrinsicType::kAbs, "abs") \
|
||||
INTRINSIC(IntrinsicType::kAcos, "acos") \
|
||||
INTRINSIC(IntrinsicType::kAll, "all") \
|
||||
INTRINSIC(IntrinsicType::kAny, "any") \
|
||||
INTRINSIC(IntrinsicType::kArrayLength, "arrayLength") \
|
||||
INTRINSIC(IntrinsicType::kAsin, "asin") \
|
||||
INTRINSIC(IntrinsicType::kAtan, "atan") \
|
||||
INTRINSIC(IntrinsicType::kAtan2, "atan2") \
|
||||
INTRINSIC(IntrinsicType::kCeil, "ceil") \
|
||||
INTRINSIC(IntrinsicType::kClamp, "clamp") \
|
||||
INTRINSIC(IntrinsicType::kCos, "cos") \
|
||||
INTRINSIC(IntrinsicType::kCosh, "cosh") \
|
||||
INTRINSIC(IntrinsicType::kCountOneBits, "countOneBits") \
|
||||
INTRINSIC(IntrinsicType::kCross, "cross") \
|
||||
INTRINSIC(IntrinsicType::kDeterminant, "determinant") \
|
||||
INTRINSIC(IntrinsicType::kDistance, "distance") \
|
||||
INTRINSIC(IntrinsicType::kDot, "dot") \
|
||||
INTRINSIC(IntrinsicType::kDpdx, "dpdx") \
|
||||
INTRINSIC(IntrinsicType::kDpdxCoarse, "dpdxCoarse") \
|
||||
INTRINSIC(IntrinsicType::kDpdxFine, "dpdxFine") \
|
||||
INTRINSIC(IntrinsicType::kDpdy, "dpdy") \
|
||||
INTRINSIC(IntrinsicType::kDpdyCoarse, "dpdyCoarse") \
|
||||
INTRINSIC(IntrinsicType::kDpdyFine, "dpdyFine") \
|
||||
INTRINSIC(IntrinsicType::kExp, "exp") \
|
||||
INTRINSIC(IntrinsicType::kExp2, "exp2") \
|
||||
INTRINSIC(IntrinsicType::kFaceForward, "faceForward") \
|
||||
INTRINSIC(IntrinsicType::kFloor, "floor") \
|
||||
INTRINSIC(IntrinsicType::kFma, "fma") \
|
||||
INTRINSIC(IntrinsicType::kFract, "fract") \
|
||||
INTRINSIC(IntrinsicType::kFrexp, "frexp") \
|
||||
INTRINSIC(IntrinsicType::kFwidth, "fwidth") \
|
||||
INTRINSIC(IntrinsicType::kFwidthCoarse, "fwidthCoarse") \
|
||||
INTRINSIC(IntrinsicType::kFwidthFine, "fwidthFine") \
|
||||
INTRINSIC(IntrinsicType::kInverseSqrt, "inverseSqrt") \
|
||||
INTRINSIC(IntrinsicType::kIsFinite, "isFinite") \
|
||||
INTRINSIC(IntrinsicType::kIsInf, "isInf") \
|
||||
INTRINSIC(IntrinsicType::kIsNan, "isNan") \
|
||||
INTRINSIC(IntrinsicType::kIsNormal, "isNormal") \
|
||||
INTRINSIC(IntrinsicType::kLdexp, "ldexp") \
|
||||
INTRINSIC(IntrinsicType::kLength, "length") \
|
||||
INTRINSIC(IntrinsicType::kLog, "log") \
|
||||
INTRINSIC(IntrinsicType::kLog2, "log2") \
|
||||
INTRINSIC(IntrinsicType::kMax, "max") \
|
||||
INTRINSIC(IntrinsicType::kMin, "min") \
|
||||
INTRINSIC(IntrinsicType::kMix, "mix") \
|
||||
INTRINSIC(IntrinsicType::kModf, "modf") \
|
||||
INTRINSIC(IntrinsicType::kNormalize, "normalize") \
|
||||
INTRINSIC(IntrinsicType::kPack4x8Snorm, "pack4x8snorm") \
|
||||
INTRINSIC(IntrinsicType::kPack4x8Unorm, "pack4x8unorm") \
|
||||
INTRINSIC(IntrinsicType::kPack2x16Snorm, "pack2x16snorm") \
|
||||
INTRINSIC(IntrinsicType::kPack2x16Unorm, "pack2x16unorm") \
|
||||
INTRINSIC(IntrinsicType::kPack2x16Float, "pack2x16float") \
|
||||
INTRINSIC(IntrinsicType::kPow, "pow") \
|
||||
INTRINSIC(IntrinsicType::kReflect, "reflect") \
|
||||
INTRINSIC(IntrinsicType::kReverseBits, "reverseBits") \
|
||||
INTRINSIC(IntrinsicType::kRound, "round") \
|
||||
INTRINSIC(IntrinsicType::kSelect, "select") \
|
||||
INTRINSIC(IntrinsicType::kSign, "sign") \
|
||||
INTRINSIC(IntrinsicType::kSin, "sin") \
|
||||
INTRINSIC(IntrinsicType::kSinh, "sinh") \
|
||||
INTRINSIC(IntrinsicType::kSmoothStep, "smoothStep") \
|
||||
INTRINSIC(IntrinsicType::kSqrt, "sqrt") \
|
||||
INTRINSIC(IntrinsicType::kStep, "step") \
|
||||
INTRINSIC(IntrinsicType::kTan, "tan") \
|
||||
INTRINSIC(IntrinsicType::kTanh, "tanh") \
|
||||
INTRINSIC(IntrinsicType::kTextureDimensions, "textureDimensions") \
|
||||
INTRINSIC(IntrinsicType::kTextureLoad, "textureLoad") \
|
||||
INTRINSIC(IntrinsicType::kTextureNumLayers, "textureNumLayers") \
|
||||
INTRINSIC(IntrinsicType::kTextureNumLevels, "textureNumLevels") \
|
||||
INTRINSIC(IntrinsicType::kTextureNumSamples, "textureNumSamples") \
|
||||
INTRINSIC(IntrinsicType::kTextureSample, "textureSample") \
|
||||
INTRINSIC(IntrinsicType::kTextureSampleBias, "textureSampleBias") \
|
||||
INTRINSIC(IntrinsicType::kTextureSampleCompare, "textureSampleCompare") \
|
||||
INTRINSIC(IntrinsicType::kTextureSampleGrad, "textureSampleGrad") \
|
||||
INTRINSIC(IntrinsicType::kTextureSampleLevel, "textureSampleLevel") \
|
||||
INTRINSIC(IntrinsicType::kTextureStore, "textureStore") \
|
||||
INTRINSIC(IntrinsicType::kTrunc, "trunc") \
|
||||
INTRINSIC(IntrinsicType::kUnpack2x16Float, "unpack2x16float") \
|
||||
INTRINSIC(IntrinsicType::kUnpack2x16Snorm, "unpack2x16snorm") \
|
||||
INTRINSIC(IntrinsicType::kUnpack2x16Unorm, "unpack2x16unorm") \
|
||||
INTRINSIC(IntrinsicType::kUnpack4x8Snorm, "unpack4x8snorm") \
|
||||
INTRINSIC(IntrinsicType::kUnpack4x8Unorm, "unpack4x8unorm")
|
||||
|
||||
IntrinsicType ParseIntrinsicType(const std::string& name) {
|
||||
if (name == "abs") {
|
||||
return IntrinsicType::kAbs;
|
||||
} else if (name == "acos") {
|
||||
return IntrinsicType::kAcos;
|
||||
} else if (name == "all") {
|
||||
return IntrinsicType::kAll;
|
||||
} else if (name == "any") {
|
||||
return IntrinsicType::kAny;
|
||||
} else if (name == "arrayLength") {
|
||||
return IntrinsicType::kArrayLength;
|
||||
} else if (name == "asin") {
|
||||
return IntrinsicType::kAsin;
|
||||
} else if (name == "atan") {
|
||||
return IntrinsicType::kAtan;
|
||||
} else if (name == "atan2") {
|
||||
return IntrinsicType::kAtan2;
|
||||
} else if (name == "ceil") {
|
||||
return IntrinsicType::kCeil;
|
||||
} else if (name == "clamp") {
|
||||
return IntrinsicType::kClamp;
|
||||
} else if (name == "cos") {
|
||||
return IntrinsicType::kCos;
|
||||
} else if (name == "cosh") {
|
||||
return IntrinsicType::kCosh;
|
||||
} else if (name == "countOneBits") {
|
||||
return IntrinsicType::kCountOneBits;
|
||||
} else if (name == "cross") {
|
||||
return IntrinsicType::kCross;
|
||||
} else if (name == "determinant") {
|
||||
return IntrinsicType::kDeterminant;
|
||||
} else if (name == "distance") {
|
||||
return IntrinsicType::kDistance;
|
||||
} else if (name == "dot") {
|
||||
return IntrinsicType::kDot;
|
||||
} else if (name == "dpdx") {
|
||||
return IntrinsicType::kDpdx;
|
||||
} else if (name == "dpdxCoarse") {
|
||||
return IntrinsicType::kDpdxCoarse;
|
||||
} else if (name == "dpdxFine") {
|
||||
return IntrinsicType::kDpdxFine;
|
||||
} else if (name == "dpdy") {
|
||||
return IntrinsicType::kDpdy;
|
||||
} else if (name == "dpdyCoarse") {
|
||||
return IntrinsicType::kDpdyCoarse;
|
||||
} else if (name == "dpdyFine") {
|
||||
return IntrinsicType::kDpdyFine;
|
||||
} else if (name == "exp") {
|
||||
return IntrinsicType::kExp;
|
||||
} else if (name == "exp2") {
|
||||
return IntrinsicType::kExp2;
|
||||
} else if (name == "faceForward") {
|
||||
return IntrinsicType::kFaceForward;
|
||||
} else if (name == "floor") {
|
||||
return IntrinsicType::kFloor;
|
||||
} else if (name == "fma") {
|
||||
return IntrinsicType::kFma;
|
||||
} else if (name == "fract") {
|
||||
return IntrinsicType::kFract;
|
||||
} else if (name == "frexp") {
|
||||
return IntrinsicType::kFrexp;
|
||||
} else if (name == "fwidth") {
|
||||
return IntrinsicType::kFwidth;
|
||||
} else if (name == "fwidthCoarse") {
|
||||
return IntrinsicType::kFwidthCoarse;
|
||||
} else if (name == "fwidthFine") {
|
||||
return IntrinsicType::kFwidthFine;
|
||||
} else if (name == "inverseSqrt") {
|
||||
return IntrinsicType::kInverseSqrt;
|
||||
} else if (name == "isFinite") {
|
||||
return IntrinsicType::kIsFinite;
|
||||
} else if (name == "isInf") {
|
||||
return IntrinsicType::kIsInf;
|
||||
} else if (name == "isNan") {
|
||||
return IntrinsicType::kIsNan;
|
||||
} else if (name == "isNormal") {
|
||||
return IntrinsicType::kIsNormal;
|
||||
} else if (name == "ldexp") {
|
||||
return IntrinsicType::kLdexp;
|
||||
} else if (name == "length") {
|
||||
return IntrinsicType::kLength;
|
||||
} else if (name == "log") {
|
||||
return IntrinsicType::kLog;
|
||||
} else if (name == "log2") {
|
||||
return IntrinsicType::kLog2;
|
||||
} else if (name == "max") {
|
||||
return IntrinsicType::kMax;
|
||||
} else if (name == "min") {
|
||||
return IntrinsicType::kMin;
|
||||
} else if (name == "mix") {
|
||||
return IntrinsicType::kMix;
|
||||
} else if (name == "modf") {
|
||||
return IntrinsicType::kModf;
|
||||
} else if (name == "normalize") {
|
||||
return IntrinsicType::kNormalize;
|
||||
} else if (name == "pack4x8snorm") {
|
||||
return IntrinsicType::kPack4x8Snorm;
|
||||
} else if (name == "pack4x8unorm") {
|
||||
return IntrinsicType::kPack4x8Unorm;
|
||||
} else if (name == "pack2x16snorm") {
|
||||
return IntrinsicType::kPack2x16Snorm;
|
||||
} else if (name == "pack2x16unorm") {
|
||||
return IntrinsicType::kPack2x16Unorm;
|
||||
} else if (name == "pack2x16float") {
|
||||
return IntrinsicType::kPack2x16Float;
|
||||
} else if (name == "pow") {
|
||||
return IntrinsicType::kPow;
|
||||
} else if (name == "reflect") {
|
||||
return IntrinsicType::kReflect;
|
||||
} else if (name == "reverseBits") {
|
||||
return IntrinsicType::kReverseBits;
|
||||
} else if (name == "round") {
|
||||
return IntrinsicType::kRound;
|
||||
} else if (name == "select") {
|
||||
return IntrinsicType::kSelect;
|
||||
} else if (name == "sign") {
|
||||
return IntrinsicType::kSign;
|
||||
} else if (name == "sin") {
|
||||
return IntrinsicType::kSin;
|
||||
} else if (name == "sinh") {
|
||||
return IntrinsicType::kSinh;
|
||||
} else if (name == "smoothStep") {
|
||||
return IntrinsicType::kSmoothStep;
|
||||
} else if (name == "sqrt") {
|
||||
return IntrinsicType::kSqrt;
|
||||
} else if (name == "step") {
|
||||
return IntrinsicType::kStep;
|
||||
} else if (name == "tan") {
|
||||
return IntrinsicType::kTan;
|
||||
} else if (name == "tanh") {
|
||||
return IntrinsicType::kTanh;
|
||||
} else if (name == "textureDimensions") {
|
||||
return IntrinsicType::kTextureDimensions;
|
||||
} else if (name == "textureNumLayers") {
|
||||
return IntrinsicType::kTextureNumLayers;
|
||||
} else if (name == "textureNumLevels") {
|
||||
return IntrinsicType::kTextureNumLevels;
|
||||
} else if (name == "textureNumSamples") {
|
||||
return IntrinsicType::kTextureNumSamples;
|
||||
} else if (name == "textureLoad") {
|
||||
return IntrinsicType::kTextureLoad;
|
||||
} else if (name == "textureStore") {
|
||||
return IntrinsicType::kTextureStore;
|
||||
} else if (name == "textureSample") {
|
||||
return IntrinsicType::kTextureSample;
|
||||
} else if (name == "textureSampleBias") {
|
||||
return IntrinsicType::kTextureSampleBias;
|
||||
} else if (name == "textureSampleCompare") {
|
||||
return IntrinsicType::kTextureSampleCompare;
|
||||
} else if (name == "textureSampleGrad") {
|
||||
return IntrinsicType::kTextureSampleGrad;
|
||||
} else if (name == "textureSampleLevel") {
|
||||
return IntrinsicType::kTextureSampleLevel;
|
||||
} else if (name == "trunc") {
|
||||
return IntrinsicType::kTrunc;
|
||||
} else if (name == "unpack4x8snorm") {
|
||||
return IntrinsicType::kUnpack4x8Snorm;
|
||||
} else if (name == "unpack4x8unorm") {
|
||||
return IntrinsicType::kUnpack4x8Unorm;
|
||||
} else if (name == "unpack2x16snorm") {
|
||||
return IntrinsicType::kUnpack2x16Snorm;
|
||||
} else if (name == "unpack2x16unorm") {
|
||||
return IntrinsicType::kUnpack2x16Unorm;
|
||||
} else if (name == "unpack2x16float") {
|
||||
return IntrinsicType::kUnpack2x16Float;
|
||||
#define INTRINSIC(ENUM, NAME) \
|
||||
if (name == NAME) { \
|
||||
return ENUM; \
|
||||
}
|
||||
INTRINSIC_LIST()
|
||||
#undef INTRINSIC
|
||||
return IntrinsicType::kNone;
|
||||
}
|
||||
|
||||
const char* str(IntrinsicType i) {
|
||||
/// The emitted name matches the spelling in the WGSL spec.
|
||||
/// including case.
|
||||
switch (i) {
|
||||
case IntrinsicType::kNone:
|
||||
return "<not-an-intrinsic>";
|
||||
case IntrinsicType::kAbs:
|
||||
return "abs";
|
||||
case IntrinsicType::kAcos:
|
||||
return "acos";
|
||||
case IntrinsicType::kAll:
|
||||
return "all";
|
||||
case IntrinsicType::kAny:
|
||||
return "any";
|
||||
case IntrinsicType::kArrayLength:
|
||||
return "arrayLength";
|
||||
case IntrinsicType::kAsin:
|
||||
return "asin";
|
||||
case IntrinsicType::kAtan:
|
||||
return "atan";
|
||||
case IntrinsicType::kAtan2:
|
||||
return "atan2";
|
||||
case IntrinsicType::kCeil:
|
||||
return "ceil";
|
||||
case IntrinsicType::kClamp:
|
||||
return "clamp";
|
||||
case IntrinsicType::kCos:
|
||||
return "cos";
|
||||
case IntrinsicType::kCosh:
|
||||
return "cosh";
|
||||
case IntrinsicType::kCountOneBits:
|
||||
return "countOneBits";
|
||||
case IntrinsicType::kCross:
|
||||
return "cross";
|
||||
case IntrinsicType::kDeterminant:
|
||||
return "determinant";
|
||||
case IntrinsicType::kDistance:
|
||||
return "distance";
|
||||
case IntrinsicType::kDot:
|
||||
return "dot";
|
||||
case IntrinsicType::kDpdx:
|
||||
return "dpdx";
|
||||
case IntrinsicType::kDpdxCoarse:
|
||||
return "dpdxCoarse";
|
||||
case IntrinsicType::kDpdxFine:
|
||||
return "dpdxFine";
|
||||
case IntrinsicType::kDpdy:
|
||||
return "dpdy";
|
||||
case IntrinsicType::kDpdyCoarse:
|
||||
return "dpdyCoarse";
|
||||
case IntrinsicType::kDpdyFine:
|
||||
return "dpdyFine";
|
||||
case IntrinsicType::kExp:
|
||||
return "exp";
|
||||
case IntrinsicType::kExp2:
|
||||
return "exp2";
|
||||
case IntrinsicType::kFaceForward:
|
||||
return "faceForward";
|
||||
case IntrinsicType::kFloor:
|
||||
return "floor";
|
||||
case IntrinsicType::kFma:
|
||||
return "fma";
|
||||
case IntrinsicType::kFract:
|
||||
return "fract";
|
||||
case IntrinsicType::kFrexp:
|
||||
return "frexp";
|
||||
case IntrinsicType::kFwidth:
|
||||
return "fwidth";
|
||||
case IntrinsicType::kFwidthCoarse:
|
||||
return "fwidthCoarse";
|
||||
case IntrinsicType::kFwidthFine:
|
||||
return "fwidthFine";
|
||||
case IntrinsicType::kInverseSqrt:
|
||||
return "inverseSqrt";
|
||||
case IntrinsicType::kIsFinite:
|
||||
return "isFinite";
|
||||
case IntrinsicType::kIsInf:
|
||||
return "isInf";
|
||||
case IntrinsicType::kIsNan:
|
||||
return "isNan";
|
||||
case IntrinsicType::kIsNormal:
|
||||
return "isNormal";
|
||||
case IntrinsicType::kLdexp:
|
||||
return "ldexp";
|
||||
case IntrinsicType::kLength:
|
||||
return "length";
|
||||
case IntrinsicType::kLog:
|
||||
return "log";
|
||||
case IntrinsicType::kLog2:
|
||||
return "log2";
|
||||
case IntrinsicType::kMax:
|
||||
return "max";
|
||||
case IntrinsicType::kMin:
|
||||
return "min";
|
||||
case IntrinsicType::kMix:
|
||||
return "mix";
|
||||
case IntrinsicType::kModf:
|
||||
return "modf";
|
||||
case IntrinsicType::kNormalize:
|
||||
return "normalize";
|
||||
case IntrinsicType::kPack4x8Snorm:
|
||||
return "pack4x8snorm";
|
||||
case IntrinsicType::kPack4x8Unorm:
|
||||
return "pack4x8unorm";
|
||||
case IntrinsicType::kPack2x16Snorm:
|
||||
return "pack2x16snorm";
|
||||
case IntrinsicType::kPack2x16Unorm:
|
||||
return "pack2x16unorm";
|
||||
case IntrinsicType::kPack2x16Float:
|
||||
return "pack2x16float";
|
||||
case IntrinsicType::kPow:
|
||||
return "pow";
|
||||
case IntrinsicType::kReflect:
|
||||
return "reflect";
|
||||
case IntrinsicType::kReverseBits:
|
||||
return "reverseBits";
|
||||
case IntrinsicType::kRound:
|
||||
return "round";
|
||||
case IntrinsicType::kSelect:
|
||||
return "select";
|
||||
case IntrinsicType::kSign:
|
||||
return "sign";
|
||||
case IntrinsicType::kSin:
|
||||
return "sin";
|
||||
case IntrinsicType::kSinh:
|
||||
return "sinh";
|
||||
case IntrinsicType::kSmoothStep:
|
||||
return "smoothStep";
|
||||
case IntrinsicType::kSqrt:
|
||||
return "sqrt";
|
||||
case IntrinsicType::kStep:
|
||||
return "step";
|
||||
case IntrinsicType::kTan:
|
||||
return "tan";
|
||||
case IntrinsicType::kTanh:
|
||||
return "tanh";
|
||||
case IntrinsicType::kTextureDimensions:
|
||||
return "textureDimensions";
|
||||
case IntrinsicType::kTextureLoad:
|
||||
return "textureLoad";
|
||||
case IntrinsicType::kTextureNumLayers:
|
||||
return "textureNumLayers";
|
||||
case IntrinsicType::kTextureNumLevels:
|
||||
return "textureNumLevels";
|
||||
case IntrinsicType::kTextureNumSamples:
|
||||
return "textureNumSamples";
|
||||
case IntrinsicType::kTextureSample:
|
||||
return "textureSample";
|
||||
case IntrinsicType::kTextureSampleBias:
|
||||
return "textureSampleBias";
|
||||
case IntrinsicType::kTextureSampleCompare:
|
||||
return "textureSampleCompare";
|
||||
case IntrinsicType::kTextureSampleGrad:
|
||||
return "textureSampleGrad";
|
||||
case IntrinsicType::kTextureSampleLevel:
|
||||
return "textureSampleLevel";
|
||||
case IntrinsicType::kTextureStore:
|
||||
return "textureStore";
|
||||
case IntrinsicType::kTrunc:
|
||||
return "trunc";
|
||||
case IntrinsicType::kUnpack4x8Snorm:
|
||||
return "unpack4x8snorm";
|
||||
case IntrinsicType::kUnpack4x8Unorm:
|
||||
return "unpack4x8unorm";
|
||||
case IntrinsicType::kUnpack2x16Snorm:
|
||||
return "unpack2x16snorm";
|
||||
case IntrinsicType::kUnpack2x16Unorm:
|
||||
return "unpack2x16unorm";
|
||||
case IntrinsicType::kUnpack2x16Float:
|
||||
return "unpack2x16float";
|
||||
}
|
||||
#define INTRINSIC(ENUM, NAME) \
|
||||
case ENUM: \
|
||||
return NAME;
|
||||
switch (i) { INTRINSIC_LIST() }
|
||||
#undef INTRINSIC
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,12 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
IntrinsicType::kTextureSampleCompare},
|
||||
IntrinsicData{"textureSampleGrad", IntrinsicType::kTextureSampleGrad},
|
||||
IntrinsicData{"textureSampleLevel", IntrinsicType::kTextureSampleLevel},
|
||||
IntrinsicData{"trunc", IntrinsicType::kTrunc}));
|
||||
IntrinsicData{"trunc", IntrinsicType::kTrunc},
|
||||
IntrinsicData{"unpack2x16float", IntrinsicType::kUnpack2x16Float},
|
||||
IntrinsicData{"unpack2x16snorm", IntrinsicType::kUnpack2x16Snorm},
|
||||
IntrinsicData{"unpack2x16unorm", IntrinsicType::kUnpack2x16Unorm},
|
||||
IntrinsicData{"unpack4x8snorm", IntrinsicType::kUnpack4x8Snorm},
|
||||
IntrinsicData{"unpack4x8unorm", IntrinsicType::kUnpack4x8Unorm}));
|
||||
|
||||
TEST_F(IntrinsicTypeTest, ParseNoMatch) {
|
||||
EXPECT_EQ(ParseIntrinsicType("not_intrinsic"), IntrinsicType::kNone);
|
||||
|
|
Loading…
Reference in New Issue