Updated mipmap generation to return Error objects.
BUG=angle:520
Change-Id: Ic4e57148d031d6c452b3054efad98f6e730c7691
Reviewed-on: https://chromium-review.googlesource.com/221394
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/renderer/d3d/TextureD3D.cpp b/src/libGLESv2/renderer/d3d/TextureD3D.cpp
index 1028b1b..bdea186 100644
--- a/src/libGLESv2/renderer/d3d/TextureD3D.cpp
+++ b/src/libGLESv2/renderer/d3d/TextureD3D.cpp
@@ -337,13 +337,13 @@
return getImage(getImageIndex(0, 0));
}
-void TextureD3D::generateMipmaps()
+gl::Error TextureD3D::generateMipmaps()
{
GLint mipCount = mipLevels();
if (mipCount == 1)
{
- return; // no-op
+ return gl::Error(GL_NO_ERROR); // no-op
}
// Set up proper mipmap chain in our Image array.
@@ -366,12 +366,20 @@
Image *image = getImage(srcIndex);
gl::Rectangle area(0, 0, image->getWidth(), image->getHeight());
- image->copy(0, 0, 0, area, srcIndex, mTexStorage);
+ gl::Error error = image->copy(0, 0, 0, area, srcIndex, mTexStorage);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
else
{
- updateStorage();
+ gl::Error error = updateStorage();
+ if (error.isError())
+ {
+ return error;
+ }
}
}
@@ -389,15 +397,25 @@
if (renderableStorage)
{
// GPU-side mipmapping
- mTexStorage->generateMipmap(sourceIndex, destIndex);
+ gl::Error error = mTexStorage->generateMipmap(sourceIndex, destIndex);
+ if (error.isError())
+ {
+ return error;
+ }
}
else
{
// CPU-side mipmapping
- mRenderer->generateMipmap(getImage(destIndex), getImage(sourceIndex));
+ gl::Error error = mRenderer->generateMipmap(getImage(destIndex), getImage(sourceIndex));
+ if (error.isError())
+ {
+ return error;
+ }
}
}
}
+
+ return gl::Error(GL_NO_ERROR);
}
bool TextureD3D::isBaseImageZeroSize() const