From 938811eef933dfacb16a464968f6dda038750705 Mon Sep 17 00:00:00 2001 From: Yunchao He Date: Wed, 20 Feb 2019 13:00:36 +0000 Subject: [PATCH] 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 Commit-Queue: Yunchao He --- dawn.json | 2 +- examples/Animometer.cpp | 2 +- examples/CHelloTriangle.cpp | 7 +++-- examples/ComputeBoids.cpp | 2 +- examples/CppHelloTriangle.cpp | 2 +- examples/CubeReflection.cpp | 6 ++-- examples/glTFViewer/glTFViewer.cpp | 2 +- src/dawn_native/RenderPipeline.cpp | 4 +-- src/tests/end2end/BindGroupTests.cpp | 8 +++--- src/tests/end2end/ColorStateTests.cpp | 28 +++++++++---------- src/tests/end2end/DrawIndexedTests.cpp | 2 +- src/tests/end2end/DrawTests.cpp | 2 +- src/tests/end2end/IndexFormatTests.cpp | 2 +- src/tests/end2end/InputStateTests.cpp | 2 +- src/tests/end2end/PrimitiveTopologyTests.cpp | 2 +- src/tests/end2end/PushConstantTests.cpp | 4 +-- src/tests/end2end/RenderPassTests.cpp | 2 +- src/tests/end2end/SamplerTests.cpp | 2 +- src/tests/end2end/ScissorTests.cpp | 2 +- src/tests/end2end/TextureViewTests.cpp | 4 +-- .../end2end/ViewportOrientationTests.cpp | 2 +- .../validation/InputStateValidationTests.cpp | 2 +- .../unittests/wire/WireArgumentTests.cpp | 3 +- .../unittests/wire/WireOptionalTests.cpp | 3 +- src/utils/ComboRenderPipelineDescriptor.cpp | 3 +- src/utils/ComboRenderPipelineDescriptor.h | 3 +- 26 files changed, 54 insertions(+), 49 deletions(-) diff --git a/dawn.json b/dawn.json index 4267240b97..b97fcc2dd3 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 5d2e281e8c..e992643cb2 100644 --- a/examples/Animometer.cpp +++ b/examples/Animometer.cpp @@ -115,7 +115,7 @@ void init() { 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 5dd38b7224..302db61bdf 100644 --- a/examples/CHelloTriangle.cpp +++ b/examples/CHelloTriangle.cpp @@ -72,8 +72,6 @@ void init() { descriptor.sampleCount = 1; - descriptor.numColorStates = 1; - dawnBlendDescriptor blendDescriptor; blendDescriptor.operation = DAWN_BLEND_OPERATION_ADD; blendDescriptor.srcFactor = DAWN_BLEND_FACTOR_ONE; @@ -84,7 +82,10 @@ void init() { 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 8e2dd0c270..d6d0e78206 100644 --- a/examples/ComputeBoids.cpp +++ b/examples/ComputeBoids.cpp @@ -158,7 +158,7 @@ void initRender() { 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 8f837d18b3..e4f4bc1ce9 100644 --- a/examples/CppHelloTriangle.cpp +++ b/examples/CppHelloTriangle.cpp @@ -142,7 +142,7 @@ void init() { 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 833c40be40..728fbf0688 100644 --- a/examples/CubeReflection.cpp +++ b/examples/CubeReflection.cpp @@ -217,7 +217,7 @@ void init() { 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 @@ void init() { 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 @@ void init() { 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 d0ec8632c3..127c324f2c 100644 --- a/examples/glTFViewer/glTFViewer.cpp +++ b/examples/glTFViewer/glTFViewer.cpp @@ -321,7 +321,7 @@ namespace { 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 ac544a6b45..f954159eaa 100644 --- a/src/dawn_native/RenderPipeline.cpp +++ b/src/dawn_native/RenderPipeline.cpp @@ -131,7 +131,7 @@ namespace dawn_native { } 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 @@ namespace dawn_native { 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 b0a60ade06..cc5e78c8f9 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp @@ -130,7 +130,7 @@ TEST_P(BindGroupTests, ReusedUBO) { 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 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { 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 @@ TEST_P(BindGroupTests, MultipleBindLayouts) { 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 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets) 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 ea099f4c61..33a72748ec 100644 --- a/src/tests/end2end/ColorStateTests.cpp +++ b/src/tests/end2end/ColorStateTests.cpp @@ -54,7 +54,7 @@ class ColorStateTest : public DawnTest { // 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 @@ class ColorStateTest : public DawnTest { 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 @@ class ColorStateTest : public DawnTest { 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 @@ TEST_P(ColorStateTest, IndependentColorState) { 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 @@ TEST_P(ColorStateTest, DefaultBlendColor) { 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 @@ TEST_P(ColorStateTest, DefaultBlendColor) { 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 3148516fcc..9324226288 100644 --- a/src/tests/end2end/DrawIndexedTests.cpp +++ b/src/tests/end2end/DrawIndexedTests.cpp @@ -64,7 +64,7 @@ class DrawIndexedTest : public DawnTest { 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 b7eed7a0d1..48a83113c3 100644 --- a/src/tests/end2end/DrawTests.cpp +++ b/src/tests/end2end/DrawTests.cpp @@ -62,7 +62,7 @@ class DrawTest : public DawnTest { 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 b9401791e6..6b26a1ea7c 100644 --- a/src/tests/end2end/IndexFormatTests.cpp +++ b/src/tests/end2end/IndexFormatTests.cpp @@ -69,7 +69,7 @@ class IndexFormatTest : public DawnTest { 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 9e365c3689..d2367a4d37 100644 --- a/src/tests/end2end/InputStateTests.cpp +++ b/src/tests/end2end/InputStateTests.cpp @@ -125,7 +125,7 @@ class InputStateTest : public DawnTest { 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 791c8b3b93..bff56447a7 100644 --- a/src/tests/end2end/PrimitiveTopologyTests.cpp +++ b/src/tests/end2end/PrimitiveTopologyTests.cpp @@ -203,7 +203,7 @@ class PrimitiveTopologyTest : public DawnTest { 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 e8cf5eba81..a9e4842b18 100644 --- a/src/tests/end2end/PushConstantTests.cpp +++ b/src/tests/end2end/PushConstantTests.cpp @@ -195,8 +195,8 @@ class PushConstantTest: public DawnTest { 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 94c4abb280..51c0b0f4d6 100644 --- a/src/tests/end2end/RenderPassTests.cpp +++ b/src/tests/end2end/RenderPassTests.cpp @@ -48,7 +48,7 @@ protected: 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 9f2f567c9f..0bb6fe28e6 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -77,7 +77,7 @@ protected: 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 95c61ada5c..65f80ed01a 100644 --- a/src/tests/end2end/ScissorTests.cpp +++ b/src/tests/end2end/ScissorTests.cpp @@ -40,7 +40,7 @@ class ScissorTest: public DawnTest { 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 5c00f114fe..2fc8d782d1 100644 --- a/src/tests/end2end/TextureViewTests.cpp +++ b/src/tests/end2end/TextureViewTests.cpp @@ -172,7 +172,7 @@ protected: 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 @@ class TextureViewRenderingTest : public DawnTest { 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 074997eba7..ee4905829a 100644 --- a/src/tests/end2end/ViewportOrientationTests.cpp +++ b/src/tests/end2end/ViewportOrientationTests.cpp @@ -40,7 +40,7 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) { 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 d5d1d70d26..724a06169a 100644 --- a/src/tests/unittests/validation/InputStateValidationTests.cpp +++ b/src/tests/unittests/validation/InputStateValidationTests.cpp @@ -39,7 +39,7 @@ class InputStateTest : public ValidationTest { 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 4108df006f..d1fdbf0a37 100644 --- a/src/tests/unittests/wire/WireArgumentTests.cpp +++ b/src/tests/unittests/wire/WireArgumentTests.cpp @@ -154,7 +154,8 @@ TEST_F(WireArgumentTests, CStringArgument) { 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 71cf5de3c8..73803ce660 100644 --- a/src/tests/unittests/wire/WireOptionalTests.cpp +++ b/src/tests/unittests/wire/WireOptionalTests.cpp @@ -139,7 +139,8 @@ TEST_F(WireOptionalTests, OptionalStructPointer) { 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 9aff3f2b72..165d45b840 100644 --- a/src/utils/ComboRenderPipelineDescriptor.cpp +++ b/src/utils/ComboRenderPipelineDescriptor.cpp @@ -52,7 +52,8 @@ namespace utils { 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 2318b4d316..d5e50e99c7 100644 --- a/src/utils/ComboRenderPipelineDescriptor.h +++ b/src/utils/ComboRenderPipelineDescriptor.h @@ -30,10 +30,11 @@ namespace utils { dawn::PipelineStageDescriptor cVertexStage; dawn::PipelineStageDescriptor cFragmentStage; - std::array cColorStates; + std::array cColorStates; dawn::DepthStencilStateDescriptor cDepthStencilState; private: + dawn::ColorStateDescriptor mColorStates[kMaxColorAttachments]; }; } // namespace utils