Emit float32-blendable deprecation warning in DevTools

This CL makes sure the float32-blendable deprecation warning
shows up in DevTools by using device->EmitWarningOnce() instead
of device->GetInstance()->EmitDeprecationWarning.

Bug: 364987733
Change-Id: I16dff5cb3c62dba88065142b7d1eeb598cdfa5ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/211154
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Fr (se prononce Freu) <beaufort.francois@gmail.com>
diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp
index fd8f037..4b92d19 100644
--- a/src/dawn/native/Device.cpp
+++ b/src/dawn/native/Device.cpp
@@ -1885,9 +1885,9 @@
     ++mLazyClearCountForTesting;
 }
 
-void DeviceBase::EmitWarningOnce(const std::string& message) {
-    if (mWarnings.insert(message).second) {
-        this->EmitLog(WGPULoggingType_Warning, message.c_str());
+void DeviceBase::EmitWarningOnce(std::string_view message) {
+    if (mWarnings.insert(std::string{message}).second) {
+        this->EmitLog(WGPULoggingType_Warning, message);
     }
 }
 
diff --git a/src/dawn/native/Device.h b/src/dawn/native/Device.h
index 7979f28..ebb92c2 100644
--- a/src/dawn/native/Device.h
+++ b/src/dawn/native/Device.h
@@ -355,7 +355,7 @@
 
     size_t GetLazyClearCountForTesting();
     void IncrementLazyClearCountForTesting();
-    void EmitWarningOnce(const std::string& message);
+    void EmitWarningOnce(std::string_view message);
     void EmitLog(std::string_view message);
     void EmitLog(WGPULoggingType loggingType, std::string_view message);
     void EmitCompilationLog(const ShaderModuleBase* module);
diff --git a/src/dawn/native/RenderPipeline.cpp b/src/dawn/native/RenderPipeline.cpp
index d7827aa..49f9c8b 100644
--- a/src/dawn/native/RenderPipeline.cpp
+++ b/src/dawn/native/RenderPipeline.cpp
@@ -29,6 +29,7 @@
 
 #include <algorithm>
 #include <cmath>
+#include <string>
 
 #include "absl/strings/str_format.h"
 #include "dawn/common/BitSetIterator.h"
@@ -516,10 +517,11 @@
             !(format->GetAspectInfo(Aspect::Color).supportedSampleTypes & SampleTypeBit::Float),
             "Blending is enabled but color format (%s) is not blendable.", format->format);
 
-        device->GetInstance()->EmitDeprecationWarning(absl::StrFormat(
+        std::string warning = absl::StrFormat(
             "Blending for color format (%s) requires the %s feature. Enabling "
             "blendability with %s was an implementation bug and is deprecated.",
-            format->format, ToAPI(Feature::Float32Blendable), ToAPI(Feature::Float32Filterable)));
+            format->format, ToAPI(Feature::Float32Blendable), ToAPI(Feature::Float32Filterable));
+        device->EmitWarningOnce(warning.c_str());
     }
 
     if (!fragmentWritten) {
diff --git a/src/dawn/native/Texture.cpp b/src/dawn/native/Texture.cpp
index 8232ea5..aa24c90 100644
--- a/src/dawn/native/Texture.cpp
+++ b/src/dawn/native/Texture.cpp
@@ -1378,7 +1378,7 @@
             "usages on texture views when the view format is not compatible with all inherited "
             "texture usages.",
             this, mFormat->format, inheritedUsage);
-        GetDevice()->EmitLog(WGPULoggingType_Warning, warning.c_str());
+        GetDevice()->EmitWarningOnce(warning.c_str());
     }
 }
 
diff --git a/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp
index 9e8531b..7f6ccc2 100644
--- a/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp
+++ b/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp
@@ -556,8 +556,10 @@
     }
 };
 
-// Tests that blending a float32 color formats without the float32-blendable feature emits a
-// deprecation warning with the float32-filterable feature.
+// TODO(crbug.com/364987733): Remove this test once float filterable texture types
+// are not considered blendable.
+// Tests that blending a float32 color formats without the float32-blendable feature
+// is still valid with the float32-filterable feature.
 TEST_F(Float32FilterableValidationTest, Float32BlendableFormatsWithoutFeature) {
     for (const auto f32Format : {wgpu::TextureFormat::R32Float, wgpu::TextureFormat::RG32Float,
                                  wgpu::TextureFormat::RGBA32Float}) {
@@ -567,7 +569,7 @@
         descriptor.cTargets[0].blend = &descriptor.cBlends[0];
         descriptor.cTargets[0].format = f32Format;
 
-        EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
+        device.CreateRenderPipeline(&descriptor);
     }
 }