mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
Implement data unpacking intrinsics
* Add support for data unpacking intrinsics * spir-v reader * type determiner * intrinsic table * spir-v, hlsl and msl writers Bug: tint:341 Change-Id: I8f40d19d59a4699af75cd579fe8398c735a77a59 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41320 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: Alan Baker <alanbaker@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
2a284b2a13
commit
cd17ea88e3
@@ -101,7 +101,12 @@ enum class IntrinsicType {
|
||||
kTextureSampleGrad,
|
||||
kTextureSampleLevel,
|
||||
kTextureStore,
|
||||
kTrunc
|
||||
kTrunc,
|
||||
kUnpack4x8Snorm,
|
||||
kUnpack4x8Unorm,
|
||||
kUnpack2x16Snorm,
|
||||
kUnpack2x16Unorm,
|
||||
kUnpack2x16Float,
|
||||
};
|
||||
|
||||
/// @returns the name of the intrinsic function type. The spelling, including
|
||||
@@ -143,6 +148,11 @@ bool IsImageQueryIntrinsic(IntrinsicType i);
|
||||
/// @returns true if the given `i` is a data packing intrinsic
|
||||
bool IsDataPackingIntrinsic(IntrinsicType i);
|
||||
|
||||
/// Determines if the given `i` is a data unpacking intrinsic
|
||||
/// @param i the intrinsic
|
||||
/// @returns true if the given `i` is a data unpacking intrinsic
|
||||
bool IsDataUnpackingIntrinsic(IntrinsicType i);
|
||||
|
||||
/// Intrinsic holds the semantic information for an intrinsic function.
|
||||
class Intrinsic : public Castable<Intrinsic, CallTarget> {
|
||||
public:
|
||||
@@ -185,6 +195,9 @@ class Intrinsic : public Castable<Intrinsic, CallTarget> {
|
||||
/// @returns true if intrinsic is a data packing intrinsic
|
||||
bool IsDataPacking() const;
|
||||
|
||||
/// @returns true if intrinsic is a data unpacking intrinsic
|
||||
bool IsDataUnpacking() const;
|
||||
|
||||
private:
|
||||
IntrinsicType const type_;
|
||||
};
|
||||
|
||||
@@ -188,6 +188,16 @@ const char* str(IntrinsicType i) {
|
||||
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";
|
||||
}
|
||||
return "<unknown>";
|
||||
}
|
||||
@@ -238,6 +248,14 @@ bool IsDataPackingIntrinsic(IntrinsicType i) {
|
||||
i == IntrinsicType::kPack2x16Float;
|
||||
}
|
||||
|
||||
bool IsDataUnpackingIntrinsic(IntrinsicType i) {
|
||||
return i == IntrinsicType::kUnpack4x8Snorm ||
|
||||
i == IntrinsicType::kUnpack4x8Unorm ||
|
||||
i == IntrinsicType::kUnpack2x16Snorm ||
|
||||
i == IntrinsicType::kUnpack2x16Unorm ||
|
||||
i == IntrinsicType::kUnpack2x16Float;
|
||||
}
|
||||
|
||||
Intrinsic::Intrinsic(IntrinsicType type,
|
||||
type::Type* return_type,
|
||||
const ParameterList& parameters)
|
||||
@@ -273,5 +291,9 @@ bool Intrinsic::IsDataPacking() const {
|
||||
return IsDataPackingIntrinsic(type_);
|
||||
}
|
||||
|
||||
bool Intrinsic::IsDataUnpacking() const {
|
||||
return IsDataUnpackingIntrinsic(type_);
|
||||
}
|
||||
|
||||
} // namespace semantic
|
||||
} // namespace tint
|
||||
|
||||
Reference in New Issue
Block a user