Implement ANGLE_copy_texture_3d Extension
Adds copyTexture3DANGLE and copySubTexture3DANGLE that adds copy
operations on volumetric textures.
Bug: angleproject:2762
Test: angle_end2end_tests
Change-Id: I0076989c2b7ed69abfc73143c325065bdb06a360
Reviewed-on: https://chromium-review.googlesource.com/c/1207216
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/renderer_utils.cpp b/src/libANGLE/renderer/renderer_utils.cpp
index 280b3d9..b7d5000 100644
--- a/src/libANGLE/renderer/renderer_utils.cpp
+++ b/src/libANGLE/renderer/renderer_utils.cpp
@@ -305,15 +305,18 @@
void CopyImageCHROMIUM(const uint8_t *sourceData,
size_t sourceRowPitch,
size_t sourcePixelBytes,
+ size_t sourceDepthPitch,
PixelReadFunction pixelReadFunction,
uint8_t *destData,
size_t destRowPitch,
size_t destPixelBytes,
+ size_t destDepthPitch,
PixelWriteFunction pixelWriteFunction,
GLenum destUnsizedFormat,
GLenum destComponentType,
size_t width,
size_t height,
+ size_t depth,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha)
@@ -354,31 +357,36 @@
auto writeFunction = (destComponentType == GL_UNSIGNED_INT) ? WriteUintColor : WriteFloatColor;
- for (size_t y = 0; y < height; y++)
+ for (size_t z = 0; z < depth; z++)
{
- for (size_t x = 0; x < width; x++)
+ for (size_t y = 0; y < height; y++)
{
- const uint8_t *sourcePixelData = sourceData + y * sourceRowPitch + x * sourcePixelBytes;
-
- gl::ColorF sourceColor;
- pixelReadFunction(sourcePixelData, reinterpret_cast<uint8_t *>(&sourceColor));
-
- conversionFunction(&sourceColor);
- clipChannelsFunction(&sourceColor);
-
- size_t destY = 0;
- if (unpackFlipY)
+ for (size_t x = 0; x < width; x++)
{
- destY += (height - 1);
- destY -= y;
- }
- else
- {
- destY += y;
- }
+ const uint8_t *sourcePixelData =
+ sourceData + y * sourceRowPitch + x * sourcePixelBytes + z * sourceDepthPitch;
- uint8_t *destPixelData = destData + destY * destRowPitch + x * destPixelBytes;
- writeFunction(sourceColor, pixelWriteFunction, destPixelData);
+ gl::ColorF sourceColor;
+ pixelReadFunction(sourcePixelData, reinterpret_cast<uint8_t *>(&sourceColor));
+
+ conversionFunction(&sourceColor);
+ clipChannelsFunction(&sourceColor);
+
+ size_t destY = 0;
+ if (unpackFlipY)
+ {
+ destY += (height - 1);
+ destY -= y;
+ }
+ else
+ {
+ destY += y;
+ }
+
+ uint8_t *destPixelData =
+ destData + destY * destRowPitch + x * destPixelBytes + z * destDepthPitch;
+ writeFunction(sourceColor, pixelWriteFunction, destPixelData);
+ }
}
}
}