зеркало из https://github.com/AvaloniaUI/angle.git
Add test for texture state change bug
Bug: chromium:1267624 Change-Id: I270e54921d40a2d139afdc78c90ab05164cbfabf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3268492 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
This commit is contained in:
Родитель
ef93b32c10
Коммит
517ff22004
|
@ -33,6 +33,7 @@
|
|||
6663 VULKAN : Texture2DTest.UploadThenFSThenNewRPThenVSThenFS/* = SKIP
|
||||
6663 VULKAN : Texture2DTest.UploadThenFSThenVS/* = SKIP
|
||||
6663 VULKAN : Texture2DTest.UploadThenFSThenVSThenNewRPThenFS/* = SKIP
|
||||
1267624 VULKAN : SimpleStateChangeTestES3.NonZeroBaseMutableTextureThenZeroBaseButIncompleteBug/* = SKIP
|
||||
|
||||
// Windows
|
||||
3786 WIN NVIDIA D3D11 : BufferDataOverflowTest.VertexBufferIntegerOverflow/* = SKIP
|
||||
|
|
|
@ -7109,6 +7109,59 @@ void main()
|
|||
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
|
||||
}
|
||||
|
||||
// Regression test for a bug where a mutable texture is used with non-zero base level then rebased
|
||||
// to zero but made incomplete and attached to the framebuffer. The texture's image is not
|
||||
// recreated with level 0, leading to errors when drawing to the framebuffer.
|
||||
TEST_P(SimpleStateChangeTestES3, NonZeroBaseMutableTextureThenZeroBaseButIncompleteBug)
|
||||
{
|
||||
ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Texture2D(), essl1_shaders::fs::Texture2D());
|
||||
glUseProgram(program);
|
||||
|
||||
const std::array<GLColor, 4> kMip0Data = {GLColor::red, GLColor::red, GLColor::red,
|
||||
GLColor::red};
|
||||
const std::array<GLColor, 2> kMip1Data = {GLColor::green, GLColor::green};
|
||||
|
||||
// Create two textures.
|
||||
GLTexture immutableTex;
|
||||
glBindTexture(GL_TEXTURE_2D, immutableTex);
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 1, 1);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, kMip0Data.data());
|
||||
|
||||
GLTexture mutableTex;
|
||||
glBindTexture(GL_TEXTURE_2D, mutableTex);
|
||||
for (uint32_t mip = 0; mip < 2; ++mip)
|
||||
{
|
||||
const uint32_t size = 4 >> mip;
|
||||
glTexImage2D(GL_TEXTURE_2D, mip, GL_RGBA8, size, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
mip == 0 ? kMip0Data.data() : kMip1Data.data());
|
||||
}
|
||||
|
||||
GLFramebuffer fbo;
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
|
||||
// Sample from the mutable texture at non-zero base level.
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 1);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, immutableTex, 0);
|
||||
drawQuad(program, std::string(essl1_shaders::PositionAttrib()), 0.0f);
|
||||
EXPECT_PIXEL_COLOR_EQ(0, 0, kMip1Data[0]);
|
||||
|
||||
// Rebase the mutable texture to zero, but enable mipmapping which makes it incomplete.
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
|
||||
// Remove feedback loop for good measure.
|
||||
glBindTexture(GL_TEXTURE_2D, immutableTex);
|
||||
|
||||
// Draw into base zero of the texture.
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mutableTex, 0);
|
||||
drawQuad(program, std::string(essl1_shaders::PositionAttrib()), 0.0f);
|
||||
|
||||
EXPECT_PIXEL_COLOR_EQ(0, 0, kMip1Data[1]);
|
||||
ASSERT_GL_NO_ERROR();
|
||||
}
|
||||
|
||||
// Regression test for a bug where the framebuffer binding was not synced during invalidate when a
|
||||
// clear operation was deferred.
|
||||
TEST_P(SimpleStateChangeTestES3, ChangeFramebufferThenInvalidateWithClear)
|
||||
|
|
Загрузка…
Ссылка в новой задаче