src/third_party/angle/src/tests/gl_tests/OcclusionQueriesTest.cpp
// Test that multisampled-render-to-texture unresolve should not be counted by occlusion query.
Test that multisampled-render-to-texture unresolve should not be counted by occlusion query.
Test that multisampled - render - to - texture unresolve should not be counted by occlusion query .
TEST_P(OcclusionQueriesTestES3, UnresolveNotCounted)
{
    ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_EXT_multisampled_render_to_texture"));
    ANGLE_SKIP_TEST_IF(IsLinux() && IsIntel() && IsVulkan());
    constexpr GLuint kSize = 64;
    GLFramebuffer fboMS;
    glBindFramebuffer(GL_FRAMEBUFFER, fboMS);
    GLTexture textureMS;
    glBindTexture(GL_TEXTURE_2D, textureMS);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kSize, kSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
    glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
                                         textureMS, 0, 4);
    GLRenderbuffer depthMS;
    glBindRenderbuffer(GL_RENDERBUFFER, depthMS);
    glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT16, kSize, kSize);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthMS);
    EXPECT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
    drawQuad(mProgram, essl1_shaders::PositionAttrib(), 0.5f);
    ASSERT_GL_NO_ERROR();
    GLTexture texture;
    glBindTexture(GL_TEXTURE_2D, texture);
    glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, kSize, kSize, 0);
    GLuint query = 0;
    glGenQueriesEXT(1, &query);
    glBeginQueryEXT(GL_ANY_SAMPLES_PASSED_EXT, query);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_NEVER);
    drawQuad(mProgram, essl1_shaders::PositionAttrib(), 0.8f, 0.5f);
    glEndQueryEXT(GL_ANY_SAMPLES_PASSED_EXT);
    EXPECT_GL_NO_ERROR();
    swapBuffers();
    GLuint result = GL_TRUE;
    glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_EXT,
                           &result);  
    EXPECT_GL_NO_ERROR();
    glDeleteQueriesEXT(1, &query);
    EXPECT_GL_FALSE(result);
}
TEST_P ( OcclusionQueriesTestES3 , UnresolveNotCounted ) { ANGLE_SKIP_TEST_IF ( ! EnsureGLExtensionEnabled ( " " ) ) ; ANGLE_SKIP_TEST_IF ( IsLinux ( ) && IsIntel ( ) && IsVulkan ( ) ) ; constexpr GLuint kSize = 64 ; GLFramebuffer fboMS ; glBindFramebuffer ( GL_FRAMEBUFFER , fboMS ) ; GLTexture textureMS ; glBindTexture ( GL_TEXTURE_2D , textureMS ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , kSize , kSize , 0 , GL_RGBA , GL_UNSIGNED_BYTE , nullptr ) ; glFramebufferTexture2DMultisampleEXT ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 , GL_TEXTURE_2D , textureMS , 0 , 4 ) ; GLRenderbuffer depthMS ; glBindRenderbuffer ( GL_RENDERBUFFER , depthMS ) ; glRenderbufferStorageMultisample ( GL_RENDERBUFFER , 4 , GL_DEPTH_COMPONENT16 , kSize , kSize ) ; glFramebufferRenderbuffer ( GL_FRAMEBUFFER , GL_DEPTH_ATTACHMENT , GL_RENDERBUFFER , depthMS ) ; EXPECT_GL_FRAMEBUFFER_COMPLETE ( GL_FRAMEBUFFER ) ; drawQuad ( mProgram , essl1_shaders :: PositionAttrib ( ) , 0.5f ) ; ASSERT_GL_NO_ERROR ( ) ; GLTexture texture ; glBindTexture ( GL_TEXTURE_2D , texture ) ; glCopyTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , 0 , 0 , kSize , kSize , 0 ) ; GLuint query = 0 ; glGenQueriesEXT ( 1 , & query ) ; glBeginQueryEXT ( GL_ANY_SAMPLES_PASSED_EXT , query ) ; glEnable ( GL_DEPTH_TEST ) ; glDepthFunc ( GL_NEVER ) ; drawQuad ( mProgram , essl1_shaders :: PositionAttrib ( ) , 0.8f , 0.5f ) ; glEndQueryEXT ( GL_ANY_SAMPLES_PASSED_EXT ) ; EXPECT_GL_NO_ERROR ( ) ; swapBuffers ( ) ; GLuint result = GL_TRUE ; glGetQueryObjectuivEXT ( query , GL_QUERY_RESULT_EXT , & result ) ; EXPECT_GL_NO_ERROR ( ) ; glDeleteQueriesEXT ( 1 , & query ) ; EXPECT_GL_FALSE ( result ) ; }
Test that multisampled-render-to-texture unresolve should not be counted by occlusion query.
Test that multisampled - render - to - texture unresolve should not be counted by occlusion query .
// http://anglebug.com/5086 // Create multisampled framebuffer to draw into // Draw red into the multisampled color buffer. // Create a texture and copy into it, forcing a resolve of the color buffer. // Make a draw call that will fail the depth test, and therefore shouldn't contribute to // occlusion query. // will block waiting for result