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>
This commit is contained in:
Yunchao He 2019-02-20 13:00:36 +00:00 committed by Commit Bot service account
parent f20f5b9493
commit 938811eef9
26 changed files with 54 additions and 49 deletions

View File

@ -863,7 +863,7 @@
{"name": "sample count", "type": "uint32_t"}, {"name": "sample count", "type": "uint32_t"},
{"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true}, {"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true},
{"name": "num color states", "type": "uint32_t"}, {"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": { "sampler": {

View File

@ -115,7 +115,7 @@ void init() {
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;
descriptor.depthStencilState = &descriptor.cDepthStencilState; descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint; descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
pipeline = device.CreateRenderPipeline(&descriptor); pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -72,8 +72,6 @@ void init() {
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.numColorStates = 1;
dawnBlendDescriptor blendDescriptor; dawnBlendDescriptor blendDescriptor;
blendDescriptor.operation = DAWN_BLEND_OPERATION_ADD; blendDescriptor.operation = DAWN_BLEND_OPERATION_ADD;
blendDescriptor.srcFactor = DAWN_BLEND_FACTOR_ONE; blendDescriptor.srcFactor = DAWN_BLEND_FACTOR_ONE;
@ -84,7 +82,10 @@ void init() {
colorStateDescriptor.alphaBlend = blendDescriptor; colorStateDescriptor.alphaBlend = blendDescriptor;
colorStateDescriptor.colorBlend = blendDescriptor; colorStateDescriptor.colorBlend = blendDescriptor;
colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL; colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
descriptor.colorStates = &colorStateDescriptor;
descriptor.numColorStates = 1;
dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
descriptor.colorStates = colorStatesPtr;
dawnPipelineLayoutDescriptor pl; dawnPipelineLayoutDescriptor pl;
pl.nextInChain = nullptr; pl.nextInChain = nullptr;

View File

@ -158,7 +158,7 @@ void initRender() {
descriptor.inputState = inputState; descriptor.inputState = inputState;
descriptor.depthStencilState = &descriptor.cDepthStencilState; descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint; descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
renderPipeline = device.CreateRenderPipeline(&descriptor); renderPipeline = device.CreateRenderPipeline(&descriptor);
} }

View File

@ -142,7 +142,7 @@ void init() {
descriptor.inputState = inputState; descriptor.inputState = inputState;
descriptor.depthStencilState = &descriptor.cDepthStencilState; descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint; descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
pipeline = device.CreateRenderPipeline(&descriptor); pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -217,7 +217,7 @@ void init() {
descriptor.inputState = inputState; descriptor.inputState = inputState;
descriptor.depthStencilState = &descriptor.cDepthStencilState; descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint; descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
descriptor.cDepthStencilState.depthWriteEnabled = true; descriptor.cDepthStencilState.depthWriteEnabled = true;
descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less; descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
@ -230,7 +230,7 @@ void init() {
pDescriptor.inputState = inputState; pDescriptor.inputState = inputState;
pDescriptor.depthStencilState = &pDescriptor.cDepthStencilState; pDescriptor.depthStencilState = &pDescriptor.cDepthStencilState;
pDescriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint; 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.stencilFront.passOp = dawn::StencilOperation::Replace;
pDescriptor.cDepthStencilState.stencilBack.passOp = dawn::StencilOperation::Replace; pDescriptor.cDepthStencilState.stencilBack.passOp = dawn::StencilOperation::Replace;
pDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less; pDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
@ -244,7 +244,7 @@ void init() {
rfDescriptor.inputState = inputState; rfDescriptor.inputState = inputState;
rfDescriptor.depthStencilState = &rfDescriptor.cDepthStencilState; rfDescriptor.depthStencilState = &rfDescriptor.cDepthStencilState;
rfDescriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint; 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.stencilFront.compare = dawn::CompareFunction::Equal;
rfDescriptor.cDepthStencilState.stencilBack.compare = dawn::CompareFunction::Equal; rfDescriptor.cDepthStencilState.stencilBack.compare = dawn::CompareFunction::Equal;
rfDescriptor.cDepthStencilState.stencilFront.passOp = dawn::StencilOperation::Replace; rfDescriptor.cDepthStencilState.stencilFront.passOp = dawn::StencilOperation::Replace;

View File

@ -321,7 +321,7 @@ namespace {
descriptor.indexFormat = dawn::IndexFormat::Uint16; descriptor.indexFormat = dawn::IndexFormat::Uint16;
descriptor.depthStencilState = &descriptor.cDepthStencilState; descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint; descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
descriptor.cDepthStencilState.depthWriteEnabled = true; descriptor.cDepthStencilState.depthWriteEnabled = true;
descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less; descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;

View File

@ -131,7 +131,7 @@ namespace dawn_native {
} }
for (uint32_t i = 0; i < descriptor->numColorStates; ++i) { for (uint32_t i = 0; i < descriptor->numColorStates; ++i) {
DAWN_TRY(ValidateColorStateDescriptor(&descriptor->colorStates[i])); DAWN_TRY(ValidateColorStateDescriptor(descriptor->colorStates[i]));
} }
if (descriptor->depthStencilState) { if (descriptor->depthStencilState) {
@ -197,7 +197,7 @@ namespace dawn_native {
for (uint32_t i = 0; i < descriptor->numColorStates; ++i) { for (uint32_t i = 0; i < descriptor->numColorStates; ++i) {
mColorAttachmentsSet.set(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 // TODO(cwallez@chromium.org): Check against the shader module that the correct color

View File

@ -130,7 +130,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
textureDescriptor.layout = pipelineLayout; textureDescriptor.layout = pipelineLayout;
textureDescriptor.cVertexStage.module = vsModule; textureDescriptor.cVertexStage.module = vsModule;
textureDescriptor.cFragmentStage.module = fsModule; textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.cColorStates[0].format = renderPass.colorFormat; textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor); dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
@ -215,7 +215,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
pipelineDescriptor.layout = pipelineLayout; pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.cVertexStage.module = vsModule; pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule; pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat; pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor); dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
@ -337,7 +337,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
textureDescriptor.layout = pipelineLayout; textureDescriptor.layout = pipelineLayout;
textureDescriptor.cVertexStage.module = vsModule; textureDescriptor.cVertexStage.module = vsModule;
textureDescriptor.cFragmentStage.module = fsModule; textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.cColorStates[0].format = renderPass.colorFormat; textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor); dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
@ -431,7 +431,7 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
pipelineDescriptor.layout = pipelineLayout; pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.cVertexStage.module = vsModule; pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule; pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat; pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor); dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
dawn::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::CommandEncoder encoder = device.CreateCommandEncoder();

View File

@ -54,7 +54,7 @@ class ColorStateTest : public DawnTest {
// Set up basePipeline and testPipeline. testPipeline has the given blend state on the first // Set up basePipeline and testPipeline. testPipeline has the given blend state on the first
// attachment. basePipeline has no blending // attachment. basePipeline has no blending
void SetupSingleSourcePipelines(const dawn::ColorStateDescriptor& colorStateDescriptor) { void SetupSingleSourcePipelines(dawn::ColorStateDescriptor colorStateDescriptor) {
dawn::ShaderModule fsModule = dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"(
#version 450 #version 450
@ -73,7 +73,7 @@ class ColorStateTest : public DawnTest {
baseDescriptor.layout = pipelineLayout; baseDescriptor.layout = pipelineLayout;
baseDescriptor.cVertexStage.module = vsModule; baseDescriptor.cVertexStage.module = vsModule;
baseDescriptor.cFragmentStage.module = fsModule; baseDescriptor.cFragmentStage.module = fsModule;
baseDescriptor.cColorStates[0].format = renderPass.colorFormat; baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
basePipeline = device.CreateRenderPipeline(&baseDescriptor); basePipeline = device.CreateRenderPipeline(&baseDescriptor);
@ -81,8 +81,8 @@ class ColorStateTest : public DawnTest {
testDescriptor.layout = pipelineLayout; testDescriptor.layout = pipelineLayout;
testDescriptor.cVertexStage.module = vsModule; testDescriptor.cVertexStage.module = vsModule;
testDescriptor.cFragmentStage.module = fsModule; testDescriptor.cFragmentStage.module = fsModule;
testDescriptor.cColorStates[0] = colorStateDescriptor; testDescriptor.cColorStates[0] = &colorStateDescriptor;
testDescriptor.cColorStates[0].format = renderPass.colorFormat; testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
testPipeline = device.CreateRenderPipeline(&testDescriptor); testPipeline = device.CreateRenderPipeline(&testDescriptor);
} }
@ -834,14 +834,14 @@ TEST_P(ColorStateTest, IndependentColorState) {
blend3.srcFactor = dawn::BlendFactor::One; blend3.srcFactor = dawn::BlendFactor::One;
blend3.dstFactor = dawn::BlendFactor::One; blend3.dstFactor = dawn::BlendFactor::One;
testDescriptor.cColorStates[0].colorBlend = blend1; testDescriptor.cColorStates[0]->colorBlend = blend1;
testDescriptor.cColorStates[0].alphaBlend = blend1; testDescriptor.cColorStates[0]->alphaBlend = blend1;
testDescriptor.cColorStates[1].colorBlend = blend2; testDescriptor.cColorStates[1]->colorBlend = blend2;
testDescriptor.cColorStates[1].alphaBlend = blend2; testDescriptor.cColorStates[1]->alphaBlend = blend2;
testDescriptor.cColorStates[3].colorBlend = blend3; testDescriptor.cColorStates[3]->colorBlend = blend3;
testDescriptor.cColorStates[3].alphaBlend = blend3; testDescriptor.cColorStates[3]->alphaBlend = blend3;
testPipeline = device.CreateRenderPipeline(&testDescriptor); testPipeline = device.CreateRenderPipeline(&testDescriptor);
@ -909,7 +909,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
baseDescriptor.layout = pipelineLayout; baseDescriptor.layout = pipelineLayout;
baseDescriptor.cVertexStage.module = vsModule; baseDescriptor.cVertexStage.module = vsModule;
baseDescriptor.cFragmentStage.module = fsModule; baseDescriptor.cFragmentStage.module = fsModule;
baseDescriptor.cColorStates[0].format = renderPass.colorFormat; baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
basePipeline = device.CreateRenderPipeline(&baseDescriptor); basePipeline = device.CreateRenderPipeline(&baseDescriptor);
@ -917,14 +917,14 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
testDescriptor.layout = pipelineLayout; testDescriptor.layout = pipelineLayout;
testDescriptor.cVertexStage.module = vsModule; testDescriptor.cVertexStage.module = vsModule;
testDescriptor.cFragmentStage.module = fsModule; testDescriptor.cFragmentStage.module = fsModule;
testDescriptor.cColorStates[0].format = renderPass.colorFormat; testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
dawn::BlendDescriptor blend; dawn::BlendDescriptor blend;
blend.operation = dawn::BlendOperation::Add; blend.operation = dawn::BlendOperation::Add;
blend.srcFactor = dawn::BlendFactor::BlendColor; blend.srcFactor = dawn::BlendFactor::BlendColor;
blend.dstFactor = dawn::BlendFactor::One; blend.dstFactor = dawn::BlendFactor::One;
testDescriptor.cColorStates[0].colorBlend = blend; testDescriptor.cColorStates[0]->colorBlend = blend;
testDescriptor.cColorStates[0].alphaBlend = blend; testDescriptor.cColorStates[0]->alphaBlend = blend;
testPipeline = device.CreateRenderPipeline(&testDescriptor); testPipeline = device.CreateRenderPipeline(&testDescriptor);
constexpr dawn::Color kWhite{1.0f, 1.0f, 1.0f, 1.0f}; constexpr dawn::Color kWhite{1.0f, 1.0f, 1.0f, 1.0f};

View File

@ -64,7 +64,7 @@ class DrawIndexedTest : public DawnTest {
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip; descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.indexFormat = dawn::IndexFormat::Uint32; descriptor.indexFormat = dawn::IndexFormat::Uint32;
descriptor.inputState = inputState; descriptor.inputState = inputState;
descriptor.cColorStates[0].format = renderPass.colorFormat; descriptor.cColorStates[0]->format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor); pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -62,7 +62,7 @@ class DrawTest : public DawnTest {
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip; descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.indexFormat = dawn::IndexFormat::Uint32; descriptor.indexFormat = dawn::IndexFormat::Uint32;
descriptor.inputState = inputState; descriptor.inputState = inputState;
descriptor.cColorStates[0].format = renderPass.colorFormat; descriptor.cColorStates[0]->format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor); pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -69,7 +69,7 @@ class IndexFormatTest : public DawnTest {
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip; descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.indexFormat = format; descriptor.indexFormat = format;
descriptor.inputState = inputState; descriptor.inputState = inputState;
descriptor.cColorStates[0].format = renderPass.colorFormat; descriptor.cColorStates[0]->format = renderPass.colorFormat;
return device.CreateRenderPipeline(&descriptor); return device.CreateRenderPipeline(&descriptor);
} }

View File

@ -125,7 +125,7 @@ class InputStateTest : public DawnTest {
descriptor.cVertexStage.module = vsModule; descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;
descriptor.inputState = inputState; descriptor.inputState = inputState;
descriptor.cColorStates[0].format = renderPass.colorFormat; descriptor.cColorStates[0]->format = renderPass.colorFormat;
return device.CreateRenderPipeline(&descriptor); return device.CreateRenderPipeline(&descriptor);
} }

View File

@ -203,7 +203,7 @@ class PrimitiveTopologyTest : public DawnTest {
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = primitiveTopology; descriptor.primitiveTopology = primitiveTopology;
descriptor.inputState = inputState; descriptor.inputState = inputState;
descriptor.cColorStates[0].format = renderPass.colorFormat; descriptor.cColorStates[0]->format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -195,8 +195,8 @@ class PushConstantTest: public DawnTest {
blend.operation = dawn::BlendOperation::Add; blend.operation = dawn::BlendOperation::Add;
blend.srcFactor = dawn::BlendFactor::One; blend.srcFactor = dawn::BlendFactor::One;
blend.dstFactor = dawn::BlendFactor::One; blend.dstFactor = dawn::BlendFactor::One;
descriptor.cColorStates[0].alphaBlend = blend; descriptor.cColorStates[0]->alphaBlend = blend;
descriptor.cColorStates[0].colorBlend = blend; descriptor.cColorStates[0]->colorBlend = blend;
return device.CreateRenderPipeline(&descriptor); return device.CreateRenderPipeline(&descriptor);
} }

View File

@ -48,7 +48,7 @@ protected:
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip; descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.indexFormat = dawn::IndexFormat::Uint32; descriptor.indexFormat = dawn::IndexFormat::Uint32;
descriptor.cColorStates[0].format = kFormat; descriptor.cColorStates[0]->format = kFormat;
pipeline = device.CreateRenderPipeline(&descriptor); pipeline = device.CreateRenderPipeline(&descriptor);
} }

View File

@ -77,7 +77,7 @@ protected:
pipelineDescriptor.layout = pipelineLayout; pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.cVertexStage.module = vsModule; pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule; pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0].format = mRenderPass.colorFormat; pipelineDescriptor.cColorStates[0]->format = mRenderPass.colorFormat;
mPipeline = device.CreateRenderPipeline(&pipelineDescriptor); mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);

View File

@ -40,7 +40,7 @@ class ScissorTest: public DawnTest {
utils::ComboRenderPipelineDescriptor descriptor(device); utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule; descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;
descriptor.cColorStates[0].format = format; descriptor.cColorStates[0]->format = format;
return device.CreateRenderPipeline(&descriptor); return device.CreateRenderPipeline(&descriptor);
} }

View File

@ -172,7 +172,7 @@ protected:
textureDescriptor.cVertexStage.module = mVSModule; textureDescriptor.cVertexStage.module = mVSModule;
textureDescriptor.cFragmentStage.module = fsModule; textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.layout = mPipelineLayout; textureDescriptor.layout = mPipelineLayout;
textureDescriptor.cColorStates[0].format = mRenderPass.colorFormat; textureDescriptor.cColorStates[0]->format = mRenderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor); dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
@ -516,7 +516,7 @@ class TextureViewRenderingTest : public DawnTest {
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device); utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.cVertexStage.module = vsModule; pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = oneColorFsModule; pipelineDescriptor.cFragmentStage.module = oneColorFsModule;
pipelineDescriptor.cColorStates[0].format = kDefaultFormat; pipelineDescriptor.cColorStates[0]->format = kDefaultFormat;
dawn::RenderPipeline oneColorPipeline = device.CreateRenderPipeline(&pipelineDescriptor); dawn::RenderPipeline oneColorPipeline = device.CreateRenderPipeline(&pipelineDescriptor);

View File

@ -40,7 +40,7 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
descriptor.cVertexStage.module = vsModule; descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList; descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
descriptor.cColorStates[0].format = renderPass.colorFormat; descriptor.cColorStates[0]->format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -39,7 +39,7 @@ class InputStateTest : public ValidationTest {
descriptor.cVertexStage.module = vsModule; descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;
descriptor.inputState = inputState; descriptor.inputState = inputState;
descriptor.cColorStates[0].format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.cColorStates[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
if (!success) { if (!success) {
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor)); ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));

View File

@ -154,7 +154,8 @@ TEST_F(WireArgumentTests, CStringArgument) {
pipelineDescriptor.fragmentStage = &fragmentStage; pipelineDescriptor.fragmentStage = &fragmentStage;
pipelineDescriptor.numColorStates = 1; pipelineDescriptor.numColorStates = 1;
pipelineDescriptor.colorStates = &colorStateDescriptor; dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
pipelineDescriptor.colorStates = colorStatesPtr;
pipelineDescriptor.sampleCount = 1; pipelineDescriptor.sampleCount = 1;
pipelineDescriptor.layout = layout; pipelineDescriptor.layout = layout;

View File

@ -139,7 +139,8 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
pipelineDescriptor.fragmentStage = &fragmentStage; pipelineDescriptor.fragmentStage = &fragmentStage;
pipelineDescriptor.numColorStates = 1; pipelineDescriptor.numColorStates = 1;
pipelineDescriptor.colorStates = &colorStateDescriptor; dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
pipelineDescriptor.colorStates = colorStatesPtr;
pipelineDescriptor.sampleCount = 1; pipelineDescriptor.sampleCount = 1;
pipelineDescriptor.layout = layout; pipelineDescriptor.layout = layout;

View File

@ -52,7 +52,8 @@ namespace utils {
colorStateDescriptor.colorBlend = blend; colorStateDescriptor.colorBlend = blend;
colorStateDescriptor.colorWriteMask = dawn::ColorWriteMask::All; colorStateDescriptor.colorWriteMask = dawn::ColorWriteMask::All;
for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { for (uint32_t i = 0; i < kMaxColorAttachments; ++i) {
cColorStates[i] = colorStateDescriptor; mColorStates[i] = colorStateDescriptor;
cColorStates[i] = &mColorStates[i];
} }
} }

View File

@ -30,10 +30,11 @@ namespace utils {
dawn::PipelineStageDescriptor cVertexStage; dawn::PipelineStageDescriptor cVertexStage;
dawn::PipelineStageDescriptor cFragmentStage; dawn::PipelineStageDescriptor cFragmentStage;
std::array<dawn::ColorStateDescriptor, kMaxColorAttachments> cColorStates; std::array<dawn::ColorStateDescriptor*, kMaxColorAttachments> cColorStates;
dawn::DepthStencilStateDescriptor cDepthStencilState; dawn::DepthStencilStateDescriptor cDepthStencilState;
private: private:
dawn::ColorStateDescriptor mColorStates[kMaxColorAttachments];
}; };
} // namespace utils } // namespace utils