mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-03 14:09:33 +03:00
Add test for copying GL_SRGB8_ALPHA8 to GL_RGBA8
The pixel values should be the same (no conversion should happen). Include sub-tests with and without alpha premultiplication. Bug: angleproject:7907 Change-Id: I2e3d657d5b8513cd06df357e84027572ebce03ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4852258 Commit-Queue: ccameron chromium <ccameron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
committed by
Angle LUCI CQ
parent
f58423501d
commit
120e90eb91
@@ -1384,5 +1384,8 @@ b/266235549 D3D11 : ComputeShaderTest.SSBOAliasOverWrite/* = SKIP
|
||||
// Workaround feature that is only supposed to be enabled on vulkan backend
|
||||
b/292285899 PIXEL4ORXL GLES : EGLSurfaceTest.DestroyAndRecreateWhileCurrent/* = SKIP
|
||||
|
||||
// Work in progress.
|
||||
7907 D3D11 : CopyTextureTestES3.NoConvertSRGBToRGB/ES3_D3D11 = SKIP
|
||||
|
||||
// Please do not add expectations below this line,
|
||||
// so that TIMEOUT expectations above don't override more precise SKIP expectations
|
||||
|
||||
@@ -2744,6 +2744,71 @@ TEST_P(CopyTextureTestES3, InvalidateCopyThenBlend)
|
||||
EXPECT_PIXEL_COLOR_EQ(kSize - 1, kSize - 1, GLColor::yellow);
|
||||
}
|
||||
|
||||
// Test that sRGB-to-RGB copy does not change pixel values.
|
||||
// http://anglebug.com/7907
|
||||
TEST_P(CopyTextureTestES3, NoConvertSRGBToRGB)
|
||||
{
|
||||
const size_t kTestCount = 4;
|
||||
const GLColor kSourceColor[kTestCount] = {
|
||||
GLColor(89, 67, 45, 123),
|
||||
GLColor(87, 69, 45, 123),
|
||||
GLColor(180, 143, 93, 123),
|
||||
GLColor(89, 67, 45, 123),
|
||||
};
|
||||
const GLColor kExpectedColor[kTestCount] = {
|
||||
GLColor(89, 67, 45, 123),
|
||||
GLColor(180, 143, 93, 123),
|
||||
GLColor(87, 69, 45, 123),
|
||||
GLColor(89, 67, 45, 123),
|
||||
};
|
||||
bool kPremultiply[kTestCount] = {false, false, true, true};
|
||||
bool kUnmultiply[kTestCount] = {false, true, false, true};
|
||||
|
||||
for (size_t test = 0; test < kTestCount; ++test)
|
||||
{
|
||||
// Create image as sRGB.
|
||||
GLTexture sourceTexture;
|
||||
glBindTexture(GL_TEXTURE_2D, sourceTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
&kSourceColor[test]);
|
||||
|
||||
GLTexture destTexture;
|
||||
glBindTexture(GL_TEXTURE_2D, destTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
|
||||
// Note: flipY is used to avoid direct transfer between textures and force a draw-based
|
||||
// path.
|
||||
glCopySubTextureCHROMIUM(sourceTexture, 0, GL_TEXTURE_2D, destTexture, 0, // level,
|
||||
0, 0, // src x,y
|
||||
0, 0, // dst x,y
|
||||
1, 1, // width, height
|
||||
true, // flip-y
|
||||
kPremultiply[test], // premul
|
||||
kUnmultiply[test]); // unmul
|
||||
ASSERT_GL_NO_ERROR();
|
||||
|
||||
// Verify the copy.
|
||||
ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Texture2D(), essl1_shaders::fs::Texture2D());
|
||||
glUseProgram(program);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, destTexture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
GLint textureLocation = glGetUniformLocation(program, essl1_shaders::Texture2DUniform());
|
||||
ASSERT_NE(-1, textureLocation);
|
||||
glUniform1i(textureLocation, 0);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f);
|
||||
ASSERT_GL_NO_ERROR();
|
||||
|
||||
EXPECT_PIXEL_COLOR_NEAR(0, 0, kExpectedColor[test], 2);
|
||||
}
|
||||
}
|
||||
|
||||
void CopyTextureTestES3::invalidateBlitThenBlendCommon(GLsizei layerCount)
|
||||
{
|
||||
// http://anglebug.com/5152
|
||||
|
||||
Reference in New Issue
Block a user