Vulkan: Edge case test and fix for alpha channel masks
The contextVk color mask needed to be updated when we
were syncing the state of the framebufferVk to make sure
the right mask gets applied in the test described in
ClearTest.cpp
Bug: angleproject:2685
Bug: angleproject:2597
Change-Id: I575028aad4cd495bf4ec1484cc870940dcde92d5
Reviewed-on: https://chromium-review.googlesource.com/1112038
Commit-Queue: Luc Ferron <lucferron@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp
index 70d67ed..12902e1 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
@@ -378,7 +378,7 @@
UNIMPLEMENTED();
}
-void ContextVk::updateClearColorMask(const gl::BlendState &blendState)
+void ContextVk::updateColorMask(const gl::BlendState &blendState)
{
mClearColorMask =
gl_vk::GetColorComponentFlags(blendState.colorMaskRed, blendState.colorMaskGreen,
@@ -444,7 +444,7 @@
mPipelineDesc->updateBlendEquations(glState.getBlendState());
break;
case gl::State::DIRTY_BIT_COLOR_MASK:
- updateClearColorMask(glState.getBlendState());
+ updateColorMask(glState.getBlendState());
break;
case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED:
WARN() << "DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED unimplemented";
@@ -555,7 +555,7 @@
WARN() << "DIRTY_BIT_READ_FRAMEBUFFER_BINDING unimplemented";
break;
case gl::State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING:
- updateClearColorMask(glState.getBlendState());
+ updateColorMask(glState.getBlendState());
break;
case gl::State::DIRTY_BIT_RENDERBUFFER_BINDING:
WARN() << "DIRTY_BIT_RENDERBUFFER_BINDING unimplemented";
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.h b/src/libANGLE/renderer/vulkan/ContextVk.h
index df4642e..f02b123 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.h
+++ b/src/libANGLE/renderer/vulkan/ContextVk.h
@@ -163,6 +163,7 @@
gl::Error getIncompleteTexture(const gl::Context *context,
gl::TextureType type,
gl::Texture **textureOut);
+ void updateColorMask(const gl::BlendState &blendState);
private:
gl::Error initPipeline();
@@ -171,7 +172,6 @@
vk::CommandBuffer **commandBufferOut,
bool *shouldApplyVertexArrayOut);
- void updateClearColorMask(const gl::BlendState &blendState);
void updateScissor(const gl::State &glState);
RendererVk *mRenderer;
diff --git a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
index e5f2873..33ea773 100644
--- a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
+++ b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
@@ -390,13 +390,12 @@
colorIndex, emulatedFormat.redBits > 0, emulatedFormat.greenBits > 0,
emulatedFormat.blueBits > 0, emulatedFormat.alphaBits > 0);
- // TODO(lucferron): Add a test to trigger edge case where the framebuffer
- // attachment would change but not the binding.
- // http://anglebug.com/2597
const angle::Format &sourceFormat =
renderTarget->getImageFormat().angleFormat();
mEmulatedAlphaAttachmentMask.set(
colorIndex, sourceFormat.alphaBits == 0 && emulatedFormat.alphaBits > 0);
+
+ contextVk->updateColorMask(context->getGLState().getBlendState());
}
else
{