Commit 6fc22a13 by Courtney Goeltzenleuchter Committed by Commit Bot

Vulkan: Discard scissored clears where scissor is null

If a clear becomes a no-op because the scissor has a width and height of 0, return early and skip the draw. This also works around a driver issue on some devices where it was ignoring a null scissor and drawing the clear anyway. Found with deqp test: adb shell am start -n com.drawelements.deqp/android.app.NativeActivity \ -e cmdLine '"deqp --deqp-case=dEQP-GLES2.functional.color_clear.* \ --deqp-log-filename=/sdcard/dEQP-Log.qpa"' run_angle_end2end_tests --gtest_filter=ClearTest.EmptyScissor/ES2_VULKAN Bug: angleproject:3114 Change-Id: I6cf2716bd93bb332f74b44c7250e363c68cc614f Reviewed-on: https://chromium-review.googlesource.com/c/1436841 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 983e4469
...@@ -641,6 +641,11 @@ angle::Result UtilsVk::clearImage(ContextVk *contextVk, ...@@ -641,6 +641,11 @@ angle::Result UtilsVk::clearImage(ContextVk *contextVk,
VkRect2D scissor; VkRect2D scissor;
const gl::State &glState = contextVk->getState(); const gl::State &glState = contextVk->getState();
gl_vk::GetScissor(glState, invertViewport, renderArea, &scissor); gl_vk::GetScissor(glState, invertViewport, renderArea, &scissor);
// TODO(courtneygo): workaround for scissor issue on some devices. http://anglebug.com/3114
if ((scissor.extent.width == 0) && (scissor.extent.height == 0))
{
return angle::Result::Continue;
}
pipelineDesc.setScissor(scissor); pipelineDesc.setScissor(scissor);
vk::ShaderLibrary &shaderLibrary = renderer->getShaderLibrary(); vk::ShaderLibrary &shaderLibrary = renderer->getShaderLibrary();
......
...@@ -187,6 +187,26 @@ TEST_P(ClearTest, DefaultFramebuffer) ...@@ -187,6 +187,26 @@ TEST_P(ClearTest, DefaultFramebuffer)
EXPECT_PIXEL_NEAR(0, 0, 64, 128, 128, 128, 1.0); EXPECT_PIXEL_NEAR(0, 0, 64, 128, 128, 128, 1.0);
} }
// Test clearing the default framebuffer with scissor and mask
// This forces down path that uses draw to do clear
TEST_P(ClearTest, EmptyScissor)
{
// These configs have bug that fails this test.
// These configs are unmaintained so skipping.
ANGLE_SKIP_TEST_IF(IsIntel() && IsD3D9());
ANGLE_SKIP_TEST_IF(IsOSX());
glClearColor(0.25f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST);
glScissor(-10, 0, 5, 5);
glClearColor(0.5f, 0.25f, 0.75f, 0.5f);
glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
EXPECT_PIXEL_NEAR(0, 0, 64, 128, 128, 255, 1.0);
}
// Test clearing the RGB default framebuffer and verify that the alpha channel is not cleared // Test clearing the RGB default framebuffer and verify that the alpha channel is not cleared
TEST_P(ClearTestRGB, DefaultFramebufferRGB) TEST_P(ClearTestRGB, DefaultFramebufferRGB)
{ {
......
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