Clarify that subresource slice can't be used in GetTextureData

* We also remove some legacy unused behaviour in D3D11/D3D12 that would attempt
  to do this but return bogus data with the selected slice first then 1..n
  slices after.
This commit is contained in:
baldurk
2025-09-09 18:57:35 +01:00
parent fff4e0d5e4
commit 00cdfb0d1d
4 changed files with 6 additions and 34 deletions
+3 -2
View File
@@ -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
+3
View File
@@ -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.
-16
View File
@@ -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
{
-16
View File
@@ -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);