mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
Calculate tighter bounds for data copied in D3D11 initial states
* This can be a problem since copying by pitch * count can slightly over-read if the pitch is larger than a row or slice, potentially reading into unmapped pages.
This commit is contained in:
@@ -696,7 +696,13 @@ bool WrappedID3D11Device::Serialise_InitialState(SerialiserType &ser, ResourceId
|
||||
{
|
||||
SubresourceContents = mapped.pData;
|
||||
RowPitch = mapped.RowPitch;
|
||||
ContentsLength = RowPitch * numRows;
|
||||
|
||||
const uint32_t rowLength = GetByteSize(desc.Width, 1, 1, desc.Format, mip);
|
||||
|
||||
RDCASSERT(RowPitch >= rowLength);
|
||||
|
||||
ContentsLength = RowPitch * (RDCMAX(1U, numRows) - 1);
|
||||
ContentsLength += rowLength;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,8 +884,16 @@ bool WrappedID3D11Device::Serialise_InitialState(SerialiserType &ser, ResourceId
|
||||
SubresourceContents = mapped.pData;
|
||||
RowPitch = mapped.RowPitch;
|
||||
DepthPitch = mapped.DepthPitch;
|
||||
|
||||
const uint32_t numSlices = RDCMAX(1U, desc.Depth >> mip);
|
||||
const uint32_t rowLength = GetByteSize(desc.Width, 1, 1, desc.Format, mip);
|
||||
|
||||
RDCASSERT(RowPitch >= rowLength);
|
||||
RDCASSERT(DepthPitch >= RowPitch * numRows);
|
||||
ContentsLength = DepthPitch * RDCMAX(1U, desc.Depth >> mip);
|
||||
|
||||
ContentsLength = DepthPitch * (RDCMAX(1U, numSlices) - 1);
|
||||
ContentsLength += RowPitch * (RDCMAX(1U, numRows) - 1);
|
||||
ContentsLength += rowLength;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user