Use const*const* to annotate color state descriptors

Color state descriptors are a sequence of descriptors embedded
in RenderPipeline descriptor. We should use const*const* to
annotate them for supporting potential extended features added
in color state descriptors in future.

BUG=dawn:77

Change-Id: Id755569fa5076668c3db7b219b699845bc2a1d69
Reviewed-on: https://dawn-review.googlesource.com/c/4880
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
diff --git a/dawn.json b/dawn.json
index 4267240..b97fcc2 100644
--- a/dawn.json
+++ b/dawn.json
@@ -863,7 +863,7 @@
             {"name": "sample count", "type": "uint32_t"},
             {"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true},
             {"name": "num color states", "type": "uint32_t"},
-            {"name": "color states", "type": "color state descriptor", "annotation": "const*", "length": "num color states"}
+            {"name": "color states", "type": "color state descriptor", "annotation": "const*const*", "length": "num color states"}
         ]
     },
     "sampler": {
diff --git a/examples/Animometer.cpp b/examples/Animometer.cpp
index 5d2e281..e992643 100644
--- a/examples/Animometer.cpp
+++ b/examples/Animometer.cpp
@@ -115,7 +115,7 @@
     descriptor.cFragmentStage.module = fsModule;
     descriptor.depthStencilState = &descriptor.cDepthStencilState;
     descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
-    descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
+    descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
 
     pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/examples/CHelloTriangle.cpp b/examples/CHelloTriangle.cpp
index 5dd38b7..302db61 100644
--- a/examples/CHelloTriangle.cpp
+++ b/examples/CHelloTriangle.cpp
@@ -72,8 +72,6 @@
 
         descriptor.sampleCount = 1;
 
-        descriptor.numColorStates = 1;
-
         dawnBlendDescriptor blendDescriptor;
         blendDescriptor.operation = DAWN_BLEND_OPERATION_ADD;
         blendDescriptor.srcFactor = DAWN_BLEND_FACTOR_ONE;
@@ -84,7 +82,10 @@
         colorStateDescriptor.alphaBlend = blendDescriptor;
         colorStateDescriptor.colorBlend = blendDescriptor;
         colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
-        descriptor.colorStates = &colorStateDescriptor;
+
+        descriptor.numColorStates = 1;
+        dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
+        descriptor.colorStates = colorStatesPtr;
 
         dawnPipelineLayoutDescriptor pl;
         pl.nextInChain = nullptr;
diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp
index 8e2dd0c..d6d0e78 100644
--- a/examples/ComputeBoids.cpp
+++ b/examples/ComputeBoids.cpp
@@ -158,7 +158,7 @@
     descriptor.inputState = inputState;
     descriptor.depthStencilState = &descriptor.cDepthStencilState;
     descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
-    descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
+    descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
 
     renderPipeline = device.CreateRenderPipeline(&descriptor);
 }
diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp
index 8f837d1..e4f4bc1 100644
--- a/examples/CppHelloTriangle.cpp
+++ b/examples/CppHelloTriangle.cpp
@@ -142,7 +142,7 @@
     descriptor.inputState = inputState;
     descriptor.depthStencilState = &descriptor.cDepthStencilState;
     descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
-    descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
+    descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
 
     pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/examples/CubeReflection.cpp b/examples/CubeReflection.cpp
index 833c40b..728fbf0 100644
--- a/examples/CubeReflection.cpp
+++ b/examples/CubeReflection.cpp
@@ -217,7 +217,7 @@
     descriptor.inputState = inputState;
     descriptor.depthStencilState = &descriptor.cDepthStencilState;
     descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
-    descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
+    descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
     descriptor.cDepthStencilState.depthWriteEnabled = true;
     descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
 
@@ -230,7 +230,7 @@
     pDescriptor.inputState = inputState;
     pDescriptor.depthStencilState = &pDescriptor.cDepthStencilState;
     pDescriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
-    pDescriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
+    pDescriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
     pDescriptor.cDepthStencilState.stencilFront.passOp = dawn::StencilOperation::Replace;
     pDescriptor.cDepthStencilState.stencilBack.passOp = dawn::StencilOperation::Replace;
     pDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
@@ -244,7 +244,7 @@
     rfDescriptor.inputState = inputState;
     rfDescriptor.depthStencilState = &rfDescriptor.cDepthStencilState;
     rfDescriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
-    rfDescriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
+    rfDescriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
     rfDescriptor.cDepthStencilState.stencilFront.compare = dawn::CompareFunction::Equal;
     rfDescriptor.cDepthStencilState.stencilBack.compare = dawn::CompareFunction::Equal;
     rfDescriptor.cDepthStencilState.stencilFront.passOp = dawn::StencilOperation::Replace;
diff --git a/examples/glTFViewer/glTFViewer.cpp b/examples/glTFViewer/glTFViewer.cpp
index d0ec863..127c324 100644
--- a/examples/glTFViewer/glTFViewer.cpp
+++ b/examples/glTFViewer/glTFViewer.cpp
@@ -321,7 +321,7 @@
         descriptor.indexFormat = dawn::IndexFormat::Uint16;
         descriptor.depthStencilState = &descriptor.cDepthStencilState;
         descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
-        descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
+        descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
         descriptor.cDepthStencilState.depthWriteEnabled = true;
         descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
 
diff --git a/src/dawn_native/RenderPipeline.cpp b/src/dawn_native/RenderPipeline.cpp
index ac544a6..f954159 100644
--- a/src/dawn_native/RenderPipeline.cpp
+++ b/src/dawn_native/RenderPipeline.cpp
@@ -131,7 +131,7 @@
         }
 
         for (uint32_t i = 0; i < descriptor->numColorStates; ++i) {
-            DAWN_TRY(ValidateColorStateDescriptor(&descriptor->colorStates[i]));
+            DAWN_TRY(ValidateColorStateDescriptor(descriptor->colorStates[i]));
         }
 
         if (descriptor->depthStencilState) {
@@ -197,7 +197,7 @@
 
         for (uint32_t i = 0; i < descriptor->numColorStates; ++i) {
             mColorAttachmentsSet.set(i);
-            mColorStates[i] = descriptor->colorStates[i];
+            mColorStates[i] = *descriptor->colorStates[i];
         }
 
         // TODO(cwallez@chromium.org): Check against the shader module that the correct color
diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp
index b0a60ad..cc5e78c 100644
--- a/src/tests/end2end/BindGroupTests.cpp
+++ b/src/tests/end2end/BindGroupTests.cpp
@@ -130,7 +130,7 @@
     textureDescriptor.layout = pipelineLayout;
     textureDescriptor.cVertexStage.module = vsModule;
     textureDescriptor.cFragmentStage.module = fsModule;
-    textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
+    textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
 
@@ -215,7 +215,7 @@
     pipelineDescriptor.layout = pipelineLayout;
     pipelineDescriptor.cVertexStage.module = vsModule;
     pipelineDescriptor.cFragmentStage.module = fsModule;
-    pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
+    pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
 
@@ -337,7 +337,7 @@
     textureDescriptor.layout = pipelineLayout;
     textureDescriptor.cVertexStage.module = vsModule;
     textureDescriptor.cFragmentStage.module = fsModule;
-    textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
+    textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
 
@@ -431,7 +431,7 @@
     pipelineDescriptor.layout = pipelineLayout;
     pipelineDescriptor.cVertexStage.module = vsModule;
     pipelineDescriptor.cFragmentStage.module = fsModule;
-    pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
+    pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
     dawn::CommandEncoder encoder = device.CreateCommandEncoder();
diff --git a/src/tests/end2end/ColorStateTests.cpp b/src/tests/end2end/ColorStateTests.cpp
index ea099f4..33a7274 100644
--- a/src/tests/end2end/ColorStateTests.cpp
+++ b/src/tests/end2end/ColorStateTests.cpp
@@ -54,7 +54,7 @@
 
     // Set up basePipeline and testPipeline. testPipeline has the given blend state on the first
     // attachment. basePipeline has no blending
-    void SetupSingleSourcePipelines(const dawn::ColorStateDescriptor& colorStateDescriptor) {
+    void SetupSingleSourcePipelines(dawn::ColorStateDescriptor colorStateDescriptor) {
         dawn::ShaderModule fsModule =
             utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"(
                 #version 450
@@ -73,7 +73,7 @@
         baseDescriptor.layout = pipelineLayout;
         baseDescriptor.cVertexStage.module = vsModule;
         baseDescriptor.cFragmentStage.module = fsModule;
-        baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
+        baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
 
         basePipeline = device.CreateRenderPipeline(&baseDescriptor);
 
@@ -81,8 +81,8 @@
         testDescriptor.layout = pipelineLayout;
         testDescriptor.cVertexStage.module = vsModule;
         testDescriptor.cFragmentStage.module = fsModule;
-        testDescriptor.cColorStates[0] = colorStateDescriptor;
-        testDescriptor.cColorStates[0].format = renderPass.colorFormat;
+        testDescriptor.cColorStates[0] = &colorStateDescriptor;
+        testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
 
         testPipeline = device.CreateRenderPipeline(&testDescriptor);
     }
@@ -834,14 +834,14 @@
     blend3.srcFactor = dawn::BlendFactor::One;
     blend3.dstFactor = dawn::BlendFactor::One;
 
-    testDescriptor.cColorStates[0].colorBlend = blend1;
-    testDescriptor.cColorStates[0].alphaBlend = blend1;
+    testDescriptor.cColorStates[0]->colorBlend = blend1;
+    testDescriptor.cColorStates[0]->alphaBlend = blend1;
 
-    testDescriptor.cColorStates[1].colorBlend = blend2;
-    testDescriptor.cColorStates[1].alphaBlend = blend2;
+    testDescriptor.cColorStates[1]->colorBlend = blend2;
+    testDescriptor.cColorStates[1]->alphaBlend = blend2;
 
-    testDescriptor.cColorStates[3].colorBlend = blend3;
-    testDescriptor.cColorStates[3].alphaBlend = blend3;
+    testDescriptor.cColorStates[3]->colorBlend = blend3;
+    testDescriptor.cColorStates[3]->alphaBlend = blend3;
 
     testPipeline = device.CreateRenderPipeline(&testDescriptor);
 
@@ -909,7 +909,7 @@
     baseDescriptor.layout = pipelineLayout;
     baseDescriptor.cVertexStage.module = vsModule;
     baseDescriptor.cFragmentStage.module = fsModule;
-    baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
+    baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
 
     basePipeline = device.CreateRenderPipeline(&baseDescriptor);
 
@@ -917,14 +917,14 @@
     testDescriptor.layout = pipelineLayout;
     testDescriptor.cVertexStage.module = vsModule;
     testDescriptor.cFragmentStage.module = fsModule;
-    testDescriptor.cColorStates[0].format = renderPass.colorFormat;
+    testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
 
     dawn::BlendDescriptor blend;
     blend.operation = dawn::BlendOperation::Add;
     blend.srcFactor = dawn::BlendFactor::BlendColor;
     blend.dstFactor = dawn::BlendFactor::One;
-    testDescriptor.cColorStates[0].colorBlend = blend;
-    testDescriptor.cColorStates[0].alphaBlend = blend;
+    testDescriptor.cColorStates[0]->colorBlend = blend;
+    testDescriptor.cColorStates[0]->alphaBlend = blend;
 
     testPipeline = device.CreateRenderPipeline(&testDescriptor);
     constexpr dawn::Color kWhite{1.0f, 1.0f, 1.0f, 1.0f};
diff --git a/src/tests/end2end/DrawIndexedTests.cpp b/src/tests/end2end/DrawIndexedTests.cpp
index 3148516..9324226 100644
--- a/src/tests/end2end/DrawIndexedTests.cpp
+++ b/src/tests/end2end/DrawIndexedTests.cpp
@@ -64,7 +64,7 @@
             descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
             descriptor.indexFormat = dawn::IndexFormat::Uint32;
             descriptor.inputState = inputState;
-            descriptor.cColorStates[0].format = renderPass.colorFormat;
+            descriptor.cColorStates[0]->format = renderPass.colorFormat;
 
             pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/src/tests/end2end/DrawTests.cpp b/src/tests/end2end/DrawTests.cpp
index b7eed7a..48a8311 100644
--- a/src/tests/end2end/DrawTests.cpp
+++ b/src/tests/end2end/DrawTests.cpp
@@ -62,7 +62,7 @@
         descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
         descriptor.indexFormat = dawn::IndexFormat::Uint32;
         descriptor.inputState = inputState;
-        descriptor.cColorStates[0].format = renderPass.colorFormat;
+        descriptor.cColorStates[0]->format = renderPass.colorFormat;
 
         pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp
index b940179..6b26a1e 100644
--- a/src/tests/end2end/IndexFormatTests.cpp
+++ b/src/tests/end2end/IndexFormatTests.cpp
@@ -69,7 +69,7 @@
             descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
             descriptor.indexFormat = format;
             descriptor.inputState = inputState;
-            descriptor.cColorStates[0].format = renderPass.colorFormat;
+            descriptor.cColorStates[0]->format = renderPass.colorFormat;
 
             return device.CreateRenderPipeline(&descriptor);
         }
diff --git a/src/tests/end2end/InputStateTests.cpp b/src/tests/end2end/InputStateTests.cpp
index 9e365c3..d2367a4 100644
--- a/src/tests/end2end/InputStateTests.cpp
+++ b/src/tests/end2end/InputStateTests.cpp
@@ -125,7 +125,7 @@
             descriptor.cVertexStage.module = vsModule;
             descriptor.cFragmentStage.module = fsModule;
             descriptor.inputState = inputState;
-            descriptor.cColorStates[0].format = renderPass.colorFormat;
+            descriptor.cColorStates[0]->format = renderPass.colorFormat;
 
             return device.CreateRenderPipeline(&descriptor);
         }
diff --git a/src/tests/end2end/PrimitiveTopologyTests.cpp b/src/tests/end2end/PrimitiveTopologyTests.cpp
index 791c8b3..bff5644 100644
--- a/src/tests/end2end/PrimitiveTopologyTests.cpp
+++ b/src/tests/end2end/PrimitiveTopologyTests.cpp
@@ -203,7 +203,7 @@
             descriptor.cFragmentStage.module = fsModule;
             descriptor.primitiveTopology = primitiveTopology;
             descriptor.inputState = inputState;
-            descriptor.cColorStates[0].format = renderPass.colorFormat;
+            descriptor.cColorStates[0]->format = renderPass.colorFormat;
 
             dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/src/tests/end2end/PushConstantTests.cpp b/src/tests/end2end/PushConstantTests.cpp
index e8cf5eb..a9e4842 100644
--- a/src/tests/end2end/PushConstantTests.cpp
+++ b/src/tests/end2end/PushConstantTests.cpp
@@ -195,8 +195,8 @@
             blend.operation = dawn::BlendOperation::Add;
             blend.srcFactor = dawn::BlendFactor::One;
             blend.dstFactor = dawn::BlendFactor::One;
-            descriptor.cColorStates[0].alphaBlend = blend;
-            descriptor.cColorStates[0].colorBlend = blend;
+            descriptor.cColorStates[0]->alphaBlend = blend;
+            descriptor.cColorStates[0]->colorBlend = blend;
 
             return device.CreateRenderPipeline(&descriptor);
         }
diff --git a/src/tests/end2end/RenderPassTests.cpp b/src/tests/end2end/RenderPassTests.cpp
index 94c4abb..51c0b0f 100644
--- a/src/tests/end2end/RenderPassTests.cpp
+++ b/src/tests/end2end/RenderPassTests.cpp
@@ -48,7 +48,7 @@
         descriptor.cFragmentStage.module = fsModule;
         descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
         descriptor.indexFormat = dawn::IndexFormat::Uint32;
-        descriptor.cColorStates[0].format = kFormat;
+        descriptor.cColorStates[0]->format = kFormat;
 
         pipeline = device.CreateRenderPipeline(&descriptor);
     }
diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp
index 9f2f567..0bb6fe2 100644
--- a/src/tests/end2end/SamplerTests.cpp
+++ b/src/tests/end2end/SamplerTests.cpp
@@ -77,7 +77,7 @@
         pipelineDescriptor.layout = pipelineLayout;
         pipelineDescriptor.cVertexStage.module = vsModule;
         pipelineDescriptor.cFragmentStage.module = fsModule;
-        pipelineDescriptor.cColorStates[0].format = mRenderPass.colorFormat;
+        pipelineDescriptor.cColorStates[0]->format = mRenderPass.colorFormat;
 
         mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
 
diff --git a/src/tests/end2end/ScissorTests.cpp b/src/tests/end2end/ScissorTests.cpp
index 95c61ad..65f80ed 100644
--- a/src/tests/end2end/ScissorTests.cpp
+++ b/src/tests/end2end/ScissorTests.cpp
@@ -40,7 +40,7 @@
         utils::ComboRenderPipelineDescriptor descriptor(device);
         descriptor.cVertexStage.module = vsModule;
         descriptor.cFragmentStage.module = fsModule;
-        descriptor.cColorStates[0].format = format;
+        descriptor.cColorStates[0]->format = format;
 
         return device.CreateRenderPipeline(&descriptor);
     }
diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp
index 5c00f11..2fc8d78 100644
--- a/src/tests/end2end/TextureViewTests.cpp
+++ b/src/tests/end2end/TextureViewTests.cpp
@@ -172,7 +172,7 @@
         textureDescriptor.cVertexStage.module = mVSModule;
         textureDescriptor.cFragmentStage.module = fsModule;
         textureDescriptor.layout = mPipelineLayout;
-        textureDescriptor.cColorStates[0].format = mRenderPass.colorFormat;
+        textureDescriptor.cColorStates[0]->format = mRenderPass.colorFormat;
 
         dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
 
@@ -516,7 +516,7 @@
         utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
         pipelineDescriptor.cVertexStage.module = vsModule;
         pipelineDescriptor.cFragmentStage.module = oneColorFsModule;
-        pipelineDescriptor.cColorStates[0].format = kDefaultFormat;
+        pipelineDescriptor.cColorStates[0]->format = kDefaultFormat;
 
         dawn::RenderPipeline oneColorPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
 
diff --git a/src/tests/end2end/ViewportOrientationTests.cpp b/src/tests/end2end/ViewportOrientationTests.cpp
index 074997eb..ee49058 100644
--- a/src/tests/end2end/ViewportOrientationTests.cpp
+++ b/src/tests/end2end/ViewportOrientationTests.cpp
@@ -40,7 +40,7 @@
     descriptor.cVertexStage.module = vsModule;
     descriptor.cFragmentStage.module = fsModule;
     descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
-    descriptor.cColorStates[0].format = renderPass.colorFormat;
+    descriptor.cColorStates[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/src/tests/unittests/validation/InputStateValidationTests.cpp b/src/tests/unittests/validation/InputStateValidationTests.cpp
index d5d1d70..724a061 100644
--- a/src/tests/unittests/validation/InputStateValidationTests.cpp
+++ b/src/tests/unittests/validation/InputStateValidationTests.cpp
@@ -39,7 +39,7 @@
             descriptor.cVertexStage.module = vsModule;
             descriptor.cFragmentStage.module = fsModule;
             descriptor.inputState = inputState;
-            descriptor.cColorStates[0].format = dawn::TextureFormat::R8G8B8A8Unorm;
+            descriptor.cColorStates[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
 
             if (!success) {
                 ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
diff --git a/src/tests/unittests/wire/WireArgumentTests.cpp b/src/tests/unittests/wire/WireArgumentTests.cpp
index 4108df0..d1fdbf0 100644
--- a/src/tests/unittests/wire/WireArgumentTests.cpp
+++ b/src/tests/unittests/wire/WireArgumentTests.cpp
@@ -154,7 +154,8 @@
     pipelineDescriptor.fragmentStage = &fragmentStage;
 
     pipelineDescriptor.numColorStates = 1;
-    pipelineDescriptor.colorStates = &colorStateDescriptor;
+    dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
+    pipelineDescriptor.colorStates = colorStatesPtr;
 
     pipelineDescriptor.sampleCount = 1;
     pipelineDescriptor.layout = layout;
diff --git a/src/tests/unittests/wire/WireOptionalTests.cpp b/src/tests/unittests/wire/WireOptionalTests.cpp
index 71cf5de..73803ce 100644
--- a/src/tests/unittests/wire/WireOptionalTests.cpp
+++ b/src/tests/unittests/wire/WireOptionalTests.cpp
@@ -139,7 +139,8 @@
     pipelineDescriptor.fragmentStage = &fragmentStage;
 
     pipelineDescriptor.numColorStates = 1;
-    pipelineDescriptor.colorStates = &colorStateDescriptor;
+    dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
+    pipelineDescriptor.colorStates = colorStatesPtr;
 
     pipelineDescriptor.sampleCount = 1;
     pipelineDescriptor.layout = layout;
diff --git a/src/utils/ComboRenderPipelineDescriptor.cpp b/src/utils/ComboRenderPipelineDescriptor.cpp
index 9aff3f2..165d45b 100644
--- a/src/utils/ComboRenderPipelineDescriptor.cpp
+++ b/src/utils/ComboRenderPipelineDescriptor.cpp
@@ -52,7 +52,8 @@
             colorStateDescriptor.colorBlend = blend;
             colorStateDescriptor.colorWriteMask = dawn::ColorWriteMask::All;
             for (uint32_t i = 0; i < kMaxColorAttachments; ++i) {
-                cColorStates[i] = colorStateDescriptor;
+                mColorStates[i] = colorStateDescriptor;
+                cColorStates[i] = &mColorStates[i];
             }
         }
 
diff --git a/src/utils/ComboRenderPipelineDescriptor.h b/src/utils/ComboRenderPipelineDescriptor.h
index 2318b4d..d5e50e9 100644
--- a/src/utils/ComboRenderPipelineDescriptor.h
+++ b/src/utils/ComboRenderPipelineDescriptor.h
@@ -30,10 +30,11 @@
         dawn::PipelineStageDescriptor cVertexStage;

         dawn::PipelineStageDescriptor cFragmentStage;

 

-        std::array<dawn::ColorStateDescriptor, kMaxColorAttachments> cColorStates;

+        std::array<dawn::ColorStateDescriptor*, kMaxColorAttachments> cColorStates;

         dawn::DepthStencilStateDescriptor cDepthStencilState;

 

       private:

+        dawn::ColorStateDescriptor mColorStates[kMaxColorAttachments];

     };

 

 }  // namespace utils