Add comma between non-undefined and undefined format in error message

This patch adds a missing comma between non-undefined and undefined
format in the error message for incompatible attachment states. In
previous implementation, when we output an "undefined" just after a
non-undefined format, we will always miss a comma as "needsComma" is
ignore before the output of "undefined".

Bug: dawn:563
Change-Id: I39ba4e33d88382df12d5de0271f1274559cf027d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98481
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Jiawei Shao 2022-08-08 16:36:30 +00:00 committed by Dawn LUCI CQ
parent ef997b5fda
commit 5344184403
1 changed files with 4 additions and 4 deletions

View File

@ -181,16 +181,16 @@ absl::FormatConvertResult<absl::FormatConversionCharSet::kString> AbslFormatConv
bool needsComma = false;
for (ColorAttachmentIndex i : IterateBitSet(value->GetColorAttachmentsMask())) {
if (needsComma) {
s->Append(", ");
}
while (nextColorIndex < i) {
s->Append(absl::StrFormat("%s, ", wgpu::TextureFormat::Undefined));
nextColorIndex++;
needsComma = false;
}
if (needsComma) {
s->Append(", ");
}
s->Append(absl::StrFormat("%s", value->GetColorAttachmentFormat(i)));
nextColorIndex++;