Commit c746ac65 by Alexey Knyazev Committed by Commit Bot

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/+/2169093Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Kenneth Russell <kbr@chromium.org>
parent d3d7b95b
...@@ -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 BlendState &blend) bool IsColorMaskedOut(const BlendStateExt &blendStateExt, const GLint drawbuffer)
{ {
return (!blend.colorMaskRed && !blend.colorMaskGreen && !blend.colorMaskBlue && ASSERT(static_cast<size_t>(drawbuffer) < blendStateExt.mMaxDrawBuffers);
!blend.colorMaskAlpha); return blendStateExt.getColorMaskIndexed(static_cast<size_t>(drawbuffer)) == 0;
} }
bool IsDepthMaskedOut(const DepthStencilState &depthStencil) bool IsDepthMaskedOut(const DepthStencilState &depthStencil)
...@@ -284,9 +284,7 @@ bool IsClearBufferMaskedOut(const Context *context, GLenum buffer, GLint drawbuf ...@@ -284,9 +284,7 @@ bool IsClearBufferMaskedOut(const Context *context, GLenum buffer, GLint drawbuf
switch (buffer) switch (buffer)
{ {
case GL_COLOR: case GL_COLOR:
ASSERT(static_cast<size_t>(drawbuffer) < return IsColorMaskedOut(context->getState().getBlendStateExt(), 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:
......
...@@ -125,8 +125,8 @@ class State : angle::NonCopyable ...@@ -125,8 +125,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 mBlendStateArray[0]; } const BlendState &getBlendState() const { return mBlendState; }
const BlendStateArray &getBlendStateArray() const { return mBlendStateArray; } const BlendStateExt &getBlendStateExt() const { return mBlendStateExt; }
const DepthStencilState &getDepthStencilState() const; const DepthStencilState &getDepthStencilState() const;
// Clear behavior setters & state parameter block generation function // Clear behavior setters & state parameter block generation function
...@@ -166,11 +166,11 @@ class State : angle::NonCopyable ...@@ -166,11 +166,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 mBlendStateArray[0].blend; } bool isBlendEnabled() const { return mBlendStateExt.mEnabledMask.test(0); }
bool isBlendEnabledIndexed(GLuint index) const bool isBlendEnabledIndexed(GLuint index) const
{ {
ASSERT(index < mBlendStateArray.size()); ASSERT(static_cast<size_t>(index) < mBlendStateExt.mMaxDrawBuffers);
return mBlendStateArray[index].blend; return mBlendStateExt.mEnabledMask.test(index);
} }
DrawBufferMask getBlendEnabledDrawBufferMask() const { return mBlendStateExt.mEnabledMask; } DrawBufferMask getBlendEnabledDrawBufferMask() const { return mBlendStateExt.mEnabledMask; }
void setBlend(bool enabled); void setBlend(bool enabled);
...@@ -783,8 +783,6 @@ class State : angle::NonCopyable ...@@ -783,8 +783,6 @@ 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;
...@@ -879,7 +877,7 @@ class State : angle::NonCopyable ...@@ -879,7 +877,7 @@ class State : angle::NonCopyable
bool mScissorTest; bool mScissorTest;
Rectangle mScissor; Rectangle mScissor;
BlendStateArray mBlendStateArray; BlendState mBlendState; // Buffer zero blend state legacy struct
BlendStateExt mBlendStateExt; BlendStateExt mBlendStateExt;
ColorF mBlendColor; ColorF mBlendColor;
bool mSampleAlphaToCoverage; bool mSampleAlphaToCoverage;
......
...@@ -171,8 +171,6 @@ struct BlendState final ...@@ -171,8 +171,6 @@ 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