src/third_party/angle/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp
// Tests that texture updates to unused textures don't break the RP.
Tests that texture updates to unused textures don't break the RP.
Tests that texture updates to unused textures don ' t break the RP .
TEST_P(VulkanPerformanceCounterTest, NewTextureDoesNotBreakRenderPass)
{
    const rx::vk::PerfCounters &counters = hackANGLE();
    GLColor kInitialData[4] = {GLColor::red, GLColor::blue, GLColor::green, GLColor::yellow};
    GLTexture texture;
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, kInitialData);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    auto quadVerts = GetQuadVertices();
    GLBuffer vertexBuffer;
    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
    glBufferData(GL_ARRAY_BUFFER, quadVerts.size() * sizeof(quadVerts[0]), quadVerts.data(),
                 GL_STATIC_DRAW);
    ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Texture2D(), essl1_shaders::fs::Texture2D());
    glUseProgram(program);
    GLint posLoc = glGetAttribLocation(program, essl1_shaders::PositionAttrib());
    ASSERT_NE(-1, posLoc);
    glVertexAttribPointer(posLoc, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
    glEnableVertexAttribArray(posLoc);
    ASSERT_GL_NO_ERROR();
    glDrawArrays(GL_TRIANGLES, 0, 6);
    ASSERT_GL_NO_ERROR();
    uint32_t expectedRenderPassCount = counters.renderPasses;
    GLTexture newTexture;
    glBindTexture(GL_TEXTURE_2D, newTexture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, kInitialData);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glDrawArrays(GL_TRIANGLES, 0, 6);
    ASSERT_GL_NO_ERROR();
    uint32_t actualRenderPassCount = counters.renderPasses;
    EXPECT_EQ(expectedRenderPassCount, actualRenderPassCount);
}
TEST_P ( VulkanPerformanceCounterTest , NewTextureDoesNotBreakRenderPass ) { const rx :: vk :: PerfCounters & counters = hackANGLE ( ) ; GLColor kInitialData [ 4 ] = { GLColor :: red , GLColor :: blue , GLColor :: green , GLColor :: yellow } ; GLTexture texture ; glBindTexture ( GL_TEXTURE_2D , texture ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , 2 , 2 , 0 , GL_RGBA , GL_UNSIGNED_BYTE , kInitialData ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST ) ; auto quadVerts = GetQuadVertices ( ) ; GLBuffer vertexBuffer ; glBindBuffer ( GL_ARRAY_BUFFER , vertexBuffer ) ; glBufferData ( GL_ARRAY_BUFFER , quadVerts . size ( ) * sizeof ( quadVerts [ 0 ] ) , quadVerts . data ( ) , GL_STATIC_DRAW ) ; ANGLE_GL_PROGRAM ( program , essl1_shaders :: vs :: Texture2D ( ) , essl1_shaders :: fs :: Texture2D ( ) ) ; glUseProgram ( program ) ; GLint posLoc = glGetAttribLocation ( program , essl1_shaders :: PositionAttrib ( ) ) ; ASSERT_NE ( -1 , posLoc ) ; glVertexAttribPointer ( posLoc , 3 , GL_FLOAT , GL_FALSE , 0 , nullptr ) ; glEnableVertexAttribArray ( posLoc ) ; ASSERT_GL_NO_ERROR ( ) ; glDrawArrays ( GL_TRIANGLES , 0 , 6 ) ; ASSERT_GL_NO_ERROR ( ) ; uint32_t expectedRenderPassCount = counters . renderPasses ; GLTexture newTexture ; glBindTexture ( GL_TEXTURE_2D , newTexture ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , 2 , 2 , 0 , GL_RGBA , GL_UNSIGNED_BYTE , kInitialData ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST ) ; glDrawArrays ( GL_TRIANGLES , 0 , 6 ) ; ASSERT_GL_NO_ERROR ( ) ; uint32_t actualRenderPassCount = counters . renderPasses ; EXPECT_EQ ( expectedRenderPassCount , actualRenderPassCount ) ; }
Tests that texture updates to unused textures don't break the RP.
Tests that texture updates to unused textures don ' t break the RP .
// Step 1: Set up a simple 2D Texture rendering loop. // Step 2: Introduce a new 2D Texture with the same Program and Framebuffer.