Hash :
5c9f676d
Author :
Date :
2022-04-28T18:43:38
Basis Universal Texture Experiment Adding a test to read KTX image data. Adding the inlined image data adapted from KTX file with ETC1_RGB compressed format. Bug: angleproject:7250 Change-Id: I96d704f27875fc01bcd31ac8657627f4e3a71755 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3616109 Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Chris Forbes <chrisforbes@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
//
// Copyright 2022 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// KTXCompressedTextureTest.cpp: Tests of reading compressed texture stored in
// .ktx formats
#include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
#include "media/pixel.inc"
using namespace angle;
class KTXCompressedTextureTest : public ANGLETest
{
protected:
KTXCompressedTextureTest()
{
setWindowWidth(768);
setWindowHeight(512);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
}
};
// Verify that ANGLE can store and sample the ETC1 compressed texture stored in
// KTX container
TEST_P(KTXCompressedTextureTest, CompressedTexImageETC1)
{
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_OES_compressed_ETC1_RGB8_texture"));
ANGLE_GL_PROGRAM(textureProgram, essl1_shaders::vs::Texture2D(),
essl1_shaders::fs::Texture2D());
glUseProgram(textureProgram);
GLTexture texture;
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_ETC1_RGB8_OES, ktx_etc1_width, ktx_etc1_height, 0,
ktx_etc1_size, ktx_etc1_data);
EXPECT_GL_NO_ERROR();
GLint textureUniformLocation =
glGetUniformLocation(textureProgram, essl1_shaders::Texture2DUniform());
glUniform1i(textureUniformLocation, 0);
drawQuad(textureProgram.get(), essl1_shaders::PositionAttrib(), 0.5f);
EXPECT_GL_NO_ERROR();
}
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(KTXCompressedTextureTest);