aboutsummaryrefslogtreecommitdiff
path: root/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp')
-rw-r--r--src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
index a8eb10310f..773dbc396e 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
@@ -211,8 +211,10 @@ angle::Result TextureStorage11::getSubresourceIndex(const gl::Context *context,
const gl::ImageIndex &index,
UINT *outSubresourceIndex) const
{
- UINT mipSlice = static_cast<UINT>(index.getLevelIndex() + mTopLevel);
- UINT arraySlice = static_cast<UINT>(index.hasLayer() ? index.getLayerIndex() : 0);
+ UINT mipSlice = static_cast<UINT>(index.getLevelIndex() + mTopLevel);
+ // D3D11CalcSubresource reference: always use 0 for volume (3D) textures
+ UINT arraySlice = static_cast<UINT>(
+ (index.hasLayer() && index.getType() != gl::TextureType::_3D) ? index.getLayerIndex() : 0);
UINT subresource = D3D11CalcSubresource(mipSlice, arraySlice, mMipLevels);
ASSERT(subresource != std::numeric_limits<UINT>::max());
*outSubresourceIndex = subresource;