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, ...@@ -133,9 +133,9 @@ gl::Error Image11::copyToStorage(TextureStorage *storage,
return gl::NoError(); 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() gl::Error Image11::recoverFromAssociatedStorage()
...@@ -144,22 +144,13 @@ gl::Error Image11::recoverFromAssociatedStorage() ...@@ -144,22 +144,13 @@ gl::Error Image11::recoverFromAssociatedStorage()
{ {
ANGLE_TRY(createStagingTexture()); ANGLE_TRY(createStagingTexture());
bool textureStorageCorrect = mAssociatedStorage->verifyAssociatedImageValid(mAssociatedImageIndex, this);
mAssociatedStorage->isAssociatedImageValid(mAssociatedImageIndex, this);
// This means that the cached TextureStorage has been modified after this Image11 released // CopySubResource from the Storage to the Staging texture
// its copy of its data. This should not have happened. The TextureStorage should have told gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
// this Image11 to recover its data before it was overwritten. ANGLE_TRY(mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource,
ASSERT(textureStorageCorrect); mAssociatedImageIndex, region));
mRecoveredFromStorageCount += 1;
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;
}
// Reset all the recovery parameters, even if the texture storage association is broken. // Reset all the recovery parameters, even if the texture storage association is broken.
disassociateStorage(); disassociateStorage();
......
...@@ -58,7 +58,7 @@ class Image11 : public ImageD3D ...@@ -58,7 +58,7 @@ class Image11 : public ImageD3D
const gl::Framebuffer *source) override; const gl::Framebuffer *source) override;
gl::Error recoverFromAssociatedStorage(); gl::Error recoverFromAssociatedStorage();
bool isAssociatedStorageValid(TextureStorage11* textureStorage) const; void verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const;
void disassociateStorage(); void disassociateStorage();
protected: 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