src/third_party/angle/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp
TEST_P(VulkanPerformanceCounterTest, InvalidateDrawAndDeleteRenderbuffer)
{
    const rx::vk::PerfCounters &counters = hackANGLE();
    rx::vk::PerfCounters expected;

    // Expect rpCount+1, depth(Clears+1, Loads+0, Stores+1), stencil(Clears+0, Load+0, Stores+0)
    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;
    {
        // Declare the RAII-based GLRenderbuffer object within this set of curly braces, so that it
        // will be deleted early (at the close-curly-brace)
        GLRenderbuffer renderbuffer;
        setupClearAndDrawForInvalidateTest(&program, &framebuffer, &texture, &renderbuffer, false);

        // Invalidate (storeOp = DONT_CARE; mContentDefined = false)
        const GLenum discards[] = {GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
        glInvalidateFramebuffer(GL_FRAMEBUFFER, 2, discards);
        ASSERT_GL_NO_ERROR();

        // Draw (since enabled, should result: in storeOp = STORE; mContentDefined = true)
        drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f);
        ASSERT_GL_NO_ERROR();

        // Ensure that the render pass wasn't broken
        EXPECT_EQ(expected.renderPasses, counters.renderPasses);
    }

    // The renderbuffer should now be deleted.

    // Use swapBuffers and then check how many loads and stores were actually done
    swapBuffers();
    compareDepthStencilCountersForInvalidateTest(counters, expected);

    // Start and end another render pass, to check that the load ops are as expected
    setAndIncrementLoadCountersForInvalidateTest(counters, 0, 0, &expected);
    drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f);
    ASSERT_GL_NO_ERROR();
    swapBuffers();
    compareLoadCountersForInvalidateTest(counters, expected);
}
// Tests that a GLRenderbuffer can be deleted before the render pass ends, and that everything
// still works.
//
// - Scenario: invalidate
Tests that a GLRenderbuffer can be deleted before the render pass ends, and that everything
still works.

invalidate
Tests that a GLRenderbuffer can be deleted before the render pass ends and that everything still works . invalidate
TEST_P(VulkanPerformanceCounterTest, InvalidateDrawAndDeleteRenderbuffer)
{
    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);
        const GLenum discards[] = {GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
        glInvalidateFramebuffer(GL_FRAMEBUFFER, 2, discards);
        ASSERT_GL_NO_ERROR();
        drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f);
        ASSERT_GL_NO_ERROR();
        EXPECT_EQ(expected.renderPasses, counters.renderPasses);
    }
    swapBuffers();
    compareDepthStencilCountersForInvalidateTest(counters, expected);
    setAndIncrementLoadCountersForInvalidateTest(counters, 0, 0, &expected);
    drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f);
    ASSERT_GL_NO_ERROR();
    swapBuffers();
    compareLoadCountersForInvalidateTest(counters, expected);
}
TEST_P ( VulkanPerformanceCounterTest , InvalidateDrawAndDeleteRenderbuffer ) { 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 ) ; const GLenum discards [ ] = { GL_DEPTH_ATTACHMENT , GL_STENCIL_ATTACHMENT } ; glInvalidateFramebuffer ( GL_FRAMEBUFFER , 2 , discards ) ; ASSERT_GL_NO_ERROR ( ) ; drawQuad ( program , essl1_shaders :: PositionAttrib ( ) , 0.5f ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_EQ ( expected . renderPasses , counters . renderPasses ) ; } swapBuffers ( ) ; compareDepthStencilCountersForInvalidateTest ( counters , expected ) ; setAndIncrementLoadCountersForInvalidateTest ( counters , 0 , 0 , & expected ) ; drawQuad ( program , essl1_shaders :: PositionAttrib ( ) , 0.5f ) ; ASSERT_GL_NO_ERROR ( ) ; swapBuffers ( ) ; compareLoadCountersForInvalidateTest ( counters , expected ) ; }
Tests that a GLRenderbuffer can be deleted before the render pass ends, and that everything
still works.
Tests that a GLRenderbuffer can be deleted before the render pass ends and that everything still works .
// Expect rpCount+1, depth(Clears+1, Loads+0, Stores+1), stencil(Clears+0, Load+0, Stores+0) // Declare the RAII-based GLRenderbuffer object within this set of curly braces, so that it // will be deleted early (at the close-curly-brace) // Invalidate (storeOp = DONT_CARE; mContentDefined = false) // Draw (since enabled, should result: in storeOp = STORE; mContentDefined = true) // Ensure that the render pass wasn't broken // The renderbuffer should now be deleted. // Use swapBuffers and then check how many loads and stores were actually done // Start and end another render pass, to check that the load ops are as expected