diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index f38153a9e..cd380040d 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -1607,8 +1607,9 @@ struct Subresource DOCUMENT("The mip level in the texture."); uint32_t mip; - DOCUMENT(R"(The slice within the texture. For 3D textures this is a depth slice, for arrays it is -an array slice. + DOCUMENT(R"(The slice within the texture. For array textures this is an array slice. For 3D textures +when a single depth slice can be referred to this refers to that depth slice. In some cases a 3D +texture may not allow referring to a single depth slice - see where the Subresource is used. .. note:: Cubemaps are simply 2D array textures with a special meaning, so the faces of a cubemap are the 2D diff --git a/renderdoc/api/replay/renderdoc_replay.h b/renderdoc/api/replay/renderdoc_replay.h index 48b0adbeb..682c63d5d 100644 --- a/renderdoc/api/replay/renderdoc_replay.h +++ b/renderdoc/api/replay/renderdoc_replay.h @@ -1108,6 +1108,9 @@ texture to something compatible with the target file format. DOCUMENT(R"(Retrieve the contents of one subresource of a texture as a ``bytes``. +.. note:: For 3D textures a whole width x height x depth mip is returned, you can't select a single + depth slice using :data:`Subresource.slice`. + :param ResourceId tex: The id of the texture to retrieve data from. :param Subresource sub: The subresource within this texture to use. :return: The requested texture contents. diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index 62263c45e..1504dd57e 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -2671,22 +2671,6 @@ void D3D11Replay::GetTextureData(ResourceId tex, const Subresource &sub, intercept.InitWrappedResource(dummyTex, subresource, data.data()); intercept.SetD3D(mapped); intercept.CopyFromD3D(); - - // for 3D textures if we wanted a particular slice (arrayIdx > 0) - // copy it into the beginning. - if(intercept.numSlices > 1 && s.slice > 0 && (int)s.slice < intercept.numSlices) - { - byte *dst = data.data(); - byte *src = data.data() + intercept.app.DepthPitch * s.slice; - - for(int row = 0; row < intercept.numRows; row++) - { - memcpy(dst, src, intercept.app.RowPitch); - - src += intercept.app.RowPitch; - dst += intercept.app.RowPitch; - } - } } else { diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index a1918f6dc..1f0ea1ab1 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -4300,22 +4300,6 @@ void D3D12Replay::GetTextureData(ResourceId tex, const Subresource &sub, memcpy(dst, src, dstRowPitch); } } - - // for 3D textures if we wanted a particular slice (slice3DCopy > 0) copy it into the beginning. - if(layouts[0].Footprint.Depth > 1 && slice3DCopy > 0 && - (int)slice3DCopy < layouts[0].Footprint.Depth) - { - for(UINT y = 0; y < rowcount; y++) - { - UINT srcrow = y + slice3DCopy * rowcount; - UINT dstrow = y; - - byte *src = pData + layouts[0].Footprint.RowPitch * srcrow; - byte *dst = data.data() + dstRowPitch * dstrow; - - memcpy(dst, src, dstRowPitch); - } - } } SAFE_DELETE_ARRAY(layouts);