Replace DepthStencilState builder via DepthStencilState descriptor.

This change also removes DepthStencilState object.

Bug=dawn:31

Change-Id: I7bb54ef4da527184bb2726c77d93d411d44c3956
Reviewed-on: https://dawn-review.googlesource.com/c/3541
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Yunchao He
2019-01-04 04:28:37 +00:00
committed by Commit Bot service account
parent 0b364067d0
commit ea56333c1e
47 changed files with 678 additions and 1235 deletions

View File

@@ -50,25 +50,45 @@ namespace utils {
}
}
descriptor->inputState = device.CreateInputStateBuilder().GetResult();
descriptor->depthStencilState = device.CreateDepthStencilStateBuilder().GetResult();
descriptor->layout = utils::MakeBasicPipelineLayout(device, nullptr);
// Set defaults for the blend state descriptors.
{
descriptor->numBlendStates = 1;
descriptor->blendStates = &cBlendStates[0];
descriptor->numBlendStates = 1;
descriptor->blendStates = &cBlendStates[0];
dawn::BlendDescriptor blend;
blend.operation = dawn::BlendOperation::Add;
blend.srcFactor = dawn::BlendFactor::One;
blend.dstFactor = dawn::BlendFactor::Zero;
dawn::BlendStateDescriptor blendStateDescriptor;
blendStateDescriptor.blendEnabled = false;
blendStateDescriptor.alphaBlend = blend;
blendStateDescriptor.colorBlend = blend;
blendStateDescriptor.colorWriteMask = dawn::ColorWriteMask::All;
for (uint32_t i = 0; i < kMaxColorAttachments; ++i) {
cBlendStates[i] = blendStateDescriptor;
dawn::BlendDescriptor blend;
blend.operation = dawn::BlendOperation::Add;
blend.srcFactor = dawn::BlendFactor::One;
blend.dstFactor = dawn::BlendFactor::Zero;
dawn::BlendStateDescriptor blendStateDescriptor;
blendStateDescriptor.blendEnabled = false;
blendStateDescriptor.alphaBlend = blend;
blendStateDescriptor.colorBlend = blend;
blendStateDescriptor.colorWriteMask = dawn::ColorWriteMask::All;
for (uint32_t i = 0; i < kMaxColorAttachments; ++i) {
cBlendStates[i] = blendStateDescriptor;
}
}
// Set defaults for the depth stencil state descriptors.
{
dawn::StencilStateFaceDescriptor stencilFace;
stencilFace.compare = dawn::CompareFunction::Always;
stencilFace.stencilFailOp = dawn::StencilOperation::Keep;
stencilFace.depthFailOp = dawn::StencilOperation::Keep;
stencilFace.passOp = dawn::StencilOperation::Keep;
// dawn::DepthStencilStateDescriptor depthStencilState;
cDepthStencilState.depthWriteEnabled = false;
cDepthStencilState.depthCompare = dawn::CompareFunction::Always;
cDepthStencilState.back = stencilFace;
cDepthStencilState.front = stencilFace;
cDepthStencilState.stencilReadMask = 0xff;
cDepthStencilState.stencilWriteMask = 0xff;
descriptor->depthStencilState = &cDepthStencilState;
}
descriptor->inputState = device.CreateInputStateBuilder().GetResult();
descriptor->layout = utils::MakeBasicPipelineLayout(device, nullptr);
}
} // namespace utils

View File

@@ -34,6 +34,7 @@ namespace utils {
std::array<dawn::AttachmentDescriptor, kMaxColorAttachments> cColorAttachments;
dawn::AttachmentDescriptor cDepthStencilAttachment;
std::array<dawn::BlendStateDescriptor, kMaxColorAttachments> cBlendStates;
dawn::DepthStencilStateDescriptor cDepthStencilState;
};
} // namespace utils