src/third_party/angle/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp
// Tests that the draw path for clear after invalidate and disabling depth/stencil test keeps
// content stored.
Tests that the draw path for clear after invalidate and disabling depth/stencil test keeps
content stored.
Tests that the draw path for clear after invalidate and disabling depth / stencil test keeps content stored .
TEST_P(VulkanPerformanceCounterTest, InvalidateAndMaskedClear)
{
    const rx::vk::PerfCounters &counters = hackANGLE();
    rx::vk::PerfCounters expected;
    setExpectedCountersForInvalidateTest(counters, 1, 1, 0, 1, 1, 0, 1, &expected);
    ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::Red());
    GLFramebuffer framebuffer;
    GLTexture texture;
    GLRenderbuffer renderbuffer;
    setupClearAndDrawForInvalidateTest(&program, &framebuffer, &texture, &renderbuffer, true);
    const GLenum discards[] = {GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
    glInvalidateFramebuffer(GL_FRAMEBUFFER, 2, discards);
    ASSERT_GL_NO_ERROR();
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_STENCIL_TEST);
    glDepthMask(GL_TRUE);
    glStencilMask(0xF0);
    glEnable(GL_SCISSOR_TEST);
    glScissor(kInvalidateTestSize / 4, kInvalidateTestSize / 4, kInvalidateTestSize / 2,
              kInvalidateTestSize / 2);
    glClearDepthf(1.0f);
    glClearStencil(0x55);
    glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    ASSERT_GL_NO_ERROR();
    swapBuffers();
    compareDepthStencilCountersForInvalidateTest(counters, expected);
    setExpectedCountersForInvalidateTest(counters, 0, 0, 1, 1, 0, 1, 1, &expected);
    glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);
    glEnable(GL_STENCIL_TEST);
    glStencilFunc(GL_EQUAL, 0x50, 0xF0);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
    glStencilMask(0xFF);
    ANGLE_GL_PROGRAM(blueProgram, essl1_shaders::vs::Simple(), essl1_shaders::fs::Blue());
    drawQuad(blueProgram, essl1_shaders::PositionAttrib(), 0.95f);
    EXPECT_PIXEL_COLOR_EQ(kInvalidateTestSize / 2, kInvalidateTestSize / 2, GLColor::blue);
    compareDepthStencilCountersForInvalidateTest(counters, expected);
}
TEST_P ( VulkanPerformanceCounterTest , InvalidateAndMaskedClear ) { const rx :: vk :: PerfCounters & counters = hackANGLE ( ) ; rx :: vk :: PerfCounters expected ; setExpectedCountersForInvalidateTest ( counters , 1 , 1 , 0 , 1 , 1 , 0 , 1 , & expected ) ; ANGLE_GL_PROGRAM ( program , essl1_shaders :: vs :: Simple ( ) , essl1_shaders :: fs :: Red ( ) ) ; GLFramebuffer framebuffer ; GLTexture texture ; GLRenderbuffer renderbuffer ; setupClearAndDrawForInvalidateTest ( & program , & framebuffer , & texture , & renderbuffer , true ) ; const GLenum discards [ ] = { GL_DEPTH_ATTACHMENT , GL_STENCIL_ATTACHMENT } ; glInvalidateFramebuffer ( GL_FRAMEBUFFER , 2 , discards ) ; ASSERT_GL_NO_ERROR ( ) ; glDisable ( GL_DEPTH_TEST ) ; glDisable ( GL_STENCIL_TEST ) ; glDepthMask ( GL_TRUE ) ; glStencilMask ( 0xF0 ) ; glEnable ( GL_SCISSOR_TEST ) ; glScissor ( kInvalidateTestSize / 4 , kInvalidateTestSize / 4 , kInvalidateTestSize / 2 , kInvalidateTestSize / 2 ) ; glClearDepthf ( 1.0f ) ; glClearStencil ( 0x55 ) ; glClear ( GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ) ; ASSERT_GL_NO_ERROR ( ) ; swapBuffers ( ) ; compareDepthStencilCountersForInvalidateTest ( counters , expected ) ; setExpectedCountersForInvalidateTest ( counters , 0 , 0 , 1 , 1 , 0 , 1 , 1 , & expected ) ; glBindFramebuffer ( GL_FRAMEBUFFER , framebuffer ) ; glEnable ( GL_DEPTH_TEST ) ; glDepthFunc ( GL_LESS ) ; glEnable ( GL_STENCIL_TEST ) ; glStencilFunc ( GL_EQUAL , 0x50 , 0xF0 ) ; glStencilOp ( GL_KEEP , GL_KEEP , GL_KEEP ) ; glStencilMask ( 0xFF ) ; ANGLE_GL_PROGRAM ( blueProgram , essl1_shaders :: vs :: Simple ( ) , essl1_shaders :: fs :: Blue ( ) ) ; drawQuad ( blueProgram , essl1_shaders :: PositionAttrib ( ) , 0.95f ) ; EXPECT_PIXEL_COLOR_EQ ( kInvalidateTestSize / 2 , kInvalidateTestSize / 2 , GLColor :: blue ) ; compareDepthStencilCountersForInvalidateTest ( counters , expected ) ; }
Tests that the draw path for clear after invalidate and disabling depth/stencil test keeps
content stored.
Tests that the draw path for clear after invalidate and disabling depth / stencil test keeps content stored .
// Expect rpCount+1, depth(Clears+1, Loads+0, Stores+1), stencil(Clears+1, Load+0, Stores+1) // Invalidate (should result: in storeOp = DONT_CARE; mContentDefined = false) // Disable depth/stencil test but make stencil masked // Enable scissor for the draw path to be taken. // Do in-renderpass clear. This should result in StoreOp=STORE // Use swapBuffers and then check how many loads and stores were actually done // Expect rpCount+1, depth(Clears+0, Loads+1, Stores+1), stencil(Clears+0, Load+1, Stores+1) // Bind FBO again and try to use the depth buffer without clear. This should result in // loadOp=LOAD and StoreOP=STORE