Commit 1bd71b48 by Shahbaz Youssefi Committed by Commit Bot

Make gl::DrawBufferMask a BitSet8

This shrinks the size of the mask for use in cache key classes. Bug: angleproject:4881 Change-Id: I87c234832c61e6a663c609b7f6da5d69977b21c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2399182Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent fe822457
......@@ -5489,8 +5489,9 @@ angle::Result Program::deserialize(const Context *context,
static_assert(IMPLEMENTATION_MAX_DRAW_BUFFERS * 2 <= 8 * sizeof(uint32_t),
"All bits of mDrawBufferTypeMask and mActiveOutputVariables types and mask fit "
"into 32 bits each");
mState.mDrawBufferTypeMask = gl::ComponentTypeMask(stream.readInt<uint32_t>());
mState.mActiveOutputVariables = stream.readInt<gl::DrawBufferMask>();
mState.mDrawBufferTypeMask = gl::ComponentTypeMask(stream.readInt<uint32_t>());
mState.mActiveOutputVariables =
gl::DrawBufferMask(stream.readInt<gl::DrawBufferMask::value_type>());
unsigned int defaultUniformRangeLow = stream.readInt<unsigned int>();
unsigned int defaultUniformRangeHigh = stream.readInt<unsigned int>();
......
......@@ -405,7 +405,7 @@ using AttributesMask = angle::BitSet<MAX_VERTEX_ATTRIBS>;
using UniformBlockBindingMask = angle::BitSet<IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS>;
// Used in Framebuffer / Program
using DrawBufferMask = angle::BitSet<IMPLEMENTATION_MAX_DRAW_BUFFERS>;
using DrawBufferMask = angle::BitSet8<IMPLEMENTATION_MAX_DRAW_BUFFERS>;
class BlendStateExt final
{
......@@ -498,7 +498,7 @@ class BlendStateExt final
// This calculation could be replaced with a single PEXT instruction from BMI2 set.
diff = ((((diff & 0xFFFF0000) * 0x249) >> 24) & 0xF0) | (((diff * 0x249) >> 12) & 0xF);
return DrawBufferMask(diff);
return DrawBufferMask(static_cast<uint8_t>(diff));
}
// Compare two packed sets of eight 8-bit values and return an 8-bit diff mask.
......@@ -530,7 +530,7 @@ class BlendStateExt final
// This operation could be replaced with a single PEXT instruction from BMI2 set.
diff = 0x0002040810204081 * diff >> 56;
return DrawBufferMask(static_cast<uint32_t>(diff));
return DrawBufferMask(static_cast<uint8_t>(diff));
}
};
......
......@@ -185,7 +185,7 @@ class alignas(4) RenderPassDesc final
// currently not well supported, so ANGLE always takes a fallback path for them. When a resolve
// path is implemented for depth/stencil attachments, another bit must be made free
// (mAttachmentFormats is one element too large, so there are 8 bits there to take).
angle::BitSet8<gl::IMPLEMENTATION_MAX_DRAW_BUFFERS> mColorResolveAttachmentMask;
gl::DrawBufferMask mColorResolveAttachmentMask;
// TODO(syoussefi): to be used to determine which attachments are multisampled-render-to-texture
// that need load. http://anglebug.com/4881
......
......@@ -685,7 +685,7 @@ class ClearValuesArray final
gl::DrawBufferMask getEnabledColorAttachmentsMask() const
{
return gl::DrawBufferMask(mEnabled.to_ulong());
return gl::DrawBufferMask(static_cast<gl::DrawBufferMask::value_type>(mEnabled.to_ulong()));
}
private:
......
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