Remove deprecated SetBlendColor and blend factors
Bug: chromium:1199057
Change-Id: I6fdc08f0a62b579b556c4c910611d095fcb3a66f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63381
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
diff --git a/dawn.json b/dawn.json
index 8046f03..0aaf23e 100644
--- a/dawn.json
+++ b/dawn.json
@@ -223,14 +223,7 @@
{"value": 9, "name": "one minus dst alpha"},
{"value": 10, "name": "src alpha saturated"},
{"value": 11, "name": "constant"},
- {"value": 12, "name": "one minus constant"},
-
- {"value": 102, "name": "src color"},
- {"value": 103, "name": "one minus src color"},
- {"value": 106, "name": "dst color"},
- {"value": 107, "name": "one minus dst color"},
- {"value": 111, "name": "blend color"},
- {"value": 112, "name": "one minus blend color"}
+ {"value": 12, "name": "one minus constant"}
]
},
"blend operation": {
@@ -1475,12 +1468,6 @@
]
},
{
- "name": "set blend color",
- "args": [
- {"name": "color", "type": "color", "annotation": "const*"}
- ]
- },
- {
"name": "set blend constant",
"args": [
{"name": "color", "type": "color", "annotation": "const*"}
diff --git a/src/dawn_native/RenderPipeline.cpp b/src/dawn_native/RenderPipeline.cpp
index 0e8da0b..0e020c0 100644
--- a/src/dawn_native/RenderPipeline.cpp
+++ b/src/dawn_native/RenderPipeline.cpp
@@ -215,25 +215,6 @@
return {};
}
- static constexpr wgpu::BlendFactor kFirstDeprecatedBlendFactor =
- wgpu::BlendFactor::SrcColor;
- static constexpr uint32_t kDeprecatedBlendFactorOffset = 100;
-
- bool IsDeprecatedBlendFactor(wgpu::BlendFactor blendFactor) {
- return blendFactor >= kFirstDeprecatedBlendFactor;
- }
-
- wgpu::BlendFactor NormalizeBlendFactor(wgpu::BlendFactor blendFactor) {
- // If the specified format is from the deprecated range return the corresponding
- // non-deprecated format.
- if (blendFactor >= kFirstDeprecatedBlendFactor) {
- uint32_t blendFactorValue = static_cast<uint32_t>(blendFactor);
- return static_cast<wgpu::BlendFactor>(blendFactorValue -
- kDeprecatedBlendFactorOffset);
- }
- return blendFactor;
- }
-
MaybeError ValidateBlendState(DeviceBase* device, const BlendState* descriptor) {
DAWN_TRY(ValidateBlendOperation(descriptor->alpha.operation));
DAWN_TRY(ValidateBlendFactor(descriptor->alpha.srcFactor));
@@ -241,15 +222,6 @@
DAWN_TRY(ValidateBlendOperation(descriptor->color.operation));
DAWN_TRY(ValidateBlendFactor(descriptor->color.srcFactor));
DAWN_TRY(ValidateBlendFactor(descriptor->color.dstFactor));
-
- if (IsDeprecatedBlendFactor(descriptor->alpha.srcFactor) ||
- IsDeprecatedBlendFactor(descriptor->alpha.dstFactor) ||
- IsDeprecatedBlendFactor(descriptor->color.srcFactor) ||
- IsDeprecatedBlendFactor(descriptor->color.dstFactor)) {
- device->EmitDeprecationWarning(
- "Blend factor enums have changed and the old enums will be removed soon.");
- }
-
return {};
}
@@ -566,14 +538,6 @@
if (target->blend != nullptr) {
mTargetBlend[i] = *target->blend;
mTargets[i].blend = &mTargetBlend[i];
- mTargetBlend[i].alpha.srcFactor =
- NormalizeBlendFactor(mTargetBlend[i].alpha.srcFactor);
- mTargetBlend[i].alpha.dstFactor =
- NormalizeBlendFactor(mTargetBlend[i].alpha.dstFactor);
- mTargetBlend[i].color.srcFactor =
- NormalizeBlendFactor(mTargetBlend[i].color.srcFactor);
- mTargetBlend[i].color.dstFactor =
- NormalizeBlendFactor(mTargetBlend[i].color.dstFactor);
}
}
}
diff --git a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp
index 20ef8c2..0978bd8 100644
--- a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp
+++ b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp
@@ -173,15 +173,6 @@
return D3D12_BLEND_BLEND_FACTOR;
case wgpu::BlendFactor::OneMinusConstant:
return D3D12_BLEND_INV_BLEND_FACTOR;
-
- // Deprecated blend factors should be normalized prior to this call.
- case wgpu::BlendFactor::SrcColor:
- case wgpu::BlendFactor::OneMinusSrcColor:
- case wgpu::BlendFactor::DstColor:
- case wgpu::BlendFactor::OneMinusDstColor:
- case wgpu::BlendFactor::BlendColor:
- case wgpu::BlendFactor::OneMinusBlendColor:
- UNREACHABLE();
}
}
diff --git a/src/dawn_native/metal/RenderPipelineMTL.mm b/src/dawn_native/metal/RenderPipelineMTL.mm
index 0910db1..6d78676 100644
--- a/src/dawn_native/metal/RenderPipelineMTL.mm
+++ b/src/dawn_native/metal/RenderPipelineMTL.mm
@@ -158,15 +158,6 @@
case wgpu::BlendFactor::OneMinusConstant:
return alpha ? MTLBlendFactorOneMinusBlendAlpha
: MTLBlendFactorOneMinusBlendColor;
-
- // Deprecated blend factors should be normalized prior to this call.
- case wgpu::BlendFactor::SrcColor:
- case wgpu::BlendFactor::OneMinusSrcColor:
- case wgpu::BlendFactor::DstColor:
- case wgpu::BlendFactor::OneMinusDstColor:
- case wgpu::BlendFactor::BlendColor:
- case wgpu::BlendFactor::OneMinusBlendColor:
- UNREACHABLE();
}
}
diff --git a/src/dawn_native/opengl/RenderPipelineGL.cpp b/src/dawn_native/opengl/RenderPipelineGL.cpp
index 643db38..45d9986 100644
--- a/src/dawn_native/opengl/RenderPipelineGL.cpp
+++ b/src/dawn_native/opengl/RenderPipelineGL.cpp
@@ -84,15 +84,6 @@
return alpha ? GL_CONSTANT_ALPHA : GL_CONSTANT_COLOR;
case wgpu::BlendFactor::OneMinusConstant:
return alpha ? GL_ONE_MINUS_CONSTANT_ALPHA : GL_ONE_MINUS_CONSTANT_COLOR;
-
- // Deprecated blend factors should be normalized prior to this call.
- case wgpu::BlendFactor::SrcColor:
- case wgpu::BlendFactor::OneMinusSrcColor:
- case wgpu::BlendFactor::DstColor:
- case wgpu::BlendFactor::OneMinusDstColor:
- case wgpu::BlendFactor::BlendColor:
- case wgpu::BlendFactor::OneMinusBlendColor:
- UNREACHABLE();
}
}
diff --git a/src/dawn_native/vulkan/RenderPipelineVk.cpp b/src/dawn_native/vulkan/RenderPipelineVk.cpp
index 74a2a88..c12db00 100644
--- a/src/dawn_native/vulkan/RenderPipelineVk.cpp
+++ b/src/dawn_native/vulkan/RenderPipelineVk.cpp
@@ -180,15 +180,6 @@
return VK_BLEND_FACTOR_CONSTANT_COLOR;
case wgpu::BlendFactor::OneMinusConstant:
return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
-
- // Deprecated blend factors should be normalized prior to this call.
- case wgpu::BlendFactor::SrcColor:
- case wgpu::BlendFactor::OneMinusSrcColor:
- case wgpu::BlendFactor::DstColor:
- case wgpu::BlendFactor::OneMinusDstColor:
- case wgpu::BlendFactor::BlendColor:
- case wgpu::BlendFactor::OneMinusBlendColor:
- UNREACHABLE();
}
}
diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp
index fd84a6f..afe8b81 100644
--- a/src/tests/end2end/DeprecatedAPITests.cpp
+++ b/src/tests/end2end/DeprecatedAPITests.cpp
@@ -34,18 +34,6 @@
}
};
-// Test that SetBlendColor is deprecated.
-TEST_P(DeprecationTests, SetSetBlendColor) {
- wgpu::Color blendColor{1.0, 0.0, 0.0, 1.0};
-
- utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
-
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
- EXPECT_DEPRECATION_WARNING(pass.SetBlendColor(&blendColor));
- pass.EndPass();
-}
-
// Test that setting attachment rather than view for render pass color and depth/stencil attachments
// is deprecated.
TEST_P(DeprecationTests, SetAttachmentDescriptorAttachment) {
@@ -156,120 +144,3 @@
OpenGLBackend(),
OpenGLESBackend(),
VulkanBackend());
-
-class ImageCopyBufferDeprecationTests : public DeprecationTests {
- protected:
- wgpu::ImageCopyTexture MakeImageCopyTexture() {
- wgpu::TextureDescriptor desc = {};
- desc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
- desc.dimension = wgpu::TextureDimension::e2D;
- desc.size = {1, 1, 2};
- desc.format = wgpu::TextureFormat::RGBA8Unorm;
-
- wgpu::ImageCopyTexture copy;
- copy.texture = device.CreateTexture(&desc);
- copy.origin = {0, 0, 1};
- return copy;
- }
-
- wgpu::Extent3D copySize = {1, 1, 1};
-};
-
-// Tests that deprecated blend factors properly raise a deprecation warning when used
-class BlendFactorDeprecationTests : public DeprecationTests {
- protected:
- // Runs the test
- void DoTest(const wgpu::BlendFactor blendFactor, bool deprecated) {
- wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
- [[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
- return vec4<f32>(0.0, 0.0, 0.0, 1.0);
- }
- )");
- wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
- [[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
- return vec4<f32>(1.0, 1.0, 1.0, 1.0);
- }
- )");
-
- utils::ComboRenderPipelineDescriptor descriptor;
- descriptor.vertex.module = vsModule;
- descriptor.cFragment.module = fsModule;
- descriptor.cTargets[0].blend = &descriptor.cBlends[0];
-
- descriptor.cBlends[0].color.srcFactor = blendFactor;
- if (deprecated) {
- EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
- } else {
- device.CreateRenderPipeline(&descriptor);
- }
- descriptor.cBlends[0].color.srcFactor = wgpu::BlendFactor::One;
-
- descriptor.cBlends[0].color.dstFactor = blendFactor;
- if (deprecated) {
- EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
- } else {
- device.CreateRenderPipeline(&descriptor);
- }
- descriptor.cBlends[0].color.dstFactor = wgpu::BlendFactor::Zero;
-
- descriptor.cBlends[0].alpha.srcFactor = blendFactor;
- if (deprecated) {
- EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
- } else {
- device.CreateRenderPipeline(&descriptor);
- }
- descriptor.cBlends[0].alpha.srcFactor = wgpu::BlendFactor::One;
-
- descriptor.cBlends[0].alpha.dstFactor = blendFactor;
- if (deprecated) {
- EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
- } else {
- device.CreateRenderPipeline(&descriptor);
- }
- descriptor.cBlends[0].alpha.dstFactor = wgpu::BlendFactor::Zero;
- }
-};
-
-static constexpr std::array<wgpu::BlendFactor, 13> kBlendFactors = {
- wgpu::BlendFactor::Zero,
- wgpu::BlendFactor::One,
- wgpu::BlendFactor::Src,
- wgpu::BlendFactor::OneMinusSrc,
- wgpu::BlendFactor::SrcAlpha,
- wgpu::BlendFactor::OneMinusSrcAlpha,
- wgpu::BlendFactor::Dst,
- wgpu::BlendFactor::OneMinusDst,
- wgpu::BlendFactor::DstAlpha,
- wgpu::BlendFactor::OneMinusDstAlpha,
- wgpu::BlendFactor::SrcAlphaSaturated,
- wgpu::BlendFactor::Constant,
- wgpu::BlendFactor::OneMinusConstant,
-};
-
-TEST_P(BlendFactorDeprecationTests, CurrentBlendFactors) {
- // Using the new blend factors does not emit a warning.
- for (auto& format : kBlendFactors) {
- DoTest(format, false);
- }
-}
-
-static constexpr std::array<wgpu::BlendFactor, 6> kDeprecatedBlendFactors = {
- wgpu::BlendFactor::SrcColor, wgpu::BlendFactor::OneMinusSrcColor,
- wgpu::BlendFactor::DstColor, wgpu::BlendFactor::OneMinusDstColor,
- wgpu::BlendFactor::BlendColor, wgpu::BlendFactor::OneMinusBlendColor,
-};
-
-TEST_P(BlendFactorDeprecationTests, DeprecatedBlendFactors) {
- // Using deprecated blend factors does emit a warning.
- for (auto& format : kDeprecatedBlendFactors) {
- DoTest(format, true);
- }
-}
-
-DAWN_INSTANTIATE_TEST(BlendFactorDeprecationTests,
- D3D12Backend(),
- MetalBackend(),
- NullBackend(),
- OpenGLBackend(),
- OpenGLESBackend(),
- VulkanBackend());