diff --git a/src/backend/d3d12/BufferD3D12.cpp b/src/backend/d3d12/BufferD3D12.cpp index 0e9ec2a2b6..05f2f3b31a 100644 --- a/src/backend/d3d12/BufferD3D12.cpp +++ b/src/backend/d3d12/BufferD3D12.cpp @@ -18,6 +18,8 @@ #include "backend/d3d12/ResourceAllocator.h" #include "backend/d3d12/ResourceUploader.h" #include "common/Assert.h" +#include "common/Constants.h" +#include "common/Math.h" namespace backend { namespace d3d12 { @@ -94,7 +96,7 @@ namespace d3d12 { uint32_t Buffer::GetD3D12Size() const { // TODO(enga@google.com): TODO investigate if this needs to be a constraint at the API level - return ((GetSize() + 256 - 1) / 256) * 256; // size is required to be 256-byte aligned. + return Align(GetSize(), 256); } ComPtr Buffer::GetD3D12Resource() { @@ -178,7 +180,7 @@ namespace d3d12 { uint32_t BufferView::GetD3D12Size() const { // TODO(enga@google.com): TODO investigate if this needs to be a constraint at the API level - return ((GetSize() + 256 - 1) / 256) * 256; // size is required to be 256-byte aligned. + return Align(GetSize(), 256); } const D3D12_CONSTANT_BUFFER_VIEW_DESC& BufferView::GetCBVDescriptor() const {