Commit ec010006 by Geoff Lang Committed by Commit Bot

Revert "Remove redundant BlendStateArray tracking"

This reverts commit c746ac65. Reason for revert: Possible performance regression BUG=chromium:1085996 Original change's description: > Remove redundant BlendStateArray tracking > > Keep legacy BlendState for now. > > Bug: angleproject:4394 > Change-Id: Icba2b2f3a071d0f838a5480ff94869d35b776d94 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2169093 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Commit-Queue: Kenneth Russell <kbr@chromium.org> TBR=geofflang@chromium.org,kbr@chromium.org,jonahr@google.com,jmadill@chromium.org,lexa.knyazev@gmail.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:4394 Change-Id: Id05b382e951a7256805cffe696325b6b6d940e96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2246719 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 59656899
...@@ -263,10 +263,10 @@ angle::Result InitAttachment(const Context *context, FramebufferAttachment *atta ...@@ -263,10 +263,10 @@ angle::Result InitAttachment(const Context *context, FramebufferAttachment *atta
return angle::Result::Continue; return angle::Result::Continue;
} }
bool IsColorMaskedOut(const BlendStateExt &blendStateExt, const GLint drawbuffer) bool IsColorMaskedOut(const BlendState &blend)
{ {
ASSERT(static_cast<size_t>(drawbuffer) < blendStateExt.mMaxDrawBuffers); return (!blend.colorMaskRed && !blend.colorMaskGreen && !blend.colorMaskBlue &&
return blendStateExt.getColorMaskIndexed(static_cast<size_t>(drawbuffer)) == 0; !blend.colorMaskAlpha);
} }
bool IsDepthMaskedOut(const DepthStencilState &depthStencil) bool IsDepthMaskedOut(const DepthStencilState &depthStencil)
...@@ -284,7 +284,9 @@ bool IsClearBufferMaskedOut(const Context *context, GLenum buffer, GLint drawbuf ...@@ -284,7 +284,9 @@ bool IsClearBufferMaskedOut(const Context *context, GLenum buffer, GLint drawbuf
switch (buffer) switch (buffer)
{ {
case GL_COLOR: case GL_COLOR:
return IsColorMaskedOut(context->getState().getBlendStateExt(), drawbuffer); ASSERT(static_cast<size_t>(drawbuffer) <
context->getState().getBlendStateArray().size());
return IsColorMaskedOut(context->getState().getBlendStateArray()[drawbuffer]);
case GL_DEPTH: case GL_DEPTH:
return IsDepthMaskedOut(context->getState().getDepthStencilState()); return IsDepthMaskedOut(context->getState().getDepthStencilState());
case GL_STENCIL: case GL_STENCIL:
......
...@@ -132,8 +132,8 @@ class State : angle::NonCopyable ...@@ -132,8 +132,8 @@ class State : angle::NonCopyable
bool allActiveDrawBufferChannelsMasked() const; bool allActiveDrawBufferChannelsMasked() const;
bool anyActiveDrawBufferChannelMasked() const; bool anyActiveDrawBufferChannelMasked() const;
const RasterizerState &getRasterizerState() const; const RasterizerState &getRasterizerState() const;
const BlendState &getBlendState() const { return mBlendState; } const BlendState &getBlendState() const { return mBlendStateArray[0]; }
const BlendStateExt &getBlendStateExt() const { return mBlendStateExt; } const BlendStateArray &getBlendStateArray() const { return mBlendStateArray; }
const DepthStencilState &getDepthStencilState() const; const DepthStencilState &getDepthStencilState() const;
// Clear behavior setters & state parameter block generation function // Clear behavior setters & state parameter block generation function
...@@ -173,11 +173,11 @@ class State : angle::NonCopyable ...@@ -173,11 +173,11 @@ class State : angle::NonCopyable
float getFarPlane() const { return mFarZ; } float getFarPlane() const { return mFarZ; }
// Blend state manipulation // Blend state manipulation
bool isBlendEnabled() const { return mBlendStateExt.mEnabledMask.test(0); } bool isBlendEnabled() const { return mBlendStateArray[0].blend; }
bool isBlendEnabledIndexed(GLuint index) const bool isBlendEnabledIndexed(GLuint index) const
{ {
ASSERT(static_cast<size_t>(index) < mBlendStateExt.mMaxDrawBuffers); ASSERT(index < mBlendStateArray.size());
return mBlendStateExt.mEnabledMask.test(index); return mBlendStateArray[index].blend;
} }
DrawBufferMask getBlendEnabledDrawBufferMask() const { return mBlendStateExt.mEnabledMask; } DrawBufferMask getBlendEnabledDrawBufferMask() const { return mBlendStateExt.mEnabledMask; }
void setBlend(bool enabled); void setBlend(bool enabled);
...@@ -790,6 +790,8 @@ class State : angle::NonCopyable ...@@ -790,6 +790,8 @@ class State : angle::NonCopyable
bool isEarlyFragmentTestsOptimizationAllowed() const { return isSampleCoverageEnabled(); } bool isEarlyFragmentTestsOptimizationAllowed() const { return isSampleCoverageEnabled(); }
const BlendStateExt &getBlendStateExt() const { return mBlendStateExt; }
private: private:
friend class Context; friend class Context;
...@@ -888,7 +890,7 @@ class State : angle::NonCopyable ...@@ -888,7 +890,7 @@ class State : angle::NonCopyable
bool mScissorTest; bool mScissorTest;
Rectangle mScissor; Rectangle mScissor;
BlendState mBlendState; // Buffer zero blend state legacy struct BlendStateArray mBlendStateArray;
BlendStateExt mBlendStateExt; BlendStateExt mBlendStateExt;
ColorF mBlendColor; ColorF mBlendColor;
bool mSampleAlphaToCoverage; bool mSampleAlphaToCoverage;
......
...@@ -171,6 +171,8 @@ struct BlendState final ...@@ -171,6 +171,8 @@ struct BlendState final
bool operator==(const BlendState &a, const BlendState &b); bool operator==(const BlendState &a, const BlendState &b);
bool operator!=(const BlendState &a, const BlendState &b); bool operator!=(const BlendState &a, const BlendState &b);
using BlendStateArray = std::array<BlendState, IMPLEMENTATION_MAX_DRAW_BUFFERS>;
struct DepthStencilState final struct DepthStencilState final
{ {
// This will zero-initialize the struct, including padding. // This will zero-initialize the struct, including padding.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment