Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit dd196e0

Browse files
lucferronCommit Bot
authored andcommitted
Vulkan: Implement color mask and depth mask bits
These two features are heavily used in the functional.depth_stencil_clear.* dEQP tests. Enable a bunch of color/depth/stencil clear tests, however there is still 2 tests in particular that are giving me trouble. I will work on them separately in a subsequent change. Bug: angleproject:2443 Bug: angleproject:2455 Change-Id: Ic93420c7b525b424e9641f78265e264ddb163ab1 Reviewed-on: https://chromium-review.googlesource.com/996035 Commit-Queue: Luc Ferron <[email protected]> Reviewed-by: Jamie Madill <[email protected]>
1 parent 5fec7ab commit dd196e0

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

src/libANGLE/renderer/vulkan/ContextVk.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ void ContextVk::syncState(const gl::Context *context, const gl::State::DirtyBits
521521
mPipelineDesc->updateBlendEquations(glState.getBlendState());
522522
break;
523523
case gl::State::DIRTY_BIT_COLOR_MASK:
524-
WARN() << "DIRTY_BIT_COLOR_MASK unimplemented";
524+
mPipelineDesc->updateColorWriteMask(glState.getBlendState());
525525
break;
526526
case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED:
527527
WARN() << "DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED unimplemented";
@@ -545,7 +545,7 @@ void ContextVk::syncState(const gl::Context *context, const gl::State::DirtyBits
545545
mPipelineDesc->updateDepthFunc(glState.getDepthStencilState());
546546
break;
547547
case gl::State::DIRTY_BIT_DEPTH_MASK:
548-
WARN() << "DIRTY_BIT_DEPTH_MASK unimplemented";
548+
mPipelineDesc->updateDepthWriteEnabled(glState.getDepthStencilState());
549549
break;
550550
case gl::State::DIRTY_BIT_STENCIL_TEST_ENABLED:
551551
mPipelineDesc->updateStencilTestEnabled(glState.getDepthStencilState());

src/libANGLE/renderer/vulkan/vk_cache_utils.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,19 @@ void PipelineDesc::updateBlendFuncs(const gl::BlendState &blendState)
724724
}
725725
}
726726

727+
void PipelineDesc::updateColorWriteMask(const gl::BlendState &blendState)
728+
{
729+
for (auto &blendAttachmentState : mColorBlendStateInfo.attachments)
730+
{
731+
int colorMask = blendState.colorMaskRed ? VK_COLOR_COMPONENT_R_BIT : 0;
732+
colorMask |= blendState.colorMaskGreen ? VK_COLOR_COMPONENT_G_BIT : 0;
733+
colorMask |= blendState.colorMaskBlue ? VK_COLOR_COMPONENT_B_BIT : 0;
734+
colorMask |= blendState.colorMaskAlpha ? VK_COLOR_COMPONENT_A_BIT : 0;
735+
736+
blendAttachmentState.colorWriteMask = static_cast<uint8_t>(colorMask);
737+
}
738+
}
739+
727740
void PipelineDesc::updateDepthTestEnabled(const gl::DepthStencilState &depthStencilState)
728741
{
729742
mDepthStencilStateInfo.depthTestEnable = static_cast<uint8_t>(depthStencilState.depthTest);
@@ -734,6 +747,11 @@ void PipelineDesc::updateDepthFunc(const gl::DepthStencilState &depthStencilStat
734747
mDepthStencilStateInfo.depthCompareOp = PackGLCompareFunc(depthStencilState.depthFunc);
735748
}
736749

750+
void PipelineDesc::updateDepthWriteEnabled(const gl::DepthStencilState &depthStencilState)
751+
{
752+
mDepthStencilStateInfo.depthWriteEnable = (depthStencilState.depthMask == GL_FALSE ? 0 : 1);
753+
}
754+
737755
void PipelineDesc::updateStencilTestEnabled(const gl::DepthStencilState &depthStencilState)
738756
{
739757
mDepthStencilStateInfo.stencilTestEnable = static_cast<uint8_t>(depthStencilState.stencilTest);

src/libANGLE/renderer/vulkan/vk_cache_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,12 @@ class PipelineDesc final
297297
void updateBlendColor(const gl::ColorF &color);
298298
void updateBlendFuncs(const gl::BlendState &blend_state);
299299
void updateBlendEquations(const gl::BlendState &blend_state);
300+
void updateColorWriteMask(const gl::BlendState &blendState);
300301

301302
// Depth/stencil states.
302303
void updateDepthTestEnabled(const gl::DepthStencilState &depthStencilState);
303304
void updateDepthFunc(const gl::DepthStencilState &depthStencilState);
305+
void updateDepthWriteEnabled(const gl::DepthStencilState &depthStencilState);
304306
void updateStencilTestEnabled(const gl::DepthStencilState &depthStencilState);
305307
void updateStencilFrontFuncs(GLint ref, const gl::DepthStencilState &depthStencilState);
306308
void updateStencilBackFuncs(GLint ref, const gl::DepthStencilState &depthStencilState);

src/tests/deqp_support/deqp_gles2_test_expectations.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@
188188
1028 WIN LINUX MAC : dEQP-GLES2.functional.fbo.completeness.renderable.texture.depth.srgb8 = FAIL
189189

190190
// Vulkan failures
191-
2161 VULKAN : dEQP-GLES2.functional.color_clear.masked_* = SKIP
191+
2455 VULKAN : dEQP-GLES2.functional.color_clear.masked_scissor* = SKIP
192192
2161 VULKAN : dEQP-GLES2.functional.color_clear.complex_* = SKIP
193193
2161 VULKAN : dEQP-GLES2.functional.color_clear.long_masked_* = SKIP
194194
2161 VULKAN : dEQP-GLES2.functional.prerequisite.* = SKIP
195195
2161 VULKAN : dEQP-GLES2.functional.implementation_limits.* = SKIP
196-
2161 VULKAN : dEQP-GLES2.functional.depth_stencil_clear.* = SKIP
196+
2161 VULKAN : dEQP-GLES2.functional.depth_stencil_clear.depth_stencil = SKIP
197197
2161 VULKAN : dEQP-GLES2.functional.buffer.* = SKIP
198198
2161 VULKAN : dEQP-GLES2.functional.light_amount.* = SKIP
199199
2161 VULKAN : dEQP-GLES2.functional.shaders.* = SKIP

0 commit comments

Comments
 (0)