mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
tint: Refactor Extensions / Enables.
* Extract ast::Enable::ExtensionKind to ast::Extension. * Move the parsing out of ast::Enable and next to ast/extension.h * Change the ast::Enable constructor to take the Extension, instead of a std::string. It's the WGSL parser's responsibility to parse, not the AST nodes. * Add ProgramBuilder::Enable() helper. * Keep ast::Module simple - keep track of the declared AST Enable nodes, don't do any deduplicating of the enabled extensions. * Add the de-duplicated ast::Extensions to the sem::Module. * Remove the kInternalExtensionForTesting enum value - we have kF16 now, which can be used instead for testing. * Rename kNoExtension to kNone. Bug: tint:1472 Change-Id: I9af635e95d36991ea468e6e0bf6798bb50937edc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90523 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
23696b1ba3
commit
7f2b8cd8fc
@@ -17,6 +17,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "src/tint/program_builder.h"
|
||||
#include "src/tint/sem/module.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::DisableUniformityAnalysis);
|
||||
|
||||
@@ -27,13 +28,12 @@ DisableUniformityAnalysis::DisableUniformityAnalysis() = default;
|
||||
DisableUniformityAnalysis::~DisableUniformityAnalysis() = default;
|
||||
|
||||
bool DisableUniformityAnalysis::ShouldRun(const Program* program, const DataMap&) const {
|
||||
return !program->AST().Extensions().count(
|
||||
ast::Enable::ExtensionKind::kChromiumDisableUniformityAnalysis);
|
||||
return !program->Sem().Module()->Extensions().contains(
|
||||
ast::Extension::kChromiumDisableUniformityAnalysis);
|
||||
}
|
||||
|
||||
void DisableUniformityAnalysis::Run(CloneContext& ctx, const DataMap&, DataMap&) const {
|
||||
ctx.dst->AST().AddEnable(ctx.dst->create<ast::Enable>(
|
||||
ast::Enable::KindToName(ast::Enable::ExtensionKind::kChromiumDisableUniformityAnalysis)));
|
||||
ctx.dst->Enable(ast::Extension::kChromiumDisableUniformityAnalysis);
|
||||
ctx.Clone();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user