Import Tint changes from Dawn
Changes:
- 6a0c7b1934e4b429191fa3a5332a88c7e56142b8 Run the code formatter. by dan sinclair <dsinclair@chromium.org>
GitOrigin-RevId: 6a0c7b1934e4b429191fa3a5332a88c7e56142b8
Change-Id: I7dedae0ba05ce465d6f2f04e87820ccb3a3e8abc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/191360
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/cmd/tint/main.cc b/src/tint/cmd/tint/main.cc
index b2dc66c..caba468 100644
--- a/src/tint/cmd/tint/main.cc
+++ b/src/tint/cmd/tint/main.cc
@@ -1313,8 +1313,7 @@
}
if (!WriteFile(options.output_file, "wb", ToStdVector(pb.Get()))) {
- std::cerr << "Failed to write protobuf binary out to file"
- << "\n";
+ std::cerr << "Failed to write protobuf binary out to file" << "\n";
return false;
}
@@ -1342,8 +1341,7 @@
}
if (!WriteFile(options.output_file, "w", pb.Get())) {
- std::cerr << "Failed to write protobuf debug text out to file"
- << "\n";
+ std::cerr << "Failed to write protobuf debug text out to file" << "\n";
return false;
}
diff --git a/src/tint/lang/core/constant/eval.cc b/src/tint/lang/core/constant/eval.cc
index ee896b7..a8e1f84 100644
--- a/src/tint/lang/core/constant/eval.cc
+++ b/src/tint/lang/core/constant/eval.cc
@@ -195,16 +195,15 @@
template <typename VALUE_TY>
std::string OverflowErrorMessage(VALUE_TY value, std::string_view target_ty) {
StringStream ss;
- ss << "value " << value << " cannot be represented as "
- << "'" << target_ty << "'";
+ ss << "value " << value << " cannot be represented as " << "'" << target_ty << "'";
return ss.str();
}
template <typename NumberT>
std::string OverflowExpErrorMessage(std::string_view base, NumberT exp) {
StringStream ss;
- ss << base << "^" << exp << " cannot be represented as "
- << "'" << FriendlyName<NumberT>() << "'";
+ ss << base << "^" << exp << " cannot be represented as " << "'" << FriendlyName<NumberT>()
+ << "'";
return ss.str();
}
diff --git a/src/tint/lang/core/constant/eval_test.h b/src/tint/lang/core/constant/eval_test.h
index 2158453..2cd60d0 100644
--- a/src/tint/lang/core/constant/eval_test.h
+++ b/src/tint/lang/core/constant/eval_test.h
@@ -253,8 +253,7 @@
template <typename VALUE_TY>
std::string OverflowErrorMessage(VALUE_TY value, std::string_view target_ty) {
StringStream ss;
- ss << "value " << value << " cannot be represented as "
- << "'" << target_ty << "'";
+ ss << "value " << value << " cannot be represented as " << "'" << target_ty << "'";
return ss.str();
}
@@ -262,8 +261,8 @@
template <typename NumberT>
std::string OverflowExpErrorMessage(std::string_view base, NumberT exp) {
StringStream ss;
- ss << base << "^" << exp << " cannot be represented as "
- << "'" << FriendlyName<NumberT>() << "'";
+ ss << base << "^" << exp << " cannot be represented as " << "'" << FriendlyName<NumberT>()
+ << "'";
return ss.str();
}
diff --git a/src/tint/lang/core/type/input_attachment.cc b/src/tint/lang/core/type/input_attachment.cc
index 6697e33..11c96be 100644
--- a/src/tint/lang/core/type/input_attachment.cc
+++ b/src/tint/lang/core/type/input_attachment.cc
@@ -54,8 +54,7 @@
std::string InputAttachment::FriendlyName() const {
StringStream out;
- out << "input_attachment"
- << "<" << type_->FriendlyName() << ">";
+ out << "input_attachment" << "<" << type_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
index c292f98..b70890f 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
@@ -2367,8 +2367,7 @@
if (auto* vec = builtin->ReturnType()->As<core::type::Vector>()) {
width = std::to_string(vec->Width());
}
- out << "f16tof32(f32tof16"
- << "(";
+ out << "f16tof32(f32tof16" << "(";
if (!EmitExpression(out, expr->args[0])) {
return false;
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/function.h b/src/tint/lang/spirv/reader/ast_parser/function.h
index f8f6bb9..5ac2cf0 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function.h
+++ b/src/tint/lang/spirv/reader/ast_parser/function.h
@@ -198,8 +198,8 @@
/// @returns the stream so calls can be chained
template <typename STREAM, typename = traits::EnableIfIsOStream<STREAM>>
auto& operator<<(STREAM& o, const BlockInfo& bi) {
- o << "BlockInfo{"
- << " id: " << bi.id << " pos: " << bi.pos << " merge_for_header: " << bi.merge_for_header
+ o << "BlockInfo{" << " id: " << bi.id << " pos: " << bi.pos
+ << " merge_for_header: " << bi.merge_for_header
<< " continue_for_header: " << bi.continue_for_header
<< " header_for_merge: " << bi.header_for_merge
<< " is_continue_entire_loop: " << int(bi.is_continue_entire_loop) << "}";
@@ -374,8 +374,7 @@
/// @returns the stream so calls can be chained
template <typename STREAM, typename = traits::EnableIfIsOStream<STREAM>>
auto& operator<<(STREAM& o, const DefInfo& di) {
- o << "DefInfo{"
- << " inst.result_id: " << di.inst.result_id();
+ o << "DefInfo{" << " inst.result_id: " << di.inst.result_id();
if (di.local.has_value()) {
const auto& dil = di.local.value();
o << " block_pos: " << dil.block_pos << " num_uses: " << dil.num_uses
diff --git a/src/tint/lang/wgsl/intrinsic/table_test.cc b/src/tint/lang/wgsl/intrinsic/table_test.cc
index 0393998..82170f5 100644
--- a/src/tint/lang/wgsl/intrinsic/table_test.cc
+++ b/src/tint/lang/wgsl/intrinsic/table_test.cc
@@ -1189,10 +1189,9 @@
Case::Create<AInt, AInt, AInt, AInt, AInt>()
)); // clang-format on
-INSTANTIATE_TEST_SUITE_P(
- VecAFloat_VecAInt,
- IntrinsicTableAbstractBinaryTest,
- testing::Values( // clang-format off
+INSTANTIATE_TEST_SUITE_P(VecAFloat_VecAInt,
+ IntrinsicTableAbstractBinaryTest,
+ testing::Values( // clang-format off
// result | param lhs | param rhs | arg lhs | arg rhs
Case::Create<AFloatV, AFloatV, AFloatV, AFloatV, AFloatV>(),
Case::Create<AFloatV, AFloatV, AFloatV, AFloatV, AIntV>(),
@@ -1216,37 +1215,33 @@
Case::Create<f32V, f32V, f32V, f32V, AFloatV>()
)); // clang-format on
-INSTANTIATE_TEST_SUITE_P(
- AFloat_i32,
- IntrinsicTableAbstractBinaryTest,
- testing::Values( // clang-format off
+INSTANTIATE_TEST_SUITE_P(AFloat_i32,
+ IntrinsicTableAbstractBinaryTest,
+ testing::Values( // clang-format off
// result | param lhs | param rhs | arg lhs | arg rhs
Case::Create<void, void, void, AFloat, i32>(false),
Case::Create<void, void, void, i32, AFloat>(false)
)); // clang-format on
-INSTANTIATE_TEST_SUITE_P(
- VecAFloat_Veci32,
- IntrinsicTableAbstractBinaryTest,
- testing::Values( // clang-format off
+INSTANTIATE_TEST_SUITE_P(VecAFloat_Veci32,
+ IntrinsicTableAbstractBinaryTest,
+ testing::Values( // clang-format off
// result | param lhs | param rhs | arg lhs | arg rhs
Case::Create<void, void, void, AFloatV, i32V>(false),
Case::Create<void, void, void, i32V, AFloatV>(false)
)); // clang-format on
-INSTANTIATE_TEST_SUITE_P(
- AFloat_u32,
- IntrinsicTableAbstractBinaryTest,
- testing::Values( // clang-format off
+INSTANTIATE_TEST_SUITE_P(AFloat_u32,
+ IntrinsicTableAbstractBinaryTest,
+ testing::Values( // clang-format off
// result | param lhs | param rhs | arg lhs | arg rhs
Case::Create<void, void, void, AFloat, u32>(false),
Case::Create<void, void, void, u32, AFloat>(false)
)); // clang-format on
-INSTANTIATE_TEST_SUITE_P(
- VecAFloat_Vecu32,
- IntrinsicTableAbstractBinaryTest,
- testing::Values( // clang-format off
+INSTANTIATE_TEST_SUITE_P(VecAFloat_Vecu32,
+ IntrinsicTableAbstractBinaryTest,
+ testing::Values( // clang-format off
// result | param lhs | param rhs | arg lhs | arg rhs
Case::Create<void, void, void, AFloatV, u32V>(false),
Case::Create<void, void, void, u32V, AFloatV>(false)
diff --git a/src/tint/lang/wgsl/resolver/uniformity_test.cc b/src/tint/lang/wgsl/resolver/uniformity_test.cc
index 092cfd0..f4f7614 100644
--- a/src/tint/lang/wgsl/resolver/uniformity_test.cc
+++ b/src/tint/lang/wgsl/resolver/uniformity_test.cc
@@ -9095,8 +9095,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, Directive) {
auto& param = GetParam();
StringStream ss;
- ss << "diagnostic(" << param << ", derivative_uniformity);"
- << R"(
+ ss << "diagnostic(" << param << ", derivative_uniformity);" << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@group(0) @binding(2) var s : sampler;
@@ -9126,9 +9125,8 @@
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@group(0) @binding(2) var s : sampler;
-)"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- <<
+)" << "@diagnostic("
+ << param << ", derivative_uniformity)" <<
R"(fn foo() {
if (non_uniform == 42) {
let color = textureSample(t, s, vec2(0, 0));
@@ -9155,8 +9153,7 @@
@group(0) @binding(2) var s : sampler;
fn foo() {
if (non_uniform == 42))"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"({
+ << "@diagnostic(" << param << ", derivative_uniformity)" << R"({
let color = textureSample(t, s, vec2(0, 0));
}
}
@@ -9178,8 +9175,8 @@
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)"
<< R"(for (var b = (non_uniform == 42 && dpdx(1.0) > 0.0); false;) {
}
}
@@ -9201,9 +9198,8 @@
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(for (; non_uniform == 42 && dpdx(1.0) > 0.0;) {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(for (; non_uniform == 42 && dpdx(1.0) > 0.0;) {
}
}
)";
@@ -9224,8 +9220,8 @@
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)"
<< R"(for (var b = false; false; b = (non_uniform == 42 && dpdx(1.0) > 0.0)) {
}
}
@@ -9249,9 +9245,8 @@
@group(0) @binding(1) var t : texture_2d<f32>;
@group(0) @binding(2) var s : sampler;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(for (; non_uniform == 42;) {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(for (; non_uniform == 42;) {
let color = textureSample(t, s, vec2(0, 0));
}
}
@@ -9273,9 +9268,8 @@
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(if (non_uniform == 42 && dpdx(1.0) > 0.0) {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(if (non_uniform == 42 && dpdx(1.0) > 0.0) {
}
}
)";
@@ -9298,9 +9292,8 @@
@group(0) @binding(1) var t : texture_2d<f32>;
@group(0) @binding(2) var s : sampler;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(if (non_uniform == 42) {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(if (non_uniform == 42) {
let color = textureSample(t, s, vec2(0, 0));
}
}
@@ -9324,9 +9317,8 @@
@group(0) @binding(1) var t : texture_2d<f32>;
@group(0) @binding(2) var s : sampler;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(if (non_uniform == 42) {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(if (non_uniform == 42) {
} else {
let color = textureSample(t, s, vec2(0, 0));
}
@@ -9349,9 +9341,8 @@
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(loop {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(loop {
_ = dpdx(1.0);
continuing {
break if non_uniform == 0;
@@ -9376,9 +9367,8 @@
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(loop {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(loop {
continuing {
_ = dpdx(1.0);
break if non_uniform == 0;
@@ -9404,8 +9394,7 @@
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
loop )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"( {
+ << "@diagnostic(" << param << ", derivative_uniformity)" << R"( {
_ = dpdx(1.0);
continuing {
break if non_uniform == 0;
@@ -9431,8 +9420,7 @@
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
loop )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"( {
+ << "@diagnostic(" << param << ", derivative_uniformity)" << R"( {
continuing {
_ = dpdx(1.0);
break if non_uniform == 0;
@@ -9459,8 +9447,7 @@
fn foo() {
loop {
continuing )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"( {
+ << "@diagnostic(" << param << ", derivative_uniformity)" << R"( {
_ = dpdx(1.0);
break if non_uniform == 0;
}
@@ -9484,8 +9471,8 @@
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)"
<< R"(switch (i32(non_uniform == 42 && dpdx(1.0) > 0.0)) {
default {}
}
@@ -9510,9 +9497,8 @@
@group(0) @binding(1) var t : texture_2d<f32>;
@group(0) @binding(2) var s : sampler;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(switch (non_uniform) {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(switch (non_uniform) {
default {
let color = textureSample(t, s, vec2(0, 0));
}
@@ -9539,8 +9525,7 @@
@group(0) @binding(2) var s : sampler;
fn foo() {
switch (non_uniform))"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"( {
+ << "@diagnostic(" << param << ", derivative_uniformity)" << R"( {
default {
let color = textureSample(t, s, vec2(0, 0));
}
@@ -9564,9 +9549,8 @@
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(while (non_uniform == 42 && dpdx(1.0) > 0.0) {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(while (non_uniform == 42 && dpdx(1.0) > 0.0) {
}
}
)";
@@ -9589,9 +9573,8 @@
@group(0) @binding(1) var t : texture_2d<f32>;
@group(0) @binding(2) var s : sampler;
fn foo() {
- )"
- << "@diagnostic(" << param << ", derivative_uniformity)"
- << R"(while (non_uniform == 42) {
+ )" << "@diagnostic("
+ << param << ", derivative_uniformity)" << R"(while (non_uniform == 42) {
let color = textureSample(t, s, vec2(0, 0));
}
}