Use const*const* to annotate a sequence of descriptors

BUG=dawn:77

Change-Id: I2a523e54a06173c157730e043c25e9629887fd1f
Reviewed-on: https://dawn-review.googlesource.com/c/3820
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/dawn.json b/dawn.json
index 6848bd8..271fd99 100644
--- a/dawn.json
+++ b/dawn.json
@@ -654,7 +654,7 @@
         "extensible": true,
         "members": [
             {"name": "num color attachments", "type": "uint32_t"},
-            {"name": "color attachments", "type": "attachment descriptor", "annotation": "const*", "length": "num color attachments"},
+            {"name": "color attachments", "type": "attachment descriptor", "annotation": "const*const*", "length": "num color attachments"},
             {"name": "has depth stencil attachment", "type": "bool"},
             {"name": "depth stencil attachment", "type": "attachment descriptor", "annotation":"const*"}
         ]
diff --git a/examples/Animometer.cpp b/examples/Animometer.cpp
index ff8b93d..30f42f1 100644
--- a/examples/Animometer.cpp
+++ b/examples/Animometer.cpp
@@ -115,8 +115,7 @@
     descriptor.cFragmentStage.module = fsModule;
     descriptor.cAttachmentsState.hasDepthStencilAttachment = true;
     descriptor.cDepthStencilAttachment.format = dawn::TextureFormat::D32FloatS8Uint;
-    descriptor.cColorAttachments[0].format =
-        GetPreferredSwapChainTextureFormat();
+    descriptor.cColorAttachments[0]->format = GetPreferredSwapChainTextureFormat();
 
     pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/examples/CHelloTriangle.cpp b/examples/CHelloTriangle.cpp
index 287a8ac..486f0d5 100644
--- a/examples/CHelloTriangle.cpp
+++ b/examples/CHelloTriangle.cpp
@@ -75,7 +75,8 @@
         attachmentsState.nextInChain = nullptr;
         attachmentsState.numColorAttachments = 1;
         dawnAttachmentDescriptor colorAttachment = {nullptr, swapChainFormat};
-        attachmentsState.colorAttachments = &colorAttachment;
+        dawnAttachmentDescriptor* colorAttachmentPtr[] = {&colorAttachment};
+        attachmentsState.colorAttachments = colorAttachmentPtr;
         attachmentsState.hasDepthStencilAttachment = false;
         // Even with hasDepthStencilAttachment = false, depthStencilAttachment must point to valid
         // data because we don't have optional substructures yet.
diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp
index 9c8c79a..ce5668c 100644
--- a/examples/ComputeBoids.cpp
+++ b/examples/ComputeBoids.cpp
@@ -130,8 +130,7 @@
     descriptor.inputState = inputState;
     descriptor.cAttachmentsState.hasDepthStencilAttachment = true;
     descriptor.cDepthStencilAttachment.format = dawn::TextureFormat::D32FloatS8Uint;
-    descriptor.cColorAttachments[0].format =
-        GetPreferredSwapChainTextureFormat();
+    descriptor.cColorAttachments[0]->format = GetPreferredSwapChainTextureFormat();
 
     renderPipeline = device.CreateRenderPipeline(&descriptor);
 }
diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp
index 81cbea8..7aca392 100644
--- a/examples/CppHelloTriangle.cpp
+++ b/examples/CppHelloTriangle.cpp
@@ -133,8 +133,7 @@
     descriptor.inputState = inputState;
     descriptor.cAttachmentsState.hasDepthStencilAttachment = true;
     descriptor.cDepthStencilAttachment.format = dawn::TextureFormat::D32FloatS8Uint;
-    descriptor.cColorAttachments[0].format =
-        GetPreferredSwapChainTextureFormat();
+    descriptor.cColorAttachments[0]->format = GetPreferredSwapChainTextureFormat();
 
     pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/examples/CubeReflection.cpp b/examples/CubeReflection.cpp
index 1e70901..7266539 100644
--- a/examples/CubeReflection.cpp
+++ b/examples/CubeReflection.cpp
@@ -200,8 +200,7 @@
     descriptor.inputState = inputState;
     descriptor.cAttachmentsState.hasDepthStencilAttachment = true;
     descriptor.cDepthStencilAttachment.format = dawn::TextureFormat::D32FloatS8Uint;
-    descriptor.cColorAttachments[0].format =
-        GetPreferredSwapChainTextureFormat();
+    descriptor.cColorAttachments[0]->format = GetPreferredSwapChainTextureFormat();
     descriptor.cDepthStencilState.depthWriteEnabled = true;
     descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
 
@@ -214,8 +213,7 @@
     pDescriptor.inputState = inputState;
     pDescriptor.cAttachmentsState.hasDepthStencilAttachment = true;
     pDescriptor.cDepthStencilAttachment.format = dawn::TextureFormat::D32FloatS8Uint;
-    pDescriptor.cColorAttachments[0].format =
-        GetPreferredSwapChainTextureFormat();
+    pDescriptor.cColorAttachments[0]->format = GetPreferredSwapChainTextureFormat();
     pDescriptor.cDepthStencilState.front.passOp = dawn::StencilOperation::Replace;
     pDescriptor.cDepthStencilState.back.passOp = dawn::StencilOperation::Replace;
     pDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
@@ -229,8 +227,7 @@
     rfDescriptor.inputState = inputState;
     rfDescriptor.cAttachmentsState.hasDepthStencilAttachment = true;
     rfDescriptor.cDepthStencilAttachment.format = dawn::TextureFormat::D32FloatS8Uint;
-    rfDescriptor.cColorAttachments[0].format =
-        GetPreferredSwapChainTextureFormat();
+    rfDescriptor.cColorAttachments[0]->format = GetPreferredSwapChainTextureFormat();
     pDescriptor.cDepthStencilState.front.compare = dawn::CompareFunction::Equal;
     pDescriptor.cDepthStencilState.back.compare = dawn::CompareFunction::Equal;
     pDescriptor.cDepthStencilState.front.passOp = dawn::StencilOperation::Replace;
diff --git a/examples/glTFViewer/glTFViewer.cpp b/examples/glTFViewer/glTFViewer.cpp
index 4e2b3fe..acefd2a 100644
--- a/examples/glTFViewer/glTFViewer.cpp
+++ b/examples/glTFViewer/glTFViewer.cpp
@@ -292,8 +292,7 @@
         descriptor.indexFormat = dawn::IndexFormat::Uint16;
         descriptor.cAttachmentsState.hasDepthStencilAttachment = true;
         descriptor.cDepthStencilAttachment.format = dawn::TextureFormat::D32FloatS8Uint;
-        descriptor.cColorAttachments[0].format =
-            GetPreferredSwapChainTextureFormat();
+        descriptor.cColorAttachments[0]->format = GetPreferredSwapChainTextureFormat();
         descriptor.cDepthStencilState.depthWriteEnabled = true;
         descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
 
diff --git a/generator/main.py b/generator/main.py
index 59fd37d..53e3068 100644
--- a/generator/main.py
+++ b/generator/main.py
@@ -243,6 +243,8 @@
         return typ + ' ' + name
     elif arg.annotation == 'const*':
         return typ + ' const * ' + name
+    elif arg.annotation == 'const*const*':
+        return 'const ' + typ + '* const * ' + name
     else:
         assert(False)
 
diff --git a/generator/templates/dawn_wire/WireCmd.cpp b/generator/templates/dawn_wire/WireCmd.cpp
index 782cbd3..75ac7f4 100644
--- a/generator/templates/dawn_wire/WireCmd.cpp
+++ b/generator/templates/dawn_wire/WireCmd.cpp
@@ -51,12 +51,13 @@
     {%- if member.type.category == "object" -%}
         {%- set Optional = "Optional" if member.optional else "" -%}
         {{out}} = provider.Get{{Optional}}Id({{in}});
-    {%- elif member.type.category == "structure" -%}
-        {{as_cType(member.type.name)}}Serialize({{in}}, &{{out}}, buffer
-            {%- if member.type.has_dawn_object -%}
-                , provider
-            {%- endif -%}
-        );
+    {% elif member.type.category == "structure"%}
+        {%- set Provider = ", provider" if member.type.has_dawn_object else "" -%}
+        {% if member.annotation == "const*const*" %}
+            {{as_cType(member.type.name)}}Serialize(*{{in}}, &{{out}}, buffer{{Provider}});
+        {% else %}
+            {{as_cType(member.type.name)}}Serialize({{in}}, &{{out}}, buffer{{Provider}});
+        {% endif %}
     {%- else -%}
         {{out}} = {{in}};
     {%- endif -%}
@@ -126,7 +127,11 @@
                 //* Structures might contain more pointers so we need to add their extra size as well.
                 {% if member.type.category == "structure" %}
                     for (size_t i = 0; i < memberLength; ++i) {
-                        result += {{as_cType(member.type.name)}}GetExtraRequiredSize(record.{{as_varName(member.name)}}[i]);
+                        {% if member.annotation == "const*const*" %}
+                            result += {{as_cType(member.type.name)}}GetExtraRequiredSize(*record.{{as_varName(member.name)}}[i]);
+                        {% else %}
+                            result += {{as_cType(member.type.name)}}GetExtraRequiredSize(record.{{as_varName(member.name)}}[i]);
+                        {% endif %}
                     }
                 {% endif %}
             }
@@ -279,7 +284,16 @@
 
                 {{as_cType(member.type.name)}}* copiedMembers = nullptr;
                 DESERIALIZE_TRY(GetSpace(allocator, memberLength, &copiedMembers));
-                record->{{memberName}} = copiedMembers;
+                {% if member.annotation == "const*const*" %}
+                    {{as_cType(member.type.name)}}** pointerArray = nullptr;
+                    DESERIALIZE_TRY(GetSpace(allocator, memberLength, &pointerArray));
+                    for (size_t i = 0; i < memberLength; ++i) {
+                        pointerArray[i] = &copiedMembers[i];
+                    }
+                    record->{{memberName}} = pointerArray;
+                {% else %}
+                    record->{{memberName}} = copiedMembers;
+                {% endif %}
 
                 for (size_t i = 0; i < memberLength; ++i) {
                     {{deserialize_member(member, "memberBuffer[i]", "copiedMembers[i]")}}
diff --git a/src/dawn_native/RenderPipeline.cpp b/src/dawn_native/RenderPipeline.cpp
index fc25d37..8d2f5e9 100644
--- a/src/dawn_native/RenderPipeline.cpp
+++ b/src/dawn_native/RenderPipeline.cpp
@@ -61,7 +61,7 @@
             }
 
             for (uint32_t i = 0; i < descriptor->numColorAttachments; ++i) {
-                dawn::TextureFormat format = descriptor->colorAttachments[i].format;
+                dawn::TextureFormat format = descriptor->colorAttachments[i]->format;
                 DAWN_TRY(ValidateTextureFormat(format));
 
                 if (!IsColorRenderableTextureFormat(format)) {
@@ -190,7 +190,7 @@
         for (uint32_t i = 0; i < descriptor->attachmentsState->numColorAttachments; ++i) {
             mColorAttachmentsSet.set(i);
             mBlendStates[i] = descriptor->blendStates[i];
-            mColorAttachmentFormats[i] = descriptor->attachmentsState->colorAttachments[i].format;
+            mColorAttachmentFormats[i] = descriptor->attachmentsState->colorAttachments[i]->format;
         }
 
         // 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 7db8eda..6676042 100644
--- a/src/tests/end2end/BindGroupTests.cpp
+++ b/src/tests/end2end/BindGroupTests.cpp
@@ -130,8 +130,7 @@
     textureDescriptor.layout = pipelineLayout;
     textureDescriptor.cVertexStage.module = vsModule;
     textureDescriptor.cFragmentStage.module = fsModule;
-    textureDescriptor.cColorAttachments[0].format =
-        renderPass.colorFormat;
+    textureDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
 
@@ -216,8 +215,7 @@
     pipelineDescriptor.layout = pipelineLayout;
     pipelineDescriptor.cVertexStage.module = vsModule;
     pipelineDescriptor.cFragmentStage.module = fsModule;
-    pipelineDescriptor.cColorAttachments[0].format =
-        renderPass.colorFormat;
+    pipelineDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
 
@@ -339,7 +337,7 @@
     textureDescriptor.layout = pipelineLayout;
     textureDescriptor.cVertexStage.module = vsModule;
     textureDescriptor.cFragmentStage.module = fsModule;
-    textureDescriptor.cColorAttachments[0].format = renderPass.colorFormat;
+    textureDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
 
@@ -433,7 +431,7 @@
     pipelineDescriptor.layout = pipelineLayout;
     pipelineDescriptor.cVertexStage.module = vsModule;
     pipelineDescriptor.cFragmentStage.module = fsModule;
-    pipelineDescriptor.cColorAttachments[0].format = renderPass.colorFormat;
+    pipelineDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
     dawn::CommandBufferBuilder builder = device.CreateCommandBufferBuilder();
diff --git a/src/tests/end2end/BlendStateTests.cpp b/src/tests/end2end/BlendStateTests.cpp
index c2ff4ff..510b9d0 100644
--- a/src/tests/end2end/BlendStateTests.cpp
+++ b/src/tests/end2end/BlendStateTests.cpp
@@ -71,8 +71,7 @@
             baseDescriptor.layout = pipelineLayout;
             baseDescriptor.cVertexStage.module = vsModule;
             baseDescriptor.cFragmentStage.module = fsModule;
-            baseDescriptor.cColorAttachments[0].format =
-                renderPass.colorFormat;
+            baseDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
             basePipeline = device.CreateRenderPipeline(&baseDescriptor);
 
@@ -80,8 +79,7 @@
             testDescriptor.layout = pipelineLayout;
             testDescriptor.cVertexStage.module = vsModule;
             testDescriptor.cFragmentStage.module = fsModule;
-            testDescriptor.cColorAttachments[0].format =
-                renderPass.colorFormat;
+            testDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
             testDescriptor.cBlendStates[0] = blendStateDescriptor;
 
             testPipeline = device.CreateRenderPipeline(&testDescriptor);
@@ -867,8 +865,7 @@
     baseDescriptor.layout = pipelineLayout;
     baseDescriptor.cVertexStage.module = vsModule;
     baseDescriptor.cFragmentStage.module = fsModule;
-    baseDescriptor.cColorAttachments[0].format =
-        renderPass.colorFormat;
+    baseDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
     basePipeline = device.CreateRenderPipeline(&baseDescriptor);
 
@@ -876,8 +873,7 @@
     testDescriptor.layout = pipelineLayout;
     testDescriptor.cVertexStage.module = vsModule;
     testDescriptor.cFragmentStage.module = fsModule;
-    testDescriptor.cColorAttachments[0].format =
-        renderPass.colorFormat;
+    testDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
     dawn::BlendDescriptor blend;
     blend.operation = dawn::BlendOperation::Add;
diff --git a/src/tests/end2end/DrawIndexedTests.cpp b/src/tests/end2end/DrawIndexedTests.cpp
index e6c969d..4d0701c 100644
--- a/src/tests/end2end/DrawIndexedTests.cpp
+++ b/src/tests/end2end/DrawIndexedTests.cpp
@@ -53,8 +53,7 @@
             descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
             descriptor.indexFormat = dawn::IndexFormat::Uint32;
             descriptor.inputState = inputState;
-            descriptor.cColorAttachments[0].format =
-                renderPass.colorFormat;
+            descriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
             pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp
index de1b980..4191862 100644
--- a/src/tests/end2end/IndexFormatTests.cpp
+++ b/src/tests/end2end/IndexFormatTests.cpp
@@ -58,8 +58,7 @@
             descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
             descriptor.indexFormat = format;
             descriptor.inputState = inputState;
-            descriptor.cColorAttachments[0].format =
-                renderPass.colorFormat;
+            descriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
             return device.CreateRenderPipeline(&descriptor);
         }
diff --git a/src/tests/end2end/InputStateTests.cpp b/src/tests/end2end/InputStateTests.cpp
index 922702d..180d8a8 100644
--- a/src/tests/end2end/InputStateTests.cpp
+++ b/src/tests/end2end/InputStateTests.cpp
@@ -125,8 +125,7 @@
             descriptor.cVertexStage.module = vsModule;
             descriptor.cFragmentStage.module = fsModule;
             descriptor.inputState = inputState;
-            descriptor.cColorAttachments[0].format =
-                renderPass.colorFormat;
+            descriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
             return device.CreateRenderPipeline(&descriptor);
         }
diff --git a/src/tests/end2end/PrimitiveTopologyTests.cpp b/src/tests/end2end/PrimitiveTopologyTests.cpp
index 85a5eec..465f502 100644
--- a/src/tests/end2end/PrimitiveTopologyTests.cpp
+++ b/src/tests/end2end/PrimitiveTopologyTests.cpp
@@ -192,8 +192,7 @@
             descriptor.cFragmentStage.module = fsModule;
             descriptor.primitiveTopology = primitiveTopology;
             descriptor.inputState = inputState;
-            descriptor.cColorAttachments[0].format =
-                renderPass.colorFormat;
+            descriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
             dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp
index cf98477..550dde7 100644
--- a/src/tests/end2end/SamplerTests.cpp
+++ b/src/tests/end2end/SamplerTests.cpp
@@ -77,8 +77,7 @@
         pipelineDescriptor.layout = pipelineLayout;
         pipelineDescriptor.cVertexStage.module = vsModule;
         pipelineDescriptor.cFragmentStage.module = fsModule;
-        pipelineDescriptor.cColorAttachments[0].format =
-            mRenderPass.colorFormat;
+        pipelineDescriptor.cColorAttachments[0]->format = mRenderPass.colorFormat;
 
         mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
 
diff --git a/src/tests/end2end/ScissorTests.cpp b/src/tests/end2end/ScissorTests.cpp
index e24392d..010c56b 100644
--- a/src/tests/end2end/ScissorTests.cpp
+++ b/src/tests/end2end/ScissorTests.cpp
@@ -40,8 +40,7 @@
         utils::ComboRenderPipelineDescriptor descriptor(device);
         descriptor.cVertexStage.module = vsModule;
         descriptor.cFragmentStage.module = fsModule;
-        descriptor.cColorAttachments[0].format =
-            format;
+        descriptor.cColorAttachments[0]->format = format;
 
         return device.CreateRenderPipeline(&descriptor);
     }
diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp
index ffb9d72..072f5a3 100644
--- a/src/tests/end2end/TextureViewTests.cpp
+++ b/src/tests/end2end/TextureViewTests.cpp
@@ -172,8 +172,7 @@
         textureDescriptor.cVertexStage.module = mVSModule;
         textureDescriptor.cFragmentStage.module = fsModule;
         textureDescriptor.layout = mPipelineLayout;
-        textureDescriptor.cColorAttachments[0].format =
-            mRenderPass.colorFormat;
+        textureDescriptor.cColorAttachments[0]->format = mRenderPass.colorFormat;
 
         dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
 
@@ -517,7 +516,7 @@
         utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
         pipelineDescriptor.cVertexStage.module = vsModule;
         pipelineDescriptor.cFragmentStage.module = oneColorFsModule;
-        pipelineDescriptor.cColorAttachments[0].format = kDefaultFormat;
+        pipelineDescriptor.cColorAttachments[0]->format = kDefaultFormat;
 
         dawn::RenderPipeline oneColorPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
 
diff --git a/src/tests/end2end/ViewportOrientationTests.cpp b/src/tests/end2end/ViewportOrientationTests.cpp
index ca6e8e2..cec9224 100644
--- a/src/tests/end2end/ViewportOrientationTests.cpp
+++ b/src/tests/end2end/ViewportOrientationTests.cpp
@@ -40,8 +40,7 @@
     descriptor.cVertexStage.module = vsModule;
     descriptor.cFragmentStage.module = fsModule;
     descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
-    descriptor.cColorAttachments[0].format =
-        renderPass.colorFormat;
+    descriptor.cColorAttachments[0]->format = renderPass.colorFormat;
 
     dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
 
diff --git a/src/tests/unittests/WireTests.cpp b/src/tests/unittests/WireTests.cpp
index 51baef2..48db4e6 100644
--- a/src/tests/unittests/WireTests.cpp
+++ b/src/tests/unittests/WireTests.cpp
@@ -404,7 +404,8 @@
     attachmentsState.nextInChain = nullptr;
     attachmentsState.numColorAttachments = 1;
     dawnAttachmentDescriptor colorAttachment = {nullptr, DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM};
-    attachmentsState.colorAttachments = &colorAttachment;
+    dawnAttachmentDescriptor* colorAttachmentPtr[] = {&colorAttachment};
+    attachmentsState.colorAttachments = colorAttachmentPtr;
     attachmentsState.hasDepthStencilAttachment = false;
     // Even with hasDepthStencilAttachment = false, depthStencilAttachment must point to valid
     // data because we don't have optional substructures yet.
diff --git a/src/tests/unittests/validation/InputStateValidationTests.cpp b/src/tests/unittests/validation/InputStateValidationTests.cpp
index 97ac1b8..eb62128 100644
--- a/src/tests/unittests/validation/InputStateValidationTests.cpp
+++ b/src/tests/unittests/validation/InputStateValidationTests.cpp
@@ -35,8 +35,7 @@
             descriptor.cVertexStage.module = vsModule;
             descriptor.cFragmentStage.module = fsModule;
             descriptor.inputState = inputState;
-            descriptor.cColorAttachments[0].format =
-                renderpassData.attachmentFormat;
+            descriptor.cColorAttachments[0]->format = renderpassData.attachmentFormat;
 
             if (!success) {
                 ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
diff --git a/src/utils/ComboRenderPipelineDescriptor.cpp b/src/utils/ComboRenderPipelineDescriptor.cpp
index edbe01f..8a07da1 100644
--- a/src/utils/ComboRenderPipelineDescriptor.cpp
+++ b/src/utils/ComboRenderPipelineDescriptor.cpp
@@ -46,7 +46,8 @@
             cAttachmentsState.hasDepthStencilAttachment = false;
 
             for (uint32_t i = 0; i < kMaxColorAttachments; ++i) {
-                cColorAttachments[i].format = dawn::TextureFormat::R8G8B8A8Unorm;
+                colorAttachments[i].format = dawn::TextureFormat::R8G8B8A8Unorm;
+                cColorAttachments[i] = &colorAttachments[i];
             }
         }
 
diff --git a/src/utils/ComboRenderPipelineDescriptor.h b/src/utils/ComboRenderPipelineDescriptor.h
index 8acbdb5..5bd104f 100644
--- a/src/utils/ComboRenderPipelineDescriptor.h
+++ b/src/utils/ComboRenderPipelineDescriptor.h
@@ -31,10 +31,13 @@
         dawn::PipelineStageDescriptor cFragmentStage;

 

         dawn::AttachmentsStateDescriptor cAttachmentsState;

-        std::array<dawn::AttachmentDescriptor, kMaxColorAttachments> cColorAttachments;

+        std::array<dawn::AttachmentDescriptor*, kMaxColorAttachments> cColorAttachments;

         dawn::AttachmentDescriptor cDepthStencilAttachment;

         std::array<dawn::BlendStateDescriptor, kMaxColorAttachments> cBlendStates;

         dawn::DepthStencilStateDescriptor cDepthStencilState;

+

+      private:

+        dawn::AttachmentDescriptor colorAttachments[kMaxColorAttachments];

     };

 

 }  // namespace utils