Capture/Replay: Update unpack state in Shared MEC

The shared context state MEC performed by
CaptureSharedContextMidExecutionSetup() needs to include updating the
pixel unpack state before capturing texture contents. Otherwise,
computeRowPitch() will compute the wrong value, leading to a crash in
memcpy() when capturing Pokemon GO.

Bug: angleproject:6203
Change-Id: Id1b2d0b4f3bc79e615778ba513f50aabaeb4a56e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3044356
Commit-Queue: Tim Van Patten <timvp@google.com>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Tim Van Patten 2021-07-21 16:38:05 -06:00 коммит произвёл Angle LUCI CQ
Родитель f8d277e452
Коммит 8a737c5d40
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -2418,6 +2418,15 @@ void CaptureSharedContextMidExecutionSetup(const gl::Context *context,
}
}
// Set a unpack alignment of 1. Otherwise, computeRowPitch() will compute the wrong value,
// leading to a crash in memcpy() when capturing the texture contents.
gl::PixelUnpackState &currentUnpackState = replayState.getUnpackState();
if (currentUnpackState.alignment != 1)
{
cap(CapturePixelStorei(replayState, true, GL_UNPACK_ALIGNMENT, 1));
currentUnpackState.alignment = 1;
}
// Capture Texture setup and data.
const gl::TextureManager &textures = apiState.getTextureManagerForCapture();
@ -2982,7 +2991,8 @@ void CaptureMidExecutionSetup(const gl::Context *context,
}
}
// Set a unpack alignment of 1.
// Set a unpack alignment of 1. Otherwise, computeRowPitch() will compute the wrong value,
// leading to a crash in memcpy() when capturing the texture contents.
gl::PixelUnpackState &currentUnpackState = replayState.getUnpackState();
if (currentUnpackState.alignment != 1)
{