summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp')
-rwxr-xr-xgfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp122
1 files changed, 4 insertions, 118 deletions
diff --git a/gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp b/gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp
index f379f429f..5346f6de1 100755
--- a/gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp
@@ -5,9 +5,10 @@
//
#include "test_utils/ANGLETest.h"
-#include "test_utils/gl_raii.h"
-namespace angle
+using namespace angle;
+
+namespace
{
class SRGBTextureTest : public ANGLETest
@@ -26,44 +27,12 @@ class SRGBTextureTest : public ANGLETest
void SetUp() override
{
ANGLETest::SetUp();
-
- const std::string vs =
- "precision highp float;\n"
- "attribute vec4 position;\n"
- "varying vec2 texcoord;\n"
- "\n"
- "void main()\n"
- "{\n"
- " gl_Position = vec4(position.xy, 0.0, 1.0);\n"
- " texcoord = (position.xy * 0.5) + 0.5;\n"
- "}\n";
-
- const std::string fs =
- "precision highp float;\n"
- "uniform sampler2D tex;\n"
- "varying vec2 texcoord;\n"
- "\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = texture2D(tex, texcoord);\n"
- "}\n";
-
- mProgram = CompileProgram(vs, fs);
- ASSERT_NE(0u, mProgram);
-
- mTextureLocation = glGetUniformLocation(mProgram, "tex");
- ASSERT_NE(-1, mTextureLocation);
}
void TearDown() override
{
- glDeleteProgram(mProgram);
-
ANGLETest::TearDown();
}
-
- GLuint mProgram = 0;
- GLint mTextureLocation = -1;
};
TEST_P(SRGBTextureTest, SRGBValidation)
@@ -174,95 +143,12 @@ TEST_P(SRGBTextureTest, SRGBARenderbuffer)
glDeleteRenderbuffers(1, &rbo);
}
-// Verify that if the srgb decode extension is available, srgb textures are too
-TEST_P(SRGBTextureTest, SRGBDecodeExtensionAvailability)
-{
- bool hasSRGBDecode = extensionEnabled("GL_EXT_texture_sRGB_decode");
- if (hasSRGBDecode)
- {
- bool hasSRGBTextures = extensionEnabled("GL_EXT_sRGB") || getClientMajorVersion() >= 3;
- EXPECT_TRUE(hasSRGBTextures);
- }
-}
-
-// Test basic functionality of SRGB decode using the texture parameter
-TEST_P(SRGBTextureTest, SRGBDecodeTextureParameter)
-{
- if (!extensionEnabled("GL_EXT_texture_sRGB_decode"))
- {
- std::cout << "Test skipped because GL_EXT_texture_sRGB_decode is not available."
- << std::endl;
- return;
- }
-
- GLColor linearColor(64, 127, 191, 255);
- GLColor srgbColor(13, 54, 133, 255);
-
- GLTexture tex;
- glBindTexture(GL_TEXTURE_2D, tex.get());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB_ALPHA_EXT, 1, 1, 0, GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE,
- &linearColor);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
- ASSERT_GL_NO_ERROR();
-
- glUseProgram(mProgram);
- glUniform1i(mTextureLocation, 0);
-
- glDisable(GL_DEPTH_TEST);
- drawQuad(mProgram, "position", 0.5f);
-
- EXPECT_PIXEL_COLOR_NEAR(0, 0, srgbColor, 1.0);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
- drawQuad(mProgram, "position", 0.5f);
-
- EXPECT_PIXEL_COLOR_NEAR(0, 0, linearColor, 1.0);
-}
-
-// Test basic functionality of SRGB decode using the sampler parameter
-TEST_P(SRGBTextureTest, SRGBDecodeSamplerParameter)
-{
- if (!extensionEnabled("GL_EXT_texture_sRGB_decode") || getClientMajorVersion() < 3)
- {
- std::cout << "Test skipped because GL_EXT_texture_sRGB_decode or ES3 is not available."
- << std::endl;
- return;
- }
-
- GLColor linearColor(64, 127, 191, 255);
- GLColor srgbColor(13, 54, 133, 255);
-
- GLTexture tex;
- glBindTexture(GL_TEXTURE_2D, tex.get());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB_ALPHA_EXT, 1, 1, 0, GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE,
- &linearColor);
- ASSERT_GL_NO_ERROR();
-
- GLSampler sampler;
- glBindSampler(0, sampler.get());
- glSamplerParameteri(sampler.get(), GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
-
- glUseProgram(mProgram);
- glUniform1i(mTextureLocation, 0);
-
- glDisable(GL_DEPTH_TEST);
- drawQuad(mProgram, "position", 0.5f);
-
- EXPECT_PIXEL_COLOR_NEAR(0, 0, srgbColor, 1.0);
-
- glSamplerParameteri(sampler.get(), GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
- drawQuad(mProgram, "position", 0.5f);
-
- EXPECT_PIXEL_COLOR_NEAR(0, 0, linearColor, 1.0);
-}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
ANGLE_INSTANTIATE_TEST(SRGBTextureTest,
ES2_D3D9(),
ES2_D3D11(),
ES3_D3D11(),
ES2_OPENGL(),
- ES3_OPENGL(),
- ES2_OPENGLES(),
- ES3_OPENGLES());
+ ES2_OPENGLES());
} // namespace