mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
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:
committed by
Commit Bot service account
parent
0b364067d0
commit
ea56333c1e
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user