Commit f6b986c8 by Jiajia Qin Committed by Commit Bot

Refactor TextureStorage11

The CL includes below changes: 1. Change bool isAssociatedImageValid to void verifyAssociatedImageValid since we always required that the validation check should never be false. So ASSERT() is enough. Same to Image11::isAssociatedStorageValid->Image11::verifyAssociatedStorageValid. 2. Remove the unnecessary if checking after ASSERT 3. Use override instead of virtual if the function is virtual and is overriding a virtual function from the base class. BUG=angleproject:2006 Change-Id: I036666ae1ed4bfcaa8cef9e0e9626d375cd81a27 Reviewed-on: https://chromium-review.googlesource.com/480015Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent d22b8f72
......@@ -133,9 +133,9 @@ gl::Error Image11::copyToStorage(TextureStorage *storage,
return gl::NoError();
}
bool Image11::isAssociatedStorageValid(TextureStorage11 *textureStorage) const
void Image11::verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const
{
return (mAssociatedStorage == textureStorage);
ASSERT(mAssociatedStorage == textureStorage);
}
gl::Error Image11::recoverFromAssociatedStorage()
......@@ -144,22 +144,13 @@ gl::Error Image11::recoverFromAssociatedStorage()
{
ANGLE_TRY(createStagingTexture());
bool textureStorageCorrect =
mAssociatedStorage->isAssociatedImageValid(mAssociatedImageIndex, this);
mAssociatedStorage->verifyAssociatedImageValid(mAssociatedImageIndex, this);
// This means that the cached TextureStorage has been modified after this Image11 released
// its copy of its data. This should not have happened. The TextureStorage should have told
// this Image11 to recover its data before it was overwritten.
ASSERT(textureStorageCorrect);
if (textureStorageCorrect)
{
// CopySubResource from the Storage to the Staging texture
gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
ANGLE_TRY(mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource,
mAssociatedImageIndex, region));
mRecoveredFromStorageCount += 1;
}
// CopySubResource from the Storage to the Staging texture
gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
ANGLE_TRY(mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource,
mAssociatedImageIndex, region));
mRecoveredFromStorageCount += 1;
// Reset all the recovery parameters, even if the texture storage association is broken.
disassociateStorage();
......
......@@ -58,7 +58,7 @@ class Image11 : public ImageD3D
const gl::Framebuffer *source) override;
gl::Error recoverFromAssociatedStorage();
bool isAssociatedStorageValid(TextureStorage11* textureStorage) const;
void verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const;
void disassociateStorage();
protected:
......
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