mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-16 20:31:20 +00:00
tint: Rename kNotAnExtenxion to kNoExtension
This patch rename `ast::Enable::ExtensionKind::kNotAnExtenxion` to `ast::Enable::ExtensionKind::kNoExtension`. Change-Id: I28087d548cc8edf249545d51414a1becfa5a3b65 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90162 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This commit is contained in:
parent
ab9757036b
commit
ed6ff9c948
@ -34,7 +34,7 @@ Enable::ExtensionKind Enable::NameToKind(const std::string& name) {
|
|||||||
return Enable::ExtensionKind::kInternalExtensionForTesting;
|
return Enable::ExtensionKind::kInternalExtensionForTesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enable::ExtensionKind::kNotAnExtension;
|
return Enable::ExtensionKind::kNoExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Enable::KindToName(ExtensionKind kind) {
|
std::string Enable::KindToName(ExtensionKind kind) {
|
||||||
@ -47,8 +47,8 @@ std::string Enable::KindToName(ExtensionKind kind) {
|
|||||||
// The reserved internal extension for testing
|
// The reserved internal extension for testing
|
||||||
case ExtensionKind::kInternalExtensionForTesting:
|
case ExtensionKind::kInternalExtensionForTesting:
|
||||||
return "InternalExtensionForTesting";
|
return "InternalExtensionForTesting";
|
||||||
case ExtensionKind::kNotAnExtension:
|
case ExtensionKind::kNoExtension:
|
||||||
// Return an empty string for kNotAnExtension
|
// Return an empty string for kNoExtension
|
||||||
return {};
|
return {};
|
||||||
// No default case, as this switch must cover all ExtensionKind values.
|
// No default case, as this switch must cover all ExtensionKind values.
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,10 @@ class Enable : public Castable<Enable, Node> {
|
|||||||
public:
|
public:
|
||||||
/// The enum class identifing each supported WGSL extension
|
/// The enum class identifing each supported WGSL extension
|
||||||
enum class ExtensionKind {
|
enum class ExtensionKind {
|
||||||
|
/// An internal reserved extension for test, named
|
||||||
|
/// "InternalExtensionForTesting".
|
||||||
|
kInternalExtensionForTesting,
|
||||||
|
|
||||||
/// An extension for the experimental feature
|
/// An extension for the experimental feature
|
||||||
/// "chromium_experimental_dp4a".
|
/// "chromium_experimental_dp4a".
|
||||||
/// See crbug.com/tint/1497 for more details
|
/// See crbug.com/tint/1497 for more details
|
||||||
@ -39,28 +43,26 @@ class Enable : public Castable<Enable, Node> {
|
|||||||
/// A Chromium-specific extension for disabling uniformity analysis.
|
/// A Chromium-specific extension for disabling uniformity analysis.
|
||||||
kChromiumDisableUniformityAnalysis,
|
kChromiumDisableUniformityAnalysis,
|
||||||
|
|
||||||
/// An internal reserved extension for test, named
|
/// Reserved for representing "No extension required" or "Not a valid extension".
|
||||||
/// "InternalExtensionForTesting"
|
kNoExtension,
|
||||||
kInternalExtensionForTesting = -2,
|
|
||||||
kNotAnExtension = -1,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Convert a string of extension name into one of ExtensionKind enum value,
|
/// Convert a string of extension name into one of ExtensionKind enum value,
|
||||||
/// the result will be ExtensionKind::kNotAnExtension if the name is not a
|
/// the result will be ExtensionKind::kNoExtension if the name is not a
|
||||||
/// known extension name. A extension node of kind kNotAnExtension must not
|
/// known extension name. A extension node of kind kNoExtension must not
|
||||||
/// exist in the AST tree, and using a unknown extension name in WGSL code
|
/// exist in the AST tree, and using a unknown extension name in WGSL code
|
||||||
/// should result in a shader-creation error.
|
/// should result in a shader-creation error.
|
||||||
/// @param name string of the extension name
|
/// @param name string of the extension name
|
||||||
/// @return the ExtensionKind enum value for the extension of given name, or
|
/// @return the ExtensionKind enum value for the extension of given name, or
|
||||||
/// kNotAnExtension if no known extension has the given name
|
/// kNoExtension if no known extension has the given name
|
||||||
static ExtensionKind NameToKind(const std::string& name);
|
static ExtensionKind NameToKind(const std::string& name);
|
||||||
|
|
||||||
/// Convert the ExtensionKind enum value to corresponding extension name
|
/// Convert the ExtensionKind enum value to corresponding extension name
|
||||||
/// string. If the given enum value is kNotAnExtension or don't have a known
|
/// string. If the given enum value is kNoExtension or don't have a known
|
||||||
/// name, return an empty string instead.
|
/// name, return an empty string instead.
|
||||||
/// @param kind the ExtensionKind enum value
|
/// @param kind the ExtensionKind enum value
|
||||||
/// @return string of the extension name corresponding to the given kind, or
|
/// @return string of the extension name corresponding to the given kind, or
|
||||||
/// an empty string if the given enum value is kNotAnExtension or don't have a
|
/// an empty string if the given enum value is kNoExtension or don't have a
|
||||||
/// known corresponding name
|
/// known corresponding name
|
||||||
static std::string KindToName(ExtensionKind kind);
|
static std::string KindToName(ExtensionKind kind);
|
||||||
|
|
||||||
|
@ -39,20 +39,20 @@ TEST_F(AstExtensionTest, Creation_InvalidName) {
|
|||||||
EXPECT_EQ(ext->source.range.begin.column, 2u);
|
EXPECT_EQ(ext->source.range.begin.column, 2u);
|
||||||
EXPECT_EQ(ext->source.range.end.line, 20u);
|
EXPECT_EQ(ext->source.range.end.line, 20u);
|
||||||
EXPECT_EQ(ext->source.range.end.column, 5u);
|
EXPECT_EQ(ext->source.range.end.column, 5u);
|
||||||
EXPECT_EQ(ext->kind, ast::Enable::ExtensionKind::kNotAnExtension);
|
EXPECT_EQ(ext->kind, ast::Enable::ExtensionKind::kNoExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(AstExtensionTest, NameToKind_InvalidName) {
|
TEST_F(AstExtensionTest, NameToKind_InvalidName) {
|
||||||
EXPECT_EQ(ast::Enable::NameToKind(std::string()), ast::Enable::ExtensionKind::kNotAnExtension);
|
EXPECT_EQ(ast::Enable::NameToKind(std::string()), ast::Enable::ExtensionKind::kNoExtension);
|
||||||
EXPECT_EQ(ast::Enable::NameToKind("__ImpossibleExtensionName"),
|
EXPECT_EQ(ast::Enable::NameToKind("__ImpossibleExtensionName"),
|
||||||
ast::Enable::ExtensionKind::kNotAnExtension);
|
ast::Enable::ExtensionKind::kNoExtension);
|
||||||
EXPECT_EQ(ast::Enable::NameToKind("123"), ast::Enable::ExtensionKind::kNotAnExtension);
|
EXPECT_EQ(ast::Enable::NameToKind("123"), ast::Enable::ExtensionKind::kNoExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(AstExtensionTest, KindToName) {
|
TEST_F(AstExtensionTest, KindToName) {
|
||||||
EXPECT_EQ(ast::Enable::KindToName(ast::Enable::ExtensionKind::kInternalExtensionForTesting),
|
EXPECT_EQ(ast::Enable::KindToName(ast::Enable::ExtensionKind::kInternalExtensionForTesting),
|
||||||
"InternalExtensionForTesting");
|
"InternalExtensionForTesting");
|
||||||
EXPECT_EQ(ast::Enable::KindToName(ast::Enable::ExtensionKind::kNotAnExtension), std::string());
|
EXPECT_EQ(ast::Enable::KindToName(ast::Enable::ExtensionKind::kNoExtension), std::string());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -358,7 +358,7 @@ Maybe<bool> ParserImpl::enable_directive() {
|
|||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast::Enable::NameToKind(name.value) != ast::Enable::ExtensionKind::kNotAnExtension) {
|
if (ast::Enable::NameToKind(name.value) != ast::Enable::ExtensionKind::kNoExtension) {
|
||||||
const ast::Enable* extension = create<ast::Enable>(name.source, name.value);
|
const ast::Enable* extension = create<ast::Enable>(name.source, name.value);
|
||||||
builder_.AST().AddEnable(extension);
|
builder_.AST().AddEnable(extension);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1525,7 +1525,7 @@ bool Validator::RequiredExtensionForBuiltinFunction(const sem::Call* call,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto extension = builtin->RequiredExtension();
|
const auto extension = builtin->RequiredExtension();
|
||||||
if (extension == ast::Enable::ExtensionKind::kNotAnExtension) {
|
if (extension == ast::Enable::ExtensionKind::kNoExtension) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ ast::Enable::ExtensionKind Builtin::RequiredExtension() const {
|
|||||||
if (IsDP4a()) {
|
if (IsDP4a()) {
|
||||||
return ast::Enable::ExtensionKind::kChromiumExperimentalDP4a;
|
return ast::Enable::ExtensionKind::kChromiumExperimentalDP4a;
|
||||||
}
|
}
|
||||||
return ast::Enable::ExtensionKind::kNotAnExtension;
|
return ast::Enable::ExtensionKind::kNoExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
|
@ -144,7 +144,7 @@ class Builtin final : public Castable<Builtin, CallTarget> {
|
|||||||
bool HasSideEffects() const;
|
bool HasSideEffects() const;
|
||||||
|
|
||||||
/// @returns the required extension of this builtin function. Returns
|
/// @returns the required extension of this builtin function. Returns
|
||||||
/// ast::Enable::ExtensionKind::kNotAnExtension if no extension is required.
|
/// ast::Enable::ExtensionKind::kNoExtension if no extension is required.
|
||||||
ast::Enable::ExtensionKind RequiredExtension() const;
|
ast::Enable::ExtensionKind RequiredExtension() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user