From 0c40c699a5dee845c6d2a5e734cdc4537e1dd3fa Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Tue, 28 Aug 2018 23:12:19 -0700 Subject: Fixed issue in update texture methods in Vk and D3D12; updated copy from buffer to texture in D3D12 --- Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 13f93285..d61b947f 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -1138,7 +1138,8 @@ namespace Diligent auto UpdateRegionWidth = DstBox.MaxX - DstBox.MinX; auto UpdateRegionHeight = DstBox.MaxY - DstBox.MinY; auto UpdateRegionDepth = DstBox.MaxZ - DstBox.MinZ; - auto BufferDataStride = UpdateRegionWidth * Uint32{FmtAttribs.ComponentSize} * Uint32{FmtAttribs.NumComponents}; + auto PixelSize = Uint32{FmtAttribs.ComponentSize} * Uint32{FmtAttribs.NumComponents}; + auto BufferDataStride = UpdateRegionWidth * PixelSize; auto BufferDataDepthStride = UpdateRegionHeight * BufferDataStride; auto MemorySize = UpdateRegionDepth * BufferDataDepthStride; size_t Alignment = 4; @@ -1158,7 +1159,7 @@ namespace Diligent + row * BufferDataStride + slice * BufferDataDepthStride; - memcpy(pDstPtr, pSrcPtr, BufferDataStride); + memcpy(pDstPtr, pSrcPtr, UpdateRegionWidth * PixelSize); } } -- cgit v1.2.3