src/third_party/angle/src/tests/gl_tests/MultisampledRenderToTextureTest.cpp
// Checking against invalid parameters for RenderbufferStorageMultisampleEXT.
Checking against invalid parameters for RenderbufferStorageMultisampleEXT.
Checking against invalid parameters for RenderbufferStorageMultisampleEXT .
TEST_P(MultisampledRenderToTextureTest, RenderbufferParameterCheck)
{
    ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_EXT_multisampled_render_to_texture"));
    GLRenderbuffer renderbuffer;
    glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT16, 64, 64);
    ASSERT_GL_NO_ERROR();
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_STENCIL_INDEX8, 64, 64);
    ASSERT_GL_NO_ERROR();
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_RGBA4, 64, 64);
    ASSERT_GL_NO_ERROR();
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_RGB5_A1, 64, 64);
    ASSERT_GL_NO_ERROR();
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_RGB565, 64, 64);
    ASSERT_GL_NO_ERROR();
    if (getClientMajorVersion() >= 3)
    {
        glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_DEPTH24_STENCIL8, 64, 64);
        ASSERT_GL_NO_ERROR();
        glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_RGBA8, 64, 64);
        ASSERT_GL_NO_ERROR();
        if (getClientMinorVersion() >= 1)
        {
            glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_RGBA32I, 64, 64);
            ASSERT_GL_NO_ERROR();
            glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_RGBA32UI, 64, 64);
            ASSERT_GL_NO_ERROR();
        }
    }
    GLint samples;
    glGetIntegerv(GL_MAX_SAMPLES_EXT, &samples);
    ASSERT_GL_NO_ERROR();
    EXPECT_GE(samples, 1);
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, samples + 1, GL_DEPTH_COMPONENT16, 64, 64);
    ASSERT_GL_ERROR(GL_INVALID_VALUE);
    GLint maxSize;
    glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &maxSize);
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 2, GL_RGBA4, maxSize + 1, maxSize);
    ASSERT_GL_ERROR(GL_INVALID_VALUE);
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 2, GL_DEPTH_COMPONENT16, maxSize,
                                        maxSize + 1);
    ASSERT_GL_ERROR(GL_INVALID_VALUE);
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT16, 64, 64);
    GLint param = 0;
    glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES_EXT, &param);
    EXPECT_GE(param, 4);
}
TEST_P ( MultisampledRenderToTextureTest , RenderbufferParameterCheck ) { ANGLE_SKIP_TEST_IF ( ! EnsureGLExtensionEnabled ( " " ) ) ; GLRenderbuffer renderbuffer ; glBindRenderbuffer ( GL_RENDERBUFFER , renderbuffer ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_DEPTH_COMPONENT16 , 64 , 64 ) ; ASSERT_GL_NO_ERROR ( ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_STENCIL_INDEX8 , 64 , 64 ) ; ASSERT_GL_NO_ERROR ( ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_RGBA4 , 64 , 64 ) ; ASSERT_GL_NO_ERROR ( ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_RGB5_A1 , 64 , 64 ) ; ASSERT_GL_NO_ERROR ( ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_RGB565 , 64 , 64 ) ; ASSERT_GL_NO_ERROR ( ) ; if ( getClientMajorVersion ( ) >= 3 ) { glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_DEPTH24_STENCIL8 , 64 , 64 ) ; ASSERT_GL_NO_ERROR ( ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_RGBA8 , 64 , 64 ) ; ASSERT_GL_NO_ERROR ( ) ; if ( getClientMinorVersion ( ) >= 1 ) { glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_RGBA32I , 64 , 64 ) ; ASSERT_GL_NO_ERROR ( ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_RGBA32UI , 64 , 64 ) ; ASSERT_GL_NO_ERROR ( ) ; } } GLint samples ; glGetIntegerv ( GL_MAX_SAMPLES_EXT , & samples ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_GE ( samples , 1 ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , samples + 1 , GL_DEPTH_COMPONENT16 , 64 , 64 ) ; ASSERT_GL_ERROR ( GL_INVALID_VALUE ) ; GLint maxSize ; glGetIntegerv ( GL_MAX_RENDERBUFFER_SIZE , & maxSize ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 2 , GL_RGBA4 , maxSize + 1 , maxSize ) ; ASSERT_GL_ERROR ( GL_INVALID_VALUE ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 2 , GL_DEPTH_COMPONENT16 , maxSize , maxSize + 1 ) ; ASSERT_GL_ERROR ( GL_INVALID_VALUE ) ; glRenderbufferStorageMultisampleEXT ( GL_RENDERBUFFER , 4 , GL_DEPTH_COMPONENT16 , 64 , 64 ) ; GLint param = 0 ; glGetRenderbufferParameteriv ( GL_RENDERBUFFER , GL_RENDERBUFFER_SAMPLES_EXT , & param ) ; EXPECT_GE ( param , 4 ) ; }
Checking against invalid parameters for RenderbufferStorageMultisampleEXT.
Checking against invalid parameters for RenderbufferStorageMultisampleEXT .
// Positive test case.  Formats required by the spec (GLES2.0 Table 4.5) // Positive test case.  A few of the ES3 formats // Samples too large // Renderbuffer size too large // Retrieving samples // GE because samples may vary base on implementation. Spec says "the resulting value for // RENDERBUFFER_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"