@@ -308,7 +308,7 @@ FramebufferVk::FramebufferVk(RendererVk *renderer,
308308 : FramebufferImpl(state),
309309 mBackbuffer (backbuffer),
310310 mFramebuffer(nullptr ),
311- mActiveColorComponents (0 ),
311+ mActiveColorComponentMasksForClear (0 ),
312312 mReadOnlyDepthFeedbackLoopMode(false )
313313{
314314 mReadPixelBuffer .init (renderer, VK_BUFFER_USAGE_TRANSFER_DST_BIT, kReadPixelsBufferAlignment ,
@@ -433,8 +433,8 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
433433 // Adjust clear behavior based on whether the respective attachments are present; if asked to
434434 // clear a non-existent attachment, don't attempt to clear it.
435435
436- VkColorComponentFlags colorMaskFlags = contextVk->getClearColorMask ();
437- bool clearColor = clearColorBuffers.any ();
436+ gl::BlendStateExt::ColorMaskStorage::Type colorMasks = contextVk->getClearColorMasks ();
437+ bool clearColor = clearColorBuffers.any ();
438438
439439 const gl::FramebufferAttachment *depthAttachment = mState .getDepthAttachment ();
440440 clearDepth = clearDepth && depthAttachment;
@@ -448,7 +448,7 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
448448 static_cast <uint8_t >(contextVk->getState ().getDepthStencilState ().stencilWritemask );
449449
450450 // The front-end should ensure we don't attempt to clear color if all channels are masked.
451- ASSERT (!clearColor || colorMaskFlags != 0 );
451+ ASSERT (!clearColor || colorMasks != 0 );
452452 // The front-end should ensure we don't attempt to clear depth if depth write is disabled.
453453 ASSERT (!clearDepth || contextVk->getState ().getDepthStencilState ().depthMask );
454454 // The front-end should ensure we don't attempt to clear stencil if all bits are masked.
@@ -465,8 +465,8 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
465465
466466 // We can use render pass load ops if clearing depth, unmasked color or unmasked stencil. If
467467 // there's a depth mask, depth clearing is already disabled.
468- bool maskedClearColor =
469- clearColor && ( mActiveColorComponents & colorMaskFlags) != mActiveColorComponents ;
468+ bool maskedClearColor = clearColor && ( mActiveColorComponentMasksForClear & colorMasks) !=
469+ mActiveColorComponentMasksForClear ;
470470 bool maskedClearStencil = clearStencil && stencilMask != 0xFF ;
471471
472472 bool clearColorWithRenderPassLoadOp = clearColor && !maskedClearColor && !scissoredClear;
@@ -559,7 +559,7 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
559559 // The most costly clear mode is when we need to mask out specific color channels or stencil
560560 // bits. This can only be done with a draw call.
561561 return clearWithDraw (contextVk, scissoredRenderArea, clearColorBuffers, clearDepth,
562- clearStencil, colorMaskFlags , stencilMask, clearColorValue,
562+ clearStencil, colorMasks , stencilMask, clearColorValue,
563563 clearDepthStencilValue);
564564}
565565
@@ -1551,7 +1551,7 @@ angle::Result FramebufferVk::updateColorAttachment(const gl::Context *context,
15511551 mEmulatedAlphaAttachmentMask .set (colorIndexGL,
15521552 sourceFormat.alphaBits == 0 && actualFormat.alphaBits > 0 );
15531553
1554- contextVk->updateColorMask (context->getState ().getBlendState ());
1554+ contextVk->updateColorMasks (context->getState ().getBlendStateExt ());
15551555
15561556 if (deferClears && mState .getEnabledDrawBuffers ().test (colorIndexGL))
15571557 {
@@ -1722,7 +1722,7 @@ angle::Result FramebufferVk::syncState(const gl::Context *context,
17221722
17231723 if (shouldUpdateColorMask)
17241724 {
1725- contextVk->updateColorMask (context->getState ().getBlendState ());
1725+ contextVk->updateColorMasks (context->getState ().getBlendStateExt ());
17261726 }
17271727
17281728 // In some cases we'll need to force a flush of deferred clears. When we're syncing the read
@@ -1752,10 +1752,6 @@ angle::Result FramebufferVk::syncState(const gl::Context *context,
17521752 const gl::State &glState = context->getState ();
17531753 ANGLE_TRY (contextVk->updateScissor (glState));
17541754
1755- mActiveColorComponents = gl_vk::GetColorComponentFlags (
1756- mActiveColorComponentMasksForClear [0 ].any (), mActiveColorComponentMasksForClear [1 ].any (),
1757- mActiveColorComponentMasksForClear [2 ].any (), mActiveColorComponentMasksForClear [3 ].any ());
1758-
17591755 if (command != gl::Command::Blit)
17601756 {
17611757 // Don't end the render pass when handling a blit to resolve, since we may be able to
@@ -2011,7 +2007,7 @@ angle::Result FramebufferVk::clearWithDraw(ContextVk *contextVk,
20112007 gl::DrawBufferMask clearColorBuffers,
20122008 bool clearDepth,
20132009 bool clearStencil,
2014- VkColorComponentFlags colorMaskFlags ,
2010+ gl::BlendStateExt::ColorMaskStorage::Type colorMasks ,
20152011 uint8_t stencilMask,
20162012 const VkClearColorValue &clearColorValue,
20172013 const VkClearDepthStencilValue &clearDepthStencilValue)
@@ -2048,7 +2044,8 @@ angle::Result FramebufferVk::clearWithDraw(ContextVk *contextVk,
20482044 params.colorFormat =
20492045 &colorRenderTarget->getImageForRenderPass ().getFormat ().actualImageFormat ();
20502046 params.colorAttachmentIndexGL = static_cast <uint32_t >(colorIndexGL);
2051- params.colorMaskFlags = colorMaskFlags;
2047+ params.colorMaskFlags =
2048+ gl::BlendStateExt::ColorMaskStorage::GetValueIndexed (colorIndexGL, colorMasks);
20522049 if (mEmulatedAlphaAttachmentMask [colorIndexGL])
20532050 {
20542051 params.colorMaskFlags &= ~VK_COLOR_COMPONENT_A_BIT;
@@ -2535,10 +2532,9 @@ void FramebufferVk::restoreDepthStencilDefinedContents()
25352532
25362533void FramebufferVk::updateActiveColorMasks (size_t colorIndexGL, bool r, bool g, bool b, bool a)
25372534{
2538- mActiveColorComponentMasksForClear [0 ].set (colorIndexGL, r);
2539- mActiveColorComponentMasksForClear [1 ].set (colorIndexGL, g);
2540- mActiveColorComponentMasksForClear [2 ].set (colorIndexGL, b);
2541- mActiveColorComponentMasksForClear [3 ].set (colorIndexGL, a);
2535+ gl::BlendStateExt::ColorMaskStorage::SetValueIndexed (
2536+ colorIndexGL, gl::BlendStateExt::PackColorMask (r, g, b, a),
2537+ &mActiveColorComponentMasksForClear );
25422538}
25432539
25442540const gl::DrawBufferMask &FramebufferVk::getEmulatedAlphaAttachmentMask () const
0 commit comments