Remove blendEnabled in BlendStateDescriptor, in order to match web idl
BUG=dawn:32 Change-Id: I7225d919ca1a9c1c848050ad3b9e8832725f0af6 Reviewed-on: https://dawn-review.googlesource.com/c/4460 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
393d555a0e
commit
5987c4e839
|
@ -124,7 +124,6 @@
|
||||||
"category": "structure",
|
"category": "structure",
|
||||||
"extensible": true,
|
"extensible": true,
|
||||||
"members": [
|
"members": [
|
||||||
{"name": "blend enabled", "type": "bool"},
|
|
||||||
{"name": "alpha blend", "type": "blend descriptor"},
|
{"name": "alpha blend", "type": "blend descriptor"},
|
||||||
{"name": "color blend", "type": "blend descriptor"},
|
{"name": "color blend", "type": "blend descriptor"},
|
||||||
{"name": "color write mask", "type": "color write mask"}
|
{"name": "color write mask", "type": "color write mask"}
|
||||||
|
|
|
@ -93,7 +93,6 @@ void init() {
|
||||||
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
||||||
dawnBlendStateDescriptor blendStateDescriptor;
|
dawnBlendStateDescriptor blendStateDescriptor;
|
||||||
blendStateDescriptor.nextInChain = nullptr;
|
blendStateDescriptor.nextInChain = nullptr;
|
||||||
blendStateDescriptor.blendEnabled = false;
|
|
||||||
blendStateDescriptor.alphaBlend = blendDescriptor;
|
blendStateDescriptor.alphaBlend = blendDescriptor;
|
||||||
blendStateDescriptor.colorBlend = blendDescriptor;
|
blendStateDescriptor.colorBlend = blendDescriptor;
|
||||||
blendStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
|
blendStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||||
|
|
|
@ -169,6 +169,15 @@ namespace dawn_native {
|
||||||
mDepthStencilState->stencilFront.passOp != dawn::StencilOperation::Keep;
|
mDepthStencilState->stencilFront.passOp != dawn::StencilOperation::Keep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BlendEnabled(const BlendStateDescriptor* mBlendState) {
|
||||||
|
return mBlendState->alphaBlend.operation != dawn::BlendOperation::Add ||
|
||||||
|
mBlendState->alphaBlend.srcFactor != dawn::BlendFactor::One ||
|
||||||
|
mBlendState->alphaBlend.dstFactor != dawn::BlendFactor::Zero ||
|
||||||
|
mBlendState->colorBlend.operation != dawn::BlendOperation::Add ||
|
||||||
|
mBlendState->colorBlend.srcFactor != dawn::BlendFactor::One ||
|
||||||
|
mBlendState->colorBlend.dstFactor != dawn::BlendFactor::Zero;
|
||||||
|
}
|
||||||
|
|
||||||
// RenderPipelineBase
|
// RenderPipelineBase
|
||||||
|
|
||||||
RenderPipelineBase::RenderPipelineBase(DeviceBase* device,
|
RenderPipelineBase::RenderPipelineBase(DeviceBase* device,
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace dawn_native {
|
||||||
MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device,
|
MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device,
|
||||||
const RenderPipelineDescriptor* descriptor);
|
const RenderPipelineDescriptor* descriptor);
|
||||||
bool StencilTestEnabled(const DepthStencilStateDescriptor* mDepthStencilState);
|
bool StencilTestEnabled(const DepthStencilStateDescriptor* mDepthStencilState);
|
||||||
|
bool BlendEnabled(const BlendStateDescriptor* mBlendState);
|
||||||
|
|
||||||
class RenderPipelineBase : public PipelineBase {
|
class RenderPipelineBase : public PipelineBase {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -129,7 +129,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
|
|
||||||
D3D12_RENDER_TARGET_BLEND_DESC ComputeBlendDesc(const BlendStateDescriptor* descriptor) {
|
D3D12_RENDER_TARGET_BLEND_DESC ComputeBlendDesc(const BlendStateDescriptor* descriptor) {
|
||||||
D3D12_RENDER_TARGET_BLEND_DESC blendDesc;
|
D3D12_RENDER_TARGET_BLEND_DESC blendDesc;
|
||||||
blendDesc.BlendEnable = descriptor->blendEnabled;
|
blendDesc.BlendEnable = BlendEnabled(descriptor);
|
||||||
blendDesc.SrcBlend = D3D12Blend(descriptor->colorBlend.srcFactor);
|
blendDesc.SrcBlend = D3D12Blend(descriptor->colorBlend.srcFactor);
|
||||||
blendDesc.DestBlend = D3D12Blend(descriptor->colorBlend.dstFactor);
|
blendDesc.DestBlend = D3D12Blend(descriptor->colorBlend.dstFactor);
|
||||||
blendDesc.BlendOp = D3D12BlendOperation(descriptor->colorBlend.operation);
|
blendDesc.BlendOp = D3D12BlendOperation(descriptor->colorBlend.operation);
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
void ComputeBlendDesc(MTLRenderPipelineColorAttachmentDescriptor* attachment,
|
void ComputeBlendDesc(MTLRenderPipelineColorAttachmentDescriptor* attachment,
|
||||||
const BlendStateDescriptor* descriptor) {
|
const BlendStateDescriptor* descriptor) {
|
||||||
attachment.blendingEnabled = descriptor->blendEnabled;
|
attachment.blendingEnabled = BlendEnabled(descriptor);
|
||||||
attachment.sourceRGBBlendFactor =
|
attachment.sourceRGBBlendFactor =
|
||||||
MetalBlendFactor(descriptor->colorBlend.srcFactor, false);
|
MetalBlendFactor(descriptor->colorBlend.srcFactor, false);
|
||||||
attachment.destinationRGBBlendFactor =
|
attachment.destinationRGBBlendFactor =
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace dawn_native { namespace opengl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyBlendState(uint32_t attachment, const BlendStateDescriptor* descriptor) {
|
void ApplyBlendState(uint32_t attachment, const BlendStateDescriptor* descriptor) {
|
||||||
if (descriptor->blendEnabled) {
|
if (BlendEnabled(descriptor)) {
|
||||||
glEnablei(GL_BLEND, attachment);
|
glEnablei(GL_BLEND, attachment);
|
||||||
glBlendEquationSeparatei(attachment, GLBlendMode(descriptor->colorBlend.operation),
|
glBlendEquationSeparatei(attachment, GLBlendMode(descriptor->colorBlend.operation),
|
||||||
GLBlendMode(descriptor->alphaBlend.operation));
|
GLBlendMode(descriptor->alphaBlend.operation));
|
||||||
|
|
|
@ -115,7 +115,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
VkPipelineColorBlendAttachmentState ComputeBlendDesc(
|
VkPipelineColorBlendAttachmentState ComputeBlendDesc(
|
||||||
const BlendStateDescriptor* descriptor) {
|
const BlendStateDescriptor* descriptor) {
|
||||||
VkPipelineColorBlendAttachmentState attachment;
|
VkPipelineColorBlendAttachmentState attachment;
|
||||||
attachment.blendEnable = descriptor->blendEnabled ? VK_TRUE : VK_FALSE;
|
attachment.blendEnable = BlendEnabled(descriptor) ? VK_TRUE : VK_FALSE;
|
||||||
attachment.srcColorBlendFactor = VulkanBlendFactor(descriptor->colorBlend.srcFactor);
|
attachment.srcColorBlendFactor = VulkanBlendFactor(descriptor->colorBlend.srcFactor);
|
||||||
attachment.dstColorBlendFactor = VulkanBlendFactor(descriptor->colorBlend.dstFactor);
|
attachment.dstColorBlendFactor = VulkanBlendFactor(descriptor->colorBlend.dstFactor);
|
||||||
attachment.colorBlendOp = VulkanBlendOperation(descriptor->colorBlend.operation);
|
attachment.colorBlendOp = VulkanBlendOperation(descriptor->colorBlend.operation);
|
||||||
|
|
|
@ -136,7 +136,6 @@ class BlendStateTest : public DawnTest {
|
||||||
blend.dstFactor = dawn::BlendFactor::One;
|
blend.dstFactor = dawn::BlendFactor::One;
|
||||||
|
|
||||||
dawn::BlendStateDescriptor descriptor;
|
dawn::BlendStateDescriptor descriptor;
|
||||||
descriptor.blendEnabled = true;
|
|
||||||
descriptor.alphaBlend = blend;
|
descriptor.alphaBlend = blend;
|
||||||
descriptor.colorBlend = blend;
|
descriptor.colorBlend = blend;
|
||||||
descriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
descriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
||||||
|
@ -161,7 +160,6 @@ class BlendStateTest : public DawnTest {
|
||||||
alphaBlend.dstFactor = alphaDstFactor;
|
alphaBlend.dstFactor = alphaDstFactor;
|
||||||
|
|
||||||
dawn::BlendStateDescriptor descriptor;
|
dawn::BlendStateDescriptor descriptor;
|
||||||
descriptor.blendEnabled = true;
|
|
||||||
descriptor.colorBlend = colorBlend;
|
descriptor.colorBlend = colorBlend;
|
||||||
descriptor.alphaBlend = alphaBlend;
|
descriptor.alphaBlend = alphaBlend;
|
||||||
descriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
descriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
||||||
|
@ -281,7 +279,6 @@ TEST_P(BlendStateTest, Basic) {
|
||||||
blend.srcFactor = dawn::BlendFactor::One;
|
blend.srcFactor = dawn::BlendFactor::One;
|
||||||
blend.dstFactor = dawn::BlendFactor::Zero;
|
blend.dstFactor = dawn::BlendFactor::Zero;
|
||||||
dawn::BlendStateDescriptor descriptor;
|
dawn::BlendStateDescriptor descriptor;
|
||||||
descriptor.blendEnabled = false;
|
|
||||||
descriptor.alphaBlend = blend;
|
descriptor.alphaBlend = blend;
|
||||||
descriptor.colorBlend = blend;
|
descriptor.colorBlend = blend;
|
||||||
descriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
descriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
||||||
|
@ -637,7 +634,6 @@ TEST_P(BlendStateTest, ColorWriteMask) {
|
||||||
blend.dstFactor = dawn::BlendFactor::One;
|
blend.dstFactor = dawn::BlendFactor::One;
|
||||||
|
|
||||||
dawn::BlendStateDescriptor descriptor;
|
dawn::BlendStateDescriptor descriptor;
|
||||||
descriptor.blendEnabled = true;
|
|
||||||
descriptor.colorBlend = blend;
|
descriptor.colorBlend = blend;
|
||||||
descriptor.alphaBlend = blend;
|
descriptor.alphaBlend = blend;
|
||||||
{
|
{
|
||||||
|
@ -687,7 +683,6 @@ TEST_P(BlendStateTest, ColorWriteMaskBlendingDisabled) {
|
||||||
descriptor.alphaBlend = blend;
|
descriptor.alphaBlend = blend;
|
||||||
descriptor.colorBlend = blend;
|
descriptor.colorBlend = blend;
|
||||||
|
|
||||||
descriptor.blendEnabled = false;
|
|
||||||
descriptor.colorWriteMask = dawn::ColorWriteMask::Red;
|
descriptor.colorWriteMask = dawn::ColorWriteMask::Red;
|
||||||
SetupSingleSourcePipelines(descriptor);
|
SetupSingleSourcePipelines(descriptor);
|
||||||
|
|
||||||
|
@ -799,15 +794,12 @@ TEST_P(BlendStateTest, IndependentBlendState) {
|
||||||
blend3.srcFactor = dawn::BlendFactor::One;
|
blend3.srcFactor = dawn::BlendFactor::One;
|
||||||
blend3.dstFactor = dawn::BlendFactor::One;
|
blend3.dstFactor = dawn::BlendFactor::One;
|
||||||
|
|
||||||
testDescriptor.cBlendStates[0].blendEnabled = true;
|
|
||||||
testDescriptor.cBlendStates[0].colorBlend = blend1;
|
testDescriptor.cBlendStates[0].colorBlend = blend1;
|
||||||
testDescriptor.cBlendStates[0].alphaBlend = blend1;
|
testDescriptor.cBlendStates[0].alphaBlend = blend1;
|
||||||
|
|
||||||
testDescriptor.cBlendStates[1].blendEnabled = true;
|
|
||||||
testDescriptor.cBlendStates[1].colorBlend = blend2;
|
testDescriptor.cBlendStates[1].colorBlend = blend2;
|
||||||
testDescriptor.cBlendStates[1].alphaBlend = blend2;
|
testDescriptor.cBlendStates[1].alphaBlend = blend2;
|
||||||
|
|
||||||
testDescriptor.cBlendStates[3].blendEnabled = true;
|
|
||||||
testDescriptor.cBlendStates[3].colorBlend = blend3;
|
testDescriptor.cBlendStates[3].colorBlend = blend3;
|
||||||
testDescriptor.cBlendStates[3].alphaBlend = blend3;
|
testDescriptor.cBlendStates[3].alphaBlend = blend3;
|
||||||
|
|
||||||
|
@ -881,7 +873,6 @@ TEST_P(BlendStateTest, DefaultBlendColor) {
|
||||||
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.cBlendStates[0].blendEnabled = true;
|
|
||||||
testDescriptor.cBlendStates[0].colorBlend = blend;
|
testDescriptor.cBlendStates[0].colorBlend = blend;
|
||||||
testDescriptor.cBlendStates[0].alphaBlend = blend;
|
testDescriptor.cBlendStates[0].alphaBlend = blend;
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,6 @@ 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.cBlendStates[0].blendEnabled = true;
|
|
||||||
descriptor.cBlendStates[0].alphaBlend = blend;
|
descriptor.cBlendStates[0].alphaBlend = blend;
|
||||||
descriptor.cBlendStates[0].colorBlend = blend;
|
descriptor.cBlendStates[0].colorBlend = blend;
|
||||||
|
|
||||||
|
|
|
@ -347,7 +347,6 @@ TEST_F(WireTests, CStringArgument) {
|
||||||
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
||||||
dawnBlendStateDescriptor blendStateDescriptor;
|
dawnBlendStateDescriptor blendStateDescriptor;
|
||||||
blendStateDescriptor.nextInChain = nullptr;
|
blendStateDescriptor.nextInChain = nullptr;
|
||||||
blendStateDescriptor.blendEnabled = false;
|
|
||||||
blendStateDescriptor.alphaBlend = blendDescriptor;
|
blendStateDescriptor.alphaBlend = blendDescriptor;
|
||||||
blendStateDescriptor.colorBlend = blendDescriptor;
|
blendStateDescriptor.colorBlend = blendDescriptor;
|
||||||
blendStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
|
blendStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||||
|
|
|
@ -61,7 +61,6 @@ namespace utils {
|
||||||
blend.srcFactor = dawn::BlendFactor::One;
|
blend.srcFactor = dawn::BlendFactor::One;
|
||||||
blend.dstFactor = dawn::BlendFactor::Zero;
|
blend.dstFactor = dawn::BlendFactor::Zero;
|
||||||
dawn::BlendStateDescriptor blendStateDescriptor;
|
dawn::BlendStateDescriptor blendStateDescriptor;
|
||||||
blendStateDescriptor.blendEnabled = false;
|
|
||||||
blendStateDescriptor.alphaBlend = blend;
|
blendStateDescriptor.alphaBlend = blend;
|
||||||
blendStateDescriptor.colorBlend = blend;
|
blendStateDescriptor.colorBlend = blend;
|
||||||
blendStateDescriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
blendStateDescriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
||||||
|
|
Loading…
Reference in New Issue