src/third_party/angle/src/tests/gl_tests/MultisampledRenderToTextureTest.cpp
// Checking against invalid parameters for FramebufferTexture2DMultisampleEXT (cubemap).
Checking against invalid parameters for FramebufferTexture2DMultisampleEXT (cubemap).
Checking against invalid parameters for FramebufferTexture2DMultisampleEXT ( cubemap ) .
TEST_P(MultisampledRenderToTextureTest, TextureCubeMapParameterCheck)
{
    ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_EXT_multisampled_render_to_texture"));
    GLTexture texture;
    glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
    for (GLenum face = 0; face < 6; face++)
    {
        glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, GL_RGBA, 64, 64, 0, GL_RGBA,
                     GL_UNSIGNED_BYTE, nullptr);
        ASSERT_GL_NO_ERROR();
    }
    GLint samples;
    glGetIntegerv(GL_MAX_SAMPLES_EXT, &samples);
    ASSERT_GL_NO_ERROR();
    EXPECT_GE(samples, 1);
    GLFramebuffer FBO;
    glBindFramebuffer(GL_FRAMEBUFFER, FBO);
    for (GLenum face = 0; face < 6; face++)
    {
        glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                             GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture, 0, 4);
        ASSERT_GL_NO_ERROR();
        EXPECT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
        glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1,
                                             GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture, 0, 4);
        assertErrorIfNotMSRTT2(GL_INVALID_ENUM);
        glFramebufferTexture2DMultisampleEXT(GL_RENDERBUFFER, GL_COLOR_ATTACHMENT0,
                                             GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture, 0, 4);
        ASSERT_GL_ERROR(GL_INVALID_ENUM);
        glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                             GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture, 0,
                                             samples + 1);
        ASSERT_GL_ERROR(GL_INVALID_VALUE);
        glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                             GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture, 0, 4);
        GLint param = 0;
        glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                              GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT,
                                              &param);
        EXPECT_GE(param, 4);
    }
}
TEST_P ( MultisampledRenderToTextureTest , TextureCubeMapParameterCheck ) { ANGLE_SKIP_TEST_IF ( ! EnsureGLExtensionEnabled ( " " ) ) ; GLTexture texture ; glBindTexture ( GL_TEXTURE_CUBE_MAP , texture ) ; for ( GLenum face = 0 ; face < 6 ; face ++ ) { glTexImage2D ( GL_TEXTURE_CUBE_MAP_POSITIVE_X + face , 0 , GL_RGBA , 64 , 64 , 0 , GL_RGBA , GL_UNSIGNED_BYTE , nullptr ) ; ASSERT_GL_NO_ERROR ( ) ; } GLint samples ; glGetIntegerv ( GL_MAX_SAMPLES_EXT , & samples ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_GE ( samples , 1 ) ; GLFramebuffer FBO ; glBindFramebuffer ( GL_FRAMEBUFFER , FBO ) ; for ( GLenum face = 0 ; face < 6 ; face ++ ) { glFramebufferTexture2DMultisampleEXT ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 , GL_TEXTURE_CUBE_MAP_POSITIVE_X + face , texture , 0 , 4 ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_GL_FRAMEBUFFER_COMPLETE ( GL_FRAMEBUFFER ) ; glFramebufferTexture2DMultisampleEXT ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT1 , GL_TEXTURE_CUBE_MAP_POSITIVE_X + face , texture , 0 , 4 ) ; assertErrorIfNotMSRTT2 ( GL_INVALID_ENUM ) ; glFramebufferTexture2DMultisampleEXT ( GL_RENDERBUFFER , GL_COLOR_ATTACHMENT0 , GL_TEXTURE_CUBE_MAP_POSITIVE_X + face , texture , 0 , 4 ) ; ASSERT_GL_ERROR ( GL_INVALID_ENUM ) ; glFramebufferTexture2DMultisampleEXT ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 , GL_TEXTURE_CUBE_MAP_POSITIVE_X + face , texture , 0 , samples + 1 ) ; ASSERT_GL_ERROR ( GL_INVALID_VALUE ) ; glFramebufferTexture2DMultisampleEXT ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 , GL_TEXTURE_CUBE_MAP_POSITIVE_X + face , texture , 0 , 4 ) ; GLint param = 0 ; glGetFramebufferAttachmentParameteriv ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 , GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT , & param ) ; EXPECT_GE ( param , 4 ) ; } }
Checking against invalid parameters for FramebufferTexture2DMultisampleEXT (cubemap).
Checking against invalid parameters for FramebufferTexture2DMultisampleEXT ( cubemap ) .
// Positive test case // Attachment not COLOR_ATTACHMENT0.  Allowed only in EXT_multisampled_render_to_texture2 // Target not framebuffer // Samples too large // Retrieving samples // GE because samples may vary base on implementation. Spec says "the resulting value for // TEXTURE_SAMPLES_EXT is guaranteed to be greater than or equal to samples and no more than // the next larger sample count supported by the implementation"