diff options
author | Shahbaz Youssefi <syoussefi@chromium.org> | 2022-04-20 04:32:48 +0000 |
---|---|---|
committer | Angle LUCI CQ <angle-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-04-20 04:34:12 +0000 |
commit | f4fc8e1688f599f2f4fdac3afc05cfa3c9155c5a (patch) | |
tree | 2ee8cf4e064d4e74897478d7c032cd6e12a9f7a3 | |
parent | 5014ce664ca520475f0b1bac50fc915613d99ad5 (diff) | |
download | angle-f4fc8e1688f599f2f4fdac3afc05cfa3c9155c5a.tar.gz |
Revert "Fix BlendStateExt::mMaxColorMask initialization"
This reverts commit 50d008a7efcab80f34eb742148d05389b2ed247e.
Reason for revert: Causes the win-trace bot to fail
Original change's description:
> Fix BlendStateExt::mMaxColorMask initialization
>
> This variable should not have its unused bits set.
>
> To avoid confusion with other masks of the same class,
> the variable was renamed to mAllColorMask.
>
> Bug: angleproject:7200
> Change-Id: I72542d49ff8da3dbb8d61c5034ce37c1e8fcc6e1
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3581990
> Reviewed-by: Jamie Madill <jmadill@chromium.org>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>
> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Bug: angleproject:7200
Change-Id: Ib9a0927ba4e152d5b4ae4c034e6748faf6b5aa87
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3594802
Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
-rw-r--r-- | src/libANGLE/State.cpp | 2 | ||||
-rw-r--r-- | src/libANGLE/angletypes.cpp | 16 | ||||
-rw-r--r-- | src/libANGLE/angletypes.h | 10 | ||||
-rw-r--r-- | src/libANGLE/angletypes_unittest.cpp | 17 |
4 files changed, 15 insertions, 30 deletions
diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp index daee4f0f77..383bf7ce44 100644 --- a/src/libANGLE/State.cpp +++ b/src/libANGLE/State.cpp @@ -799,7 +799,7 @@ bool State::anyActiveDrawBufferChannelMasked() const { // Compare current color mask with all-enabled color mask, while ignoring disabled draw // buffers. - return (mBlendStateExt.compareColorMask(mBlendStateExt.mAllColorMask) & + return (mBlendStateExt.compareColorMask(mBlendStateExt.mMaxColorMask) & mDrawFramebuffer->getDrawBufferMask()) .any(); } diff --git a/src/libANGLE/angletypes.cpp b/src/libANGLE/angletypes.cpp index 6294e16ce9..9076160958 100644 --- a/src/libANGLE/angletypes.cpp +++ b/src/libANGLE/angletypes.cpp @@ -355,20 +355,16 @@ BlendStateExt::BlendStateExt(const size_t drawBuffers) mMaxEquationMask(EquationStorage::GetMask(drawBuffers)), mEquationColor(EquationStorage::GetReplicatedValue(BlendEquationType::Add, mMaxEquationMask)), mEquationAlpha(EquationStorage::GetReplicatedValue(BlendEquationType::Add, mMaxEquationMask)), - mAllColorMask(ColorMaskStorage::GetReplicatedValue(PackColorMask(true, true, true, true), - ColorMaskStorage::GetMask(drawBuffers))), - mColorMask(mAllColorMask), + mMaxColorMask(ColorMaskStorage::GetMask(drawBuffers)), + mColorMask(ColorMaskStorage::GetReplicatedValue(PackColorMask(true, true, true, true), + mMaxColorMask)), mMaxEnabledMask(0xFF >> (8 - drawBuffers)), mMaxDrawBuffers(drawBuffers) {} BlendStateExt::BlendStateExt(const BlendStateExt &other) = default; -BlendStateExt &BlendStateExt::operator=(const BlendStateExt &other) -{ - memcpy(this, &other, sizeof(BlendStateExt)); - return *this; -} +BlendStateExt &BlendStateExt::operator=(const BlendStateExt &other) = default; void BlendStateExt::setEnabled(const bool enabled) { @@ -387,14 +383,14 @@ BlendStateExt::ColorMaskStorage::Type BlendStateExt::expandColorMaskValue(const const bool alpha) const { return BlendStateExt::ColorMaskStorage::GetReplicatedValue( - PackColorMask(red, green, blue, alpha), mAllColorMask); + PackColorMask(red, green, blue, alpha), mMaxColorMask); } BlendStateExt::ColorMaskStorage::Type BlendStateExt::expandColorMaskIndexed( const size_t index) const { return ColorMaskStorage::GetReplicatedValue( - ColorMaskStorage::GetValueIndexed(index, mColorMask), mAllColorMask); + ColorMaskStorage::GetValueIndexed(index, mColorMask), mMaxColorMask); } void BlendStateExt::setColorMask(const bool red, diff --git a/src/libANGLE/angletypes.h b/src/libANGLE/angletypes.h index 886afb140f..a890f5c24a 100644 --- a/src/libANGLE/angletypes.h +++ b/src/libANGLE/angletypes.h @@ -706,25 +706,25 @@ class BlendStateExt final ///////// Data Members ///////// - const FactorStorage::Type mMaxFactorMask; + FactorStorage::Type mMaxFactorMask; FactorStorage::Type mSrcColor; FactorStorage::Type mDstColor; FactorStorage::Type mSrcAlpha; FactorStorage::Type mDstAlpha; - const EquationStorage::Type mMaxEquationMask; + EquationStorage::Type mMaxEquationMask; EquationStorage::Type mEquationColor; EquationStorage::Type mEquationAlpha; - const ColorMaskStorage::Type mAllColorMask; + ColorMaskStorage::Type mMaxColorMask; ColorMaskStorage::Type mColorMask; - const DrawBufferMask mMaxEnabledMask; + DrawBufferMask mMaxEnabledMask; DrawBufferMask mEnabledMask; // Cache of whether the blend equation for each index is from KHR_blend_equation_advanced. DrawBufferMask mUsesAdvancedBlendEquationMask; - const size_t mMaxDrawBuffers; + size_t mMaxDrawBuffers; }; // Used in StateCache diff --git a/src/libANGLE/angletypes_unittest.cpp b/src/libANGLE/angletypes_unittest.cpp index 27e5ea9476..de3bf083da 100644 --- a/src/libANGLE/angletypes_unittest.cpp +++ b/src/libANGLE/angletypes_unittest.cpp @@ -49,7 +49,7 @@ TEST(BlendStateExt, Init) const gl::BlendStateExt blendStateExt = gl::BlendStateExt(1); ASSERT_EQ(blendStateExt.mMaxDrawBuffers, 1u); ASSERT_EQ(blendStateExt.mMaxEnabledMask.to_ulong(), 1u); - ASSERT_EQ(blendStateExt.mAllColorMask, 0xFu); + ASSERT_EQ(blendStateExt.mMaxColorMask, is64Bit ? 0xFFu : 0xFu); ASSERT_EQ(blendStateExt.mMaxEquationMask, 0xFFu); ASSERT_EQ(blendStateExt.mMaxFactorMask, 0xFFu); checkInitState(blendStateExt); @@ -59,7 +59,7 @@ TEST(BlendStateExt, Init) const gl::BlendStateExt blendStateExt = gl::BlendStateExt(4); ASSERT_EQ(blendStateExt.mMaxDrawBuffers, 4u); ASSERT_EQ(blendStateExt.mMaxEnabledMask.to_ulong(), 0xFu); - ASSERT_EQ(blendStateExt.mAllColorMask, is64Bit ? 0x0F0F0F0Fu : 0xFFFFu); + ASSERT_EQ(blendStateExt.mMaxColorMask, is64Bit ? 0xFFFFFFFFu : 0xFFFFu); ASSERT_EQ(blendStateExt.mMaxEquationMask, 0xFFFFFFFFu); ASSERT_EQ(blendStateExt.mMaxFactorMask, 0xFFFFFFFFu); checkInitState(blendStateExt); @@ -69,7 +69,7 @@ TEST(BlendStateExt, Init) const gl::BlendStateExt blendStateExt = gl::BlendStateExt(8); ASSERT_EQ(blendStateExt.mMaxDrawBuffers, 8u); ASSERT_EQ(blendStateExt.mMaxEnabledMask.to_ulong(), 0xFFu); - ASSERT_EQ(blendStateExt.mAllColorMask, is64Bit ? 0x0F0F0F0F0F0F0F0Fu : 0xFFFFFFFFu); + ASSERT_EQ(blendStateExt.mMaxColorMask, is64Bit ? 0xFFFFFFFFFFFFFFFFu : 0xFFFFFFFFu); ASSERT_EQ(blendStateExt.mMaxEquationMask, 0xFFFFFFFFFFFFFFFFu); ASSERT_EQ(blendStateExt.mMaxFactorMask, 0xFFFFFFFFFFFFFFFFu); checkInitState(blendStateExt); @@ -120,17 +120,6 @@ TEST(BlendStateExt, ColorMask) ASSERT_EQ(diff.to_ulong(), 23u); } -// Test that all-enabled color mask correctly compares with the current color mask -TEST(BlendStateExt, MaxColorMask) -{ - gl::BlendStateExt blendStateExt = gl::BlendStateExt(4); - - blendStateExt.setColorMaskIndexed(2, true, false, true, false); - - const gl::DrawBufferMask diff = blendStateExt.compareColorMask(blendStateExt.mAllColorMask); - ASSERT_EQ(diff.to_ulong(), 4u); -} - // Test blend equations manipulations TEST(BlendStateExt, BlendEquations) { |