-bool Image9::copyToStorage2DArray(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height)
-{
- // 2D array textures are not supported by the D3D9 backend.
- UNREACHABLE();
- return false;
+ if (index.type == GL_TEXTURE_2D)
+ {
+ TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage);
+ gl::Error error = storage9->getSurfaceLevel(index.mipIndex, true, &destSurface);
+ if (error.isError())
+ {
+ return error;
+ }
+ }
+ else
+ {
+ ASSERT(gl::IsCubemapTextureTarget(index.type));
+ TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage);
+ gl::Error error = storage9->getCubeMapSurface(index.type, index.mipIndex, true, &destSurface);
+ if (error.isError())
+ {
+ return error;
+ }
+ }
+
+ error = copyToSurface(destSurface, region.x, region.y, region.width, region.height);
+ SafeRelease(destSurface);
+ return error;