From 53441844030d33e5b1ebeca65da29b8606e5e9fc Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Mon, 8 Aug 2022 16:36:30 +0000 Subject: [PATCH] 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 Commit-Queue: Austin Eng Reviewed-by: Corentin Wallez Reviewed-by: Austin Eng --- src/dawn/native/webgpu_absl_format.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dawn/native/webgpu_absl_format.cpp b/src/dawn/native/webgpu_absl_format.cpp index 2550f4b1f5..8eddf467bb 100644 --- a/src/dawn/native/webgpu_absl_format.cpp +++ b/src/dawn/native/webgpu_absl_format.cpp @@ -181,16 +181,16 @@ absl::FormatConvertResult 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++;