[dawn][metal] ArgBufs: fix when using EmulateStoreAndMSAAResolve

Missing argument caused useResource not to be called when this
workaround was active.

Test: MultisampledRenderingTest.*
Test: DawnLoadResolveTextureTest.TwoOutputsDrawThenLoadColor[01]
Test: TextureViewRenderingTest.SRGBReinterpretionResolveAttachment
Bug: 363031535
Change-Id: Ifb4beec510a50d3a7b76b91518d28802d5f1f528
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/301376
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/native/metal/UtilsMetal.mm b/src/dawn/native/metal/UtilsMetal.mm
index 17e5de3..8319377 100644
--- a/src/dawn/native/metal/UtilsMetal.mm
+++ b/src/dawn/native/metal/UtilsMetal.mm
@@ -938,9 +938,11 @@
 
         // If we found a store + MSAA resolve we need to resolve in a different render pass.
         if (hasStoreAndMSAAResolve) {
-            DAWN_TRY(EncodeMetalRenderPass(device, commandContext, nullptr, mtlRenderPass, width,
-                                           height, std::move(encodeInside), renderPassCmd));
+            // First run the regular render pass to store without resolving.
+            DAWN_TRY(EncodeMetalRenderPass(device, commandContext, resourceUsage, mtlRenderPass,
+                                           width, height, std::move(encodeInside), renderPassCmd));
 
+            // Then run an extra render pass to do the resolve.
             ResolveInAnotherRenderPass(commandContext, mtlRenderPass, resolveTextures);
             return {};
         }
diff --git a/src/dawn/tests/end2end/MultisampledRenderingTests.cpp b/src/dawn/tests/end2end/MultisampledRenderingTests.cpp
index bfb833d..4b8c74d 100644
--- a/src/dawn/tests/end2end/MultisampledRenderingTests.cpp
+++ b/src/dawn/tests/end2end/MultisampledRenderingTests.cpp
@@ -91,7 +91,7 @@
                 @builtin(frag_depth) depth : f32,
             }
 
-            @fragment fn main() -> FragmentOut {
+            @fragment fn fmain_depth() -> FragmentOut {
                 var output : FragmentOut;
                 output.color = uBuffer.color;
                 output.depth = uBuffer.depth;
@@ -104,7 +104,7 @@
             }
             @group(0) @binding(0) var<uniform> uBuffer : U;
 
-            @fragment fn main() -> @location(0) vec4f {
+            @fragment fn fmain_no_depth() -> @location(0) vec4f {
                 return uBuffer.color;
             })";
 
@@ -218,6 +218,7 @@
                                  uint32_t uniformDataSize) {
         wgpu::Buffer uniformBuffer = utils::CreateBufferFromData(
             device, uniformData, uniformDataSize, wgpu::BufferUsage::Uniform);
+        uniformBuffer.SetLabel("uniformBuffer");
         wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
                                                          {{0, uniformBuffer, 0, uniformDataSize}});