clang-format

Change-Id: Ibb0a7f4612ee5bf12f6c23a2529711808453685c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132880
Kokoro: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
Ben Clayton 2023-05-16 11:14:12 +00:00 committed by Dawn LUCI CQ
parent 14ed533565
commit c9dd75a0e9
3 changed files with 22 additions and 24 deletions

View File

@ -313,8 +313,8 @@ struct BufferAccess {
/// Store describes a single storage or uniform buffer write
struct Store {
const AssignmentStatement* assignment; // The AST assignment statement
BufferAccess target; // The target for the write
const AssignmentStatement* assignment; // The AST assignment statement
BufferAccess target; // The target for the write
};
} // namespace

View File

@ -101,20 +101,19 @@ Transform::ApplyResult SubstituteOverride::Apply(const Program* src,
// Ensure that objects that are indexed with an override-expression are materialized.
// If the object is not materialized, and the 'override' variable is turned to a 'const', the
// resulting type of the index may change. See: crbug.com/tint/1697.
ctx.ReplaceAll(
[&](const IndexAccessorExpression* expr) -> const IndexAccessorExpression* {
if (auto* sem = src->Sem().Get(expr)) {
if (auto* access = sem->UnwrapMaterialize()->As<sem::IndexAccessorExpression>()) {
if (access->Object()->UnwrapMaterialize()->Type()->HoldsAbstract() &&
access->Index()->Stage() == sem::EvaluationStage::kOverride) {
auto* obj = b.Call(builtin::str(builtin::Function::kTintMaterialize),
ctx.Clone(expr->object));
return b.IndexAccessor(obj, ctx.Clone(expr->index));
}
ctx.ReplaceAll([&](const IndexAccessorExpression* expr) -> const IndexAccessorExpression* {
if (auto* sem = src->Sem().Get(expr)) {
if (auto* access = sem->UnwrapMaterialize()->As<sem::IndexAccessorExpression>()) {
if (access->Object()->UnwrapMaterialize()->Type()->HoldsAbstract() &&
access->Index()->Stage() == sem::EvaluationStage::kOverride) {
auto* obj = b.Call(builtin::str(builtin::Function::kTintMaterialize),
ctx.Clone(expr->object));
return b.IndexAccessor(obj, ctx.Clone(expr->index));
}
}
return nullptr;
});
}
return nullptr;
});
ctx.Clone();
return Program(std::move(b));

View File

@ -154,16 +154,15 @@ Transform::ApplyResult TruncateInterstageVariables::Apply(const Program* src,
}
// Replace return statements with new truncated shader IO struct
ctx.ReplaceAll(
[&](const ReturnStatement* return_statement) -> const ReturnStatement* {
auto* return_sem = sem.Get(return_statement);
if (auto mapping_fn_sym =
entry_point_functions_to_truncate_functions.Find(return_sem->Function())) {
return b.Return(return_statement->source,
b.Call(*mapping_fn_sym, ctx.Clone(return_statement->value)));
}
return nullptr;
});
ctx.ReplaceAll([&](const ReturnStatement* return_statement) -> const ReturnStatement* {
auto* return_sem = sem.Get(return_statement);
if (auto mapping_fn_sym =
entry_point_functions_to_truncate_functions.Find(return_sem->Function())) {
return b.Return(return_statement->source,
b.Call(*mapping_fn_sym, ctx.Clone(return_statement->value)));
}
return nullptr;
});
// Remove IO attributes from old shader IO struct which is not used as entry point output
// anymore.