src/third_party/angle/src/tests/gl_tests/S3TCTextureSizesTest.cpp
// Test DXT1 formats with NPOT sizes with glTex[Sub]Image
Test DXT1 formats with NPOT sizes with glTex[Sub]Image
Test DXT1 formats with NPOT sizes with glTex [ Sub ] Image
TEST_P(S3TCTextureSizesTest, NPOTTexImage)
{
    ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_compression_dxt1"));
    GLTexture texture;
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glUseProgram(mTextureProgram);
    glUniform1i(mTextureUniformLocation, 0);
    struct levelInfo
    {
        size_t width;
        size_t height;
        size_t size;
        GLColor expectedColor;
    };
    std::array<levelInfo, 4> levels{{
        {12, 12, 72, GLColor(123, 0, 123, 255)},
        {6, 6, 32, GLColor(123, 0, 123, 255)},
        {3, 3, 8, GLColor(123, 0, 0, 255)},
        {1, 1, 8, GLColor(0, 0, 0, 0)},
    }};
    for (size_t i = 0; i < levels.size(); i++)
    {
        const levelInfo &level = levels[i];
        glCompressedTexImage2D(GL_TEXTURE_2D, i, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, level.width,
                               level.height, 0, level.size, k12x12DXT1Data.data());
    }
    EXPECT_GL_NO_ERROR();
    for (size_t i = 0; i < levels.size(); i++)
    {
        const levelInfo &level = levels[i];
        glViewport(0, 0, level.width, level.height);
        drawQuad(mTextureProgram, "position", 0.5f);
        EXPECT_PIXEL_COLOR_EQ(0, 0, level.expectedColor) << " failed on level " << i;
    }
    EXPECT_GL_NO_ERROR();
}
TEST_P ( S3TCTextureSizesTest , NPOTTexImage ) { ANGLE_SKIP_TEST_IF ( ! IsGLExtensionEnabled ( " " ) ) ; GLTexture texture ; glBindTexture ( GL_TEXTURE_2D , texture ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST_MIPMAP_NEAREST ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_S , GL_CLAMP_TO_EDGE ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_T , GL_CLAMP_TO_EDGE ) ; glUseProgram ( mTextureProgram ) ; glUniform1i ( mTextureUniformLocation , 0 ) ; struct levelInfo { size_t width ; size_t height ; size_t size ; GLColor expectedColor ; } ; std :: array < levelInfo , 4 > levels { { { 12 , 12 , 72 , GLColor ( 123 , 0 , 123 , 255 ) } , { 6 , 6 , 32 , GLColor ( 123 , 0 , 123 , 255 ) } , { 3 , 3 , 8 , GLColor ( 123 , 0 , 0 , 255 ) } , { 1 , 1 , 8 , GLColor ( 0 , 0 , 0 , 0 ) } , } } ; for ( size_t i = 0 ; i < levels . size ( ) ; i ++ ) { const levelInfo & level = levels [ i ] ; glCompressedTexImage2D ( GL_TEXTURE_2D , i , GL_COMPRESSED_RGBA_S3TC_DXT1_EXT , level . width , level . height , 0 , level . size , k12x12DXT1Data . data ( ) ) ; } EXPECT_GL_NO_ERROR ( ) ; for ( size_t i = 0 ; i < levels . size ( ) ; i ++ ) { const levelInfo & level = levels [ i ] ; glViewport ( 0 , 0 , level . width , level . height ) ; drawQuad ( mTextureProgram , " " , 0.5f ) ; EXPECT_PIXEL_COLOR_EQ ( 0 , 0 , level . expectedColor ) << " " << i ; } EXPECT_GL_NO_ERROR ( ) ; }
Test DXT1 formats with NPOT sizes with glTex[Sub]Image
Test DXT1 formats with NPOT sizes with glTex [ Sub ] Image