@@ -499,6 +499,46 @@ TEST_P(VulkanPerformanceCounterTest, SwapShouldInvalidateDepthAfterClear)
499499 EXPECT_EQ (expectedDepthClears, actualDepthClears);
500500}
501501
502+ // Tests that masked color clears don't break the RP.
503+ TEST_P (VulkanPerformanceCounterTest, MaskedClearDoesNotBreakRenderPass)
504+ {
505+ const rx::vk::PerfCounters &counters = hackANGLE ();
506+
507+ GLTexture texture;
508+ glBindTexture (GL_TEXTURE_2D, texture);
509+ glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA, 256 , 256 , 0 , GL_RGBA, GL_UNSIGNED_BYTE, nullptr );
510+
511+ GLFramebuffer framebuffer;
512+ glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
513+ glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0 );
514+ ASSERT_GL_FRAMEBUFFER_COMPLETE (GL_FRAMEBUFFER);
515+ ASSERT_GL_NO_ERROR ();
516+
517+ uint32_t expectedRenderPassCount = counters.renderPasses + 1 ;
518+
519+ // Mask color channels and clear the framebuffer multiple times.
520+ glClearColor (0 .25f , 0 .25f , 0 .25f , 0 .25f );
521+ glColorMask (GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE);
522+ glClear (GL_COLOR_BUFFER_BIT);
523+
524+ glClearColor (0 .5f , 0 .5f , 0 .5f , 0 .5f );
525+ glColorMask (GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE);
526+ glClear (GL_COLOR_BUFFER_BIT);
527+
528+ glClearColor (1 .0f , 1 .0f , 1 .0f , 1 .0f );
529+ glColorMask (GL_FALSE, GL_FALSE, GL_TRUE, GL_FALSE);
530+ glClear (GL_COLOR_BUFFER_BIT);
531+
532+ glClearColor (0 .75f , 0 .75f , 0 .75f , 0 .75f );
533+ glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
534+ glClear (GL_COLOR_BUFFER_BIT);
535+
536+ uint32_t actualRenderPassCount = counters.renderPasses ;
537+ EXPECT_EQ (expectedRenderPassCount, actualRenderPassCount);
538+
539+ EXPECT_PIXEL_NEAR (0 , 0 , 63 , 127 , 255 , 191 , 1 );
540+ }
541+
502542ANGLE_INSTANTIATE_TEST (VulkanPerformanceCounterTest, ES3_VULKAN());
503543ANGLE_INSTANTIATE_TEST (VulkanPerformanceCounterTest_ES31, ES31_VULKAN());
504544
0 commit comments