Commit e6b6da03 by Jamie Madill

Use the virtual commitRegion in TextureD3D::subData.

This allows us remove the duplicated code in the various typed methods that checks for an error before committing. BUG=angle:729 Change-Id: Icd0ad2be55ac423baec3855e05c53f4b624b6764 Reviewed-on: https://chromium-review.googlesource.com/220275Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 7cb2b9d7
...@@ -155,6 +155,13 @@ gl::Error TextureD3D::subImage(GLint xoffset, GLint yoffset, GLint zoffset, GLsi ...@@ -155,6 +155,13 @@ gl::Error TextureD3D::subImage(GLint xoffset, GLint yoffset, GLint zoffset, GLsi
return error; return error;
} }
gl::Box region(xoffset, yoffset, zoffset, width, height, depth);
error = commitRegion(index, region);
if (error.isError())
{
return error;
}
mDirtyImages = true; mDirtyImages = true;
} }
...@@ -511,18 +518,8 @@ gl::Error TextureD3D_2D::subImage(GLenum target, GLint level, GLint xoffset, GLi ...@@ -511,18 +518,8 @@ gl::Error TextureD3D_2D::subImage(GLenum target, GLint level, GLint xoffset, GLi
if (!fastUnpacked) if (!fastUnpacked)
{ {
gl::Error error = TextureD3D::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpack, return TextureD3D::subImage(xoffset, yoffset, 0, width, height, 1, format, type,
pixels, index); unpack, pixels, index);
if (error.isError())
{
return error;
}
error = commitRegion(index, destArea);
if (error.isError())
{
return error;
}
} }
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
...@@ -976,17 +973,8 @@ gl::Error TextureD3D_Cube::subImage(GLenum target, GLint level, GLint xoffset, G ...@@ -976,17 +973,8 @@ gl::Error TextureD3D_Cube::subImage(GLenum target, GLint level, GLint xoffset, G
const gl::PixelUnpackState &unpack, const void *pixels) const gl::PixelUnpackState &unpack, const void *pixels)
{ {
ASSERT(depth == 1 && zoffset == 0); ASSERT(depth == 1 && zoffset == 0);
gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level); gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
gl::Error error = TextureD3D::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpack, pixels, return TextureD3D::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpack, pixels, index);
index);
if (error.isError())
{
return error;
}
gl::Box region(xoffset, yoffset, 0, width, height, 1);
return commitRegion(index, region);
} }
gl::Error TextureD3D_Cube::subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, gl::Error TextureD3D_Cube::subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
...@@ -1515,7 +1503,6 @@ gl::Error TextureD3D_3D::subImage(GLenum target, GLint level, GLint xoffset, GLi ...@@ -1515,7 +1503,6 @@ gl::Error TextureD3D_3D::subImage(GLenum target, GLint level, GLint xoffset, GLi
bool fastUnpacked = false; bool fastUnpacked = false;
gl::ImageIndex index = gl::ImageIndex::Make3D(level); gl::ImageIndex index = gl::ImageIndex::Make3D(level);
gl::Box destArea(xoffset, yoffset, zoffset, width, height, depth);
// Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
if (isFastUnpackable(unpack, getInternalFormat(level))) if (isFastUnpackable(unpack, getInternalFormat(level)))
...@@ -1524,6 +1511,7 @@ gl::Error TextureD3D_3D::subImage(GLenum target, GLint level, GLint xoffset, GLi ...@@ -1524,6 +1511,7 @@ gl::Error TextureD3D_3D::subImage(GLenum target, GLint level, GLint xoffset, GLi
if (destRenderTarget) if (destRenderTarget)
{ {
gl::Box destArea(xoffset, yoffset, zoffset, width, height, depth);
gl::Error error = fastUnpackPixels(unpack, pixels, destArea, getInternalFormat(level), type, destRenderTarget); gl::Error error = fastUnpackPixels(unpack, pixels, destArea, getInternalFormat(level), type, destRenderTarget);
if (error.isError()) if (error.isError())
{ {
...@@ -1539,14 +1527,8 @@ gl::Error TextureD3D_3D::subImage(GLenum target, GLint level, GLint xoffset, GLi ...@@ -1539,14 +1527,8 @@ gl::Error TextureD3D_3D::subImage(GLenum target, GLint level, GLint xoffset, GLi
if (!fastUnpacked) if (!fastUnpacked)
{ {
gl::Error error = TextureD3D::subImage(xoffset, yoffset, zoffset, width, height, depth, format, type, unpack, return TextureD3D::subImage(xoffset, yoffset, zoffset, width, height, depth, format, type,
pixels, index); unpack, pixels, index);
if (error.isError())
{
return error;
}
return commitRegion(index, destArea);
} }
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
...@@ -1998,15 +1980,8 @@ gl::Error TextureD3D_2DArray::subImage(GLenum target, GLint level, GLint xoffset ...@@ -1998,15 +1980,8 @@ gl::Error TextureD3D_2DArray::subImage(GLenum target, GLint level, GLint xoffset
const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL; const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL;
gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer); gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer);
gl::Error error = TextureD3D::subImage(xoffset, yoffset, zoffset, width, height, 1, format, type, unpack, gl::Error error = TextureD3D::subImage(xoffset, yoffset, zoffset, width, height, 1, format, type,
layerPixels, index); unpack, layerPixels, index);
if (error.isError())
{
return error;
}
gl::Box region(xoffset, yoffset, 0, width, height, 1);
error = commitRegion(index, region);
if (error.isError()) if (error.isError())
{ {
return error; return 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