summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-08-29 01:27:04 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-08-29 01:27:04 +0000
commit386e33010b94493d87cb5e4ccac46973eac67ed4 (patch)
tree40bd0b32ff64495aec3b959e392aa12149e49324 /Graphics/GraphicsEngineD3D12
parentFixed https://github.com/DiligentGraphics/DiligentCore/issues/17 (Add support... (diff)
downloadDiligentCore-386e33010b94493d87cb5e4ccac46973eac67ed4.tar.gz
DiligentCore-386e33010b94493d87cb5e4ccac46973eac67ed4.zip
Fixed https://github.com/DiligentGraphics/DiligentCore/issues/27 (alignment issue with d3d12 texture update)
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index 70dddbcd..39481a36 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -845,7 +845,9 @@ namespace Diligent
auto UpdateRegionWidth = DstBox.MaxX - DstBox.MinX;
auto UpdateRegionHeight = DstBox.MaxY - DstBox.MinY;
auto UpdateRegionDepth = DstBox.MaxZ - DstBox.MinZ;
- auto BufferDataStride = UpdateRegionWidth * FmtAttribs.ComponentSize * FmtAttribs.NumComponents;
+ auto BufferDataStride = UpdateRegionWidth * Uint32{FmtAttribs.ComponentSize} * Uint32{FmtAttribs.NumComponents};
+ // RowPitch must be a multiple of 256 (aka. D3D12_TEXTURE_DATA_PITCH_ALIGNMENT)
+ BufferDataStride = (BufferDataStride + D3D12_TEXTURE_DATA_PITCH_ALIGNMENT-1) & ~(D3D12_TEXTURE_DATA_PITCH_ALIGNMENT-1);
auto BufferDataDepthStride = UpdateRegionHeight * BufferDataStride;
auto MemorySize = UpdateRegionDepth * BufferDataDepthStride;
auto UploadSpace = AllocateDynamicSpace(MemorySize, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);