Commit 28300e6f by Ian Elliott Committed by Commit Bot

Vulkan: Fix off-by-1 180/270-rotated CopyTexImage

The rotation calculations are a little different for this code (that uses a special shader) than for other pre-rotation cases. I also modified the CopyTexImageTestES3.2DArraySubImage test to make future bugs a little easier to diagnose. Test: Test: angle_end2end_tests --gtest_filter=*CopyTexImageTestES3.2DArraySubImage*Vulkan* Test: Test: angle_end2end_tests --gtest_filter=*WebGLReadOutsideFramebufferTest.CopyTexSubImage2D*Vulkan* Bug: b/158245571 Change-Id: I497ec541cae5cd4085c3e9d596ee20943f5510f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2275733Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent 68e60a92
......@@ -856,8 +856,8 @@ angle::Result TextureVk::copySubImageImplWithDraw(ContextVk *contextVk,
break;
case SurfaceRotation::Rotated180Degrees:
ASSERT(isSrcFlipY);
rotatedSourceBox.x = srcExtents.width - sourceBox.x - sourceBox.width;
rotatedSourceBox.y = srcExtents.height - sourceBox.y - sourceBox.height;
rotatedSourceBox.x = srcExtents.width - sourceBox.x - sourceBox.width - 1;
rotatedSourceBox.y = srcExtents.height - sourceBox.y - sourceBox.height - 1;
break;
case SurfaceRotation::Rotated270Degrees:
// Turn off y-flip for 270 degrees, as we don't want it affecting the
......@@ -867,8 +867,8 @@ angle::Result TextureVk::copySubImageImplWithDraw(ContextVk *contextVk,
// UtilsVk::copyImage().
ASSERT(isSrcFlipY);
isSrcFlipY = false;
rotatedSourceBox.x = srcExtents.height - sourceBox.y - sourceBox.height;
rotatedSourceBox.y = srcExtents.width - sourceBox.x - sourceBox.width;
rotatedSourceBox.x = srcExtents.height - sourceBox.y - sourceBox.height - 1;
rotatedSourceBox.y = srcExtents.width - sourceBox.x - sourceBox.width - 1;
std::swap(rotatedSourceBox.width, rotatedSourceBox.height);
std::swap(srcExtents.width, srcExtents.height);
break;
......
......@@ -623,7 +623,13 @@ TEST_P(CopyTexImageTestES3, 2DArraySubImage)
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 0, 0);
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 0, 1);
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
for (int x = 0; x < kTexSize; x++)
{
for (int y = 0; y < kTexSize; y++)
{
EXPECT_PIXEL_COLOR_EQ(x, y, GLColor::green);
}
}
ASSERT_GL_NO_ERROR();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment