src/third_party/angle/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp
// Tests that an in renderpass clear after invalidate keeps content stored.
Tests that an in renderpass clear after invalidate keeps content stored.
Tests that an in renderpass clear after invalidate keeps content stored .
TEST_P(VulkanPerformanceCounterTest, InvalidateAndClear)
{
    const rx::vk::PerfCounters &counters = hackANGLE();
    rx::vk::PerfCounters expected;
    setExpectedCountersForInvalidateTest(counters, 1, 1, 0, 1, 0, 0, 0, &expected);
    ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::Red());
    GLFramebuffer framebuffer;
    GLTexture texture;
    GLRenderbuffer renderbuffer;
    setupClearAndDrawForInvalidateTest(&program, &framebuffer, &texture, &renderbuffer, false);
    glDisable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    const GLenum discards[] = {GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
    glInvalidateFramebuffer(GL_FRAMEBUFFER, 2, discards);
    ASSERT_GL_NO_ERROR();
    glClearDepthf(1.0f);
    glClear(GL_DEPTH_BUFFER_BIT);
    ASSERT_GL_NO_ERROR();
    swapBuffers();
    compareDepthStencilCountersForInvalidateTest(counters, expected);
    setExpectedCountersForInvalidateTest(counters, 0, 0, 1, 1, 0, 0, 0, &expected);
    glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);
    glDisable(GL_STENCIL_TEST);
    ANGLE_GL_PROGRAM(blueProgram, essl1_shaders::vs::Simple(), essl1_shaders::fs::Blue());
    drawQuad(blueProgram, essl1_shaders::PositionAttrib(), 0.5f);
    EXPECT_PIXEL_COLOR_EQ(kInvalidateTestSize / 2, kInvalidateTestSize / 2, GLColor::blue);
    compareDepthStencilCountersForInvalidateTest(counters, expected);
}
TEST_P ( VulkanPerformanceCounterTest , InvalidateAndClear ) { const rx :: vk :: PerfCounters & counters = hackANGLE ( ) ; rx :: vk :: PerfCounters expected ; setExpectedCountersForInvalidateTest ( counters , 1 , 1 , 0 , 1 , 0 , 0 , 0 , & expected ) ; ANGLE_GL_PROGRAM ( program , essl1_shaders :: vs :: Simple ( ) , essl1_shaders :: fs :: Red ( ) ) ; GLFramebuffer framebuffer ; GLTexture texture ; GLRenderbuffer renderbuffer ; setupClearAndDrawForInvalidateTest ( & program , & framebuffer , & texture , & renderbuffer , false ) ; glDisable ( GL_DEPTH_TEST ) ; glDepthMask ( GL_TRUE ) ; const GLenum discards [ ] = { GL_DEPTH_ATTACHMENT , GL_STENCIL_ATTACHMENT } ; glInvalidateFramebuffer ( GL_FRAMEBUFFER , 2 , discards ) ; ASSERT_GL_NO_ERROR ( ) ; glClearDepthf ( 1.0f ) ; glClear ( GL_DEPTH_BUFFER_BIT ) ; ASSERT_GL_NO_ERROR ( ) ; swapBuffers ( ) ; compareDepthStencilCountersForInvalidateTest ( counters , expected ) ; setExpectedCountersForInvalidateTest ( counters , 0 , 0 , 1 , 1 , 0 , 0 , 0 , & expected ) ; glBindFramebuffer ( GL_FRAMEBUFFER , framebuffer ) ; glEnable ( GL_DEPTH_TEST ) ; glDepthFunc ( GL_LESS ) ; glDisable ( GL_STENCIL_TEST ) ; ANGLE_GL_PROGRAM ( blueProgram , essl1_shaders :: vs :: Simple ( ) , essl1_shaders :: fs :: Blue ( ) ) ; drawQuad ( blueProgram , essl1_shaders :: PositionAttrib ( ) , 0.5f ) ; EXPECT_PIXEL_COLOR_EQ ( kInvalidateTestSize / 2 , kInvalidateTestSize / 2 , GLColor :: blue ) ; compareDepthStencilCountersForInvalidateTest ( counters , expected ) ; }
Tests that an in renderpass clear after invalidate keeps content stored.
Tests that an in renderpass clear after invalidate keeps content stored .
// Expect rpCount+1, depth(Clears+1, Loads+0, Stores+1), stencil(Clears+0, Load+0, Stores+0) // Disable depth test but with depth mask enabled so that clear should still work. // Invalidate (should result: in storeOp = DONT_CARE; mContentDefined = false) // Do in-renderpass clear. This should result in StoreOp=STORE; mContentDefined = true. // 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+0, Stores+0) // Bind FBO again and try to use the depth buffer without clear. This should result in // loadOp=LOAD and StoreOP=STORE // Should pass depth test: (0.5+1.0)/2.0=0.75 < 1.0