From 834bbe6935d5b06c4bbce96fae6f92f6da7c42b2 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 17 Sep 2018 13:20:30 +0100 Subject: [PATCH] Align detected map differences to StructureByteStride on D3D11 buffers --- renderdoc/driver/d3d11/d3d11_context_wrap.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp index 852e06209..b7af63756 100644 --- a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp @@ -7522,6 +7522,22 @@ bool WrappedID3D11DeviceContext::Serialise_Unmap(SerialiserType &ser, ID3D11Reso diffStart = (uint32_t)s; diffEnd = (uint32_t)e; + // structured buffers must have copies aligned to their structure width, so we align down and + // up the detected diff start/end region to match. + if(WrappedID3D11Buffer::IsAlloc(pResource)) + { + D3D11_BUFFER_DESC bufdesc = {}; + ((WrappedID3D11Buffer *)pResource)->GetDesc(&bufdesc); + + if(bufdesc.StructureByteStride) + { + diffStart -= (diffStart % bufdesc.StructureByteStride); + + if((diffEnd % bufdesc.StructureByteStride) != 0) + diffEnd += bufdesc.StructureByteStride - (diffEnd % bufdesc.StructureByteStride); + } + } + if(found) { #if ENABLED(RDOC_DEVEL)