Remove indirection for colorStates

This is to match the work in progress webgpu.h header.

BUG=dawn:22

Change-Id: Ia1077fef95e6bda541cddbd2f6ce40b79138e960
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9383
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez 2019-09-20 23:22:27 +00:00 committed by Commit Bot service account
parent b8dbada76d
commit c81a717379
39 changed files with 81 additions and 89 deletions

View File

@ -1076,7 +1076,7 @@
{"name": "sample count", "type": "uint32_t", "default": "1"},
{"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true},
{"name": "color state count", "type": "uint32_t"},
{"name": "color states", "type": "color state descriptor", "annotation": "const*const*", "length": "color state count"},
{"name": "color states", "type": "color state descriptor", "annotation": "const*", "length": "color state count"},
{"name": "sample mask", "type": "uint32_t", "default": "0xFFFFFFFF"},
{"name": "alpha to coverage enabled", "type": "bool", "default": "false"}
]

View File

@ -119,7 +119,7 @@ void init() {
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -85,8 +85,7 @@ void init() {
colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
descriptor.colorStateCount = 1;
DawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
descriptor.colorStates = colorStatesPtr;
descriptor.colorStates = &colorStateDescriptor;
DawnPipelineLayoutDescriptor pl;
pl.nextInChain = nullptr;

View File

@ -141,7 +141,7 @@ void initRender() {
descriptor.cVertexInput.cAttributes[2].format = dawn::VertexFormat::Float2;
descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
renderPipeline = device.CreateRenderPipeline(&descriptor);
}

View File

@ -135,7 +135,7 @@ void init() {
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -210,7 +210,7 @@ void init() {
descriptor.vertexInput = &vertexInput;
descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
descriptor.cDepthStencilState.depthWriteEnabled = true;
descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
@ -223,7 +223,7 @@ void init() {
pDescriptor.vertexInput = &vertexInput;
pDescriptor.depthStencilState = &pDescriptor.cDepthStencilState;
pDescriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
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;
@ -237,7 +237,7 @@ void init() {
rfDescriptor.vertexInput = &vertexInput;
rfDescriptor.depthStencilState = &rfDescriptor.cDepthStencilState;
rfDescriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
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;

View File

@ -34,9 +34,8 @@ namespace dawn_native {
AttachmentStateBlueprint::AttachmentStateBlueprint(const RenderPipelineDescriptor* descriptor)
: mSampleCount(descriptor->sampleCount) {
for (uint32_t i = 0; i < descriptor->colorStateCount; ++i) {
ASSERT(descriptor->colorStates[i] != nullptr);
mColorAttachmentsSet.set(i);
mColorFormats[i] = descriptor->colorStates[i]->format;
mColorFormats[i] = descriptor->colorStates[i].format;
}
if (descriptor->depthStencilState != nullptr) {
mDepthStencilFormat = descriptor->depthStencilState->format;

View File

@ -117,20 +117,20 @@ namespace dawn_native {
}
MaybeError ValidateColorStateDescriptor(const DeviceBase* device,
const ColorStateDescriptor* descriptor) {
if (descriptor->nextInChain != nullptr) {
const ColorStateDescriptor& descriptor) {
if (descriptor.nextInChain != nullptr) {
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
}
DAWN_TRY(ValidateBlendOperation(descriptor->alphaBlend.operation));
DAWN_TRY(ValidateBlendFactor(descriptor->alphaBlend.srcFactor));
DAWN_TRY(ValidateBlendFactor(descriptor->alphaBlend.dstFactor));
DAWN_TRY(ValidateBlendOperation(descriptor->colorBlend.operation));
DAWN_TRY(ValidateBlendFactor(descriptor->colorBlend.srcFactor));
DAWN_TRY(ValidateBlendFactor(descriptor->colorBlend.dstFactor));
DAWN_TRY(ValidateColorWriteMask(descriptor->writeMask));
DAWN_TRY(ValidateBlendOperation(descriptor.alphaBlend.operation));
DAWN_TRY(ValidateBlendFactor(descriptor.alphaBlend.srcFactor));
DAWN_TRY(ValidateBlendFactor(descriptor.alphaBlend.dstFactor));
DAWN_TRY(ValidateBlendOperation(descriptor.colorBlend.operation));
DAWN_TRY(ValidateBlendFactor(descriptor.colorBlend.srcFactor));
DAWN_TRY(ValidateBlendFactor(descriptor.colorBlend.dstFactor));
DAWN_TRY(ValidateColorWriteMask(descriptor.writeMask));
const Format* format;
DAWN_TRY_ASSIGN(format, device->GetInternalFormat(descriptor->format));
DAWN_TRY_ASSIGN(format, device->GetInternalFormat(descriptor.format));
if (!format->IsColor() || !format->isRenderable) {
return DAWN_VALIDATION_ERROR("Color format must be color renderable");
}
@ -420,7 +420,7 @@ namespace dawn_native {
}
for (uint32_t i : IterateBitSet(mAttachmentState->GetColorAttachmentsMask())) {
mColorStates[i] = *descriptor->colorStates[i];
mColorStates[i] = descriptor->colorStates[i];
}
// TODO(cwallez@chromium.org): Check against the shader module that the correct color

View File

@ -106,10 +106,10 @@ protected:
pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;
pipelineDescriptor.cColorStates[0]->colorBlend.operation = dawn::BlendOperation::Add;
pipelineDescriptor.cColorStates[0]->colorBlend.srcFactor = dawn::BlendFactor::One;
pipelineDescriptor.cColorStates[0]->colorBlend.dstFactor = dawn::BlendFactor::One;
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
pipelineDescriptor.cColorStates[0].colorBlend.operation = dawn::BlendOperation::Add;
pipelineDescriptor.cColorStates[0].colorBlend.srcFactor = dawn::BlendFactor::One;
pipelineDescriptor.cColorStates[0].colorBlend.dstFactor = dawn::BlendFactor::One;
return device.CreateRenderPipeline(&pipelineDescriptor);
}
@ -193,7 +193,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
textureDescriptor.layout = pipelineLayout;
textureDescriptor.vertexStage.module = vsModule;
textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
@ -274,7 +274,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
@ -398,7 +398,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
textureDescriptor.layout = pipelineLayout;
textureDescriptor.vertexStage.module = vsModule;
textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);

View File

@ -73,7 +73,7 @@ class ColorStateTest : public DawnTest {
baseDescriptor.layout = pipelineLayout;
baseDescriptor.vertexStage.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.vertexStage.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);
}
@ -825,14 +825,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);
@ -901,7 +901,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
baseDescriptor.layout = pipelineLayout;
baseDescriptor.vertexStage.module = vsModule;
baseDescriptor.cFragmentStage.module = fsModule;
baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
@ -909,14 +909,14 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
testDescriptor.layout = pipelineLayout;
testDescriptor.vertexStage.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};
@ -1025,7 +1025,7 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
baseDescriptor.layout = pipelineLayout;
baseDescriptor.vertexStage.module = vsModule;
baseDescriptor.cFragmentStage.module = fsModule;
baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
@ -1033,8 +1033,8 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
testDescriptor.layout = pipelineLayout;
testDescriptor.vertexStage.module = vsModule;
testDescriptor.cFragmentStage.module = fsModule;
testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
testDescriptor.cColorStates[0]->writeMask = dawn::ColorWriteMask::Red;
testDescriptor.cColorStates[0].format = renderPass.colorFormat;
testDescriptor.cColorStates[0].writeMask = dawn::ColorWriteMask::Red;
testPipeline = device.CreateRenderPipeline(&testDescriptor);

View File

@ -166,7 +166,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
renderPipelineDescriptor.vertexStage.module = vsModule;
renderPipelineDescriptor.cFragmentStage.module = fsModule;
renderPipelineDescriptor.layout = pipelineLayout;
renderPipelineDescriptor.cColorStates[0]->format =
renderPipelineDescriptor.cColorStates[0].format =
utils::BasicRenderPass::kDefaultColorFormat;
return device.CreateRenderPipeline(&renderPipelineDescriptor);
}

View File

@ -50,7 +50,7 @@ class DestroyTest : public DawnTest {
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -50,7 +50,7 @@ class DrawIndexedIndirectTest : public DawnTest {
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -50,7 +50,7 @@ class DrawIndexedTest : public DawnTest {
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -50,7 +50,7 @@ class DrawIndirectTest : public DawnTest {
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -50,7 +50,7 @@ class DrawTest : public DawnTest {
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -142,7 +142,7 @@ class DynamicBufferOffsetTests : public DawnTest {
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
pipelineDescriptor.cColorStates[0].format = dawn::TextureFormat::RGBA8Unorm;
dawn::PipelineLayoutDescriptor pipelineLayoutDescriptor;
if (isInheritedPipeline) {

View File

@ -306,7 +306,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
descriptor.vertexStage.module = vs;
descriptor.cFragmentStage.module = fs;
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
descriptor.cColorStates[0].format = dawn::TextureFormat::RGBA8Unorm;
pipeline = device.CreateRenderPipeline(&descriptor);
}

View File

@ -56,7 +56,7 @@ class IndexFormatTest : public DawnTest {
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
return device.CreateRenderPipeline(&descriptor);
}

View File

@ -221,7 +221,7 @@ class MultisampledRenderingTest : public DawnTest {
pipelineDescriptor.colorStateCount = numColorAttachments;
for (uint32_t i = 0; i < numColorAttachments; ++i) {
pipelineDescriptor.cColorStates[i]->format = kColorFormat;
pipelineDescriptor.cColorStates[i].format = kColorFormat;
}
return device.CreateRenderPipeline(&pipelineDescriptor);

View File

@ -180,7 +180,7 @@ TEST_P(OpArrayLengthTest, Fragment) {
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
@ -241,7 +241,7 @@ TEST_P(OpArrayLengthTest, Vertex) {
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -190,7 +190,7 @@ class PrimitiveTopologyTest : public DawnTest {
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -81,7 +81,7 @@ class RenderBundleTest : public DawnTest {
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor);

View File

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

View File

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

View File

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

View File

@ -219,7 +219,7 @@ class TextureFormatTest : public DawnTest {
desc.vertexStage.module = vsModule;
desc.cFragmentStage.module = fsModule;
desc.layout = utils::MakeBasicPipelineLayout(device, &bgl);
desc.cColorStates[0]->format = renderFormatInfo.format;
desc.cColorStates[0].format = renderFormatInfo.format;
return device.CreateRenderPipeline(&desc);
}

View File

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

View File

@ -474,7 +474,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
void main() {
fragColor = texelFetch(sampler2D(texture0, sampler0), ivec2(gl_FragCoord), 0);
})");
renderPipelineDescriptor.cColorStates[0]->format = kColorFormat;
renderPipelineDescriptor.cColorStates[0].format = kColorFormat;
dawn::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
// Create bindgroup

View File

@ -366,7 +366,7 @@ class VertexFormatTest : public DawnTest {
descriptor.cVertexInput.cBuffers[0].stride = strideBytes;
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cAttributes[0].format = format;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
descriptor.cColorStates[0].format = renderPass.colorFormat;
return device.CreateRenderPipeline(&descriptor);
}

View File

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

View File

@ -43,7 +43,7 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
descriptor.vertexStage.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);

View File

@ -707,9 +707,9 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
InitializeRenderPipelineDescriptor(desc);
desc->colorStateCount = 3;
desc->cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
desc->cColorStates[1]->format = dawn::TextureFormat::RG16Float;
desc->cColorStates[2]->format = dawn::TextureFormat::R16Sint;
desc->cColorStates[0].format = dawn::TextureFormat::RGBA8Unorm;
desc->cColorStates[1].format = dawn::TextureFormat::RG16Float;
desc->cColorStates[2].format = dawn::TextureFormat::R16Sint;
};
// Test the success case.
@ -728,7 +728,7 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
{
utils::ComboRenderPipelineDescriptor desc(device);
SetupRenderPipelineDescForTest(&desc);
desc.cColorStates[1]->format = dawn::TextureFormat::RGBA8Unorm;
desc.cColorStates[1].format = dawn::TextureFormat::RGBA8Unorm;
dawn::RenderBundleEncoder renderBundleEncoder =
device.CreateRenderBundleEncoder(&renderBundleDesc);
@ -761,7 +761,7 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) {
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
InitializeRenderPipelineDescriptor(desc);
desc->colorStateCount = 1;
desc->cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
desc->cColorStates[0].format = dawn::TextureFormat::RGBA8Unorm;
desc->depthStencilState = &desc->cDepthStencilState;
desc->cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
};
@ -815,7 +815,7 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) {
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
renderPipelineDesc.colorStateCount = 1;
renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
renderPipelineDesc.cColorStates[0].format = dawn::TextureFormat::RGBA8Unorm;
renderPipelineDesc.sampleCount = 4;
// Test the success case.

View File

@ -98,7 +98,7 @@ TEST_F(RenderPipelineValidationTest, NonRenderableFormat) {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
descriptor.cColorStates[0].format = dawn::TextureFormat::RGBA8Unorm;
device.CreateRenderPipeline(&descriptor);
}
@ -108,7 +108,7 @@ TEST_F(RenderPipelineValidationTest, NonRenderableFormat) {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cColorStates[0]->format = dawn::TextureFormat::RG11B10Float;
descriptor.cColorStates[0].format = dawn::TextureFormat::RG11B10Float;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}

View File

@ -37,7 +37,7 @@ class VertexInputTest : public ValidationTest {
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.vertexInput = &state;
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
descriptor.cColorStates[0].format = dawn::TextureFormat::RGBA8Unorm;
if (!success) {
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));

View File

@ -173,8 +173,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
pipelineDescriptor.fragmentStage = &fragmentStage;
pipelineDescriptor.colorStateCount = 1;
DawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
pipelineDescriptor.colorStates = colorStatesPtr;
pipelineDescriptor.colorStates = &colorStateDescriptor;
pipelineDescriptor.sampleCount = 1;
pipelineDescriptor.sampleMask = 0xFFFFFFFF;

View File

@ -143,8 +143,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
pipelineDescriptor.fragmentStage = &fragmentStage;
pipelineDescriptor.colorStateCount = 1;
DawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
pipelineDescriptor.colorStates = colorStatesPtr;
pipelineDescriptor.colorStates = &colorStateDescriptor;
pipelineDescriptor.sampleCount = 1;
pipelineDescriptor.sampleMask = 0xFFFFFFFF;

View File

@ -78,7 +78,7 @@ namespace utils {
// Set defaults for the color state descriptors.
{
descriptor->colorStateCount = 1;
descriptor->colorStates = &cColorStates[0];
descriptor->colorStates = cColorStates.data();
dawn::BlendDescriptor blend;
blend.operation = dawn::BlendOperation::Add;
@ -90,8 +90,7 @@ namespace utils {
colorStateDescriptor.colorBlend = blend;
colorStateDescriptor.writeMask = dawn::ColorWriteMask::All;
for (uint32_t i = 0; i < kMaxColorAttachments; ++i) {
mColorStates[i] = colorStateDescriptor;
cColorStates[i] = &mColorStates[i];
cColorStates[i] = colorStateDescriptor;
}
}

View File

@ -44,11 +44,8 @@ namespace utils {
ComboVertexInputDescriptor cVertexInput;
dawn::RasterizationStateDescriptor cRasterizationState;
std::array<dawn::ColorStateDescriptor*, kMaxColorAttachments> cColorStates;
std::array<dawn::ColorStateDescriptor, kMaxColorAttachments> cColorStates;
dawn::DepthStencilStateDescriptor cDepthStencilState;
private:
dawn::ColorStateDescriptor mColorStates[kMaxColorAttachments];
};
} // namespace utils