Common: Add alignment header

Gets rid of duplicated alignment code.
This commit is contained in:
Léo Lam
2016-11-27 11:56:22 +01:00
parent 7192789c11
commit 31ccfffd38
32 changed files with 146 additions and 119 deletions

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include "VideoBackends/D3D12/PSTextureEncoder.h"
#include "Common/Align.h"
#include "Core/HW/Memmap.h"
#include "VideoBackends/D3D12/D3DBase.h"
#include "VideoBackends/D3D12/D3DCommandListManager.h"
@ -62,7 +63,7 @@ void PSTextureEncoder::Init()
CheckHR(D3D::device12->CreateCommittedResource(
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_READBACK), D3D12_HEAP_FLAG_NONE,
&CD3DX12_RESOURCE_DESC::Buffer(
D3D::AlignValue(static_cast<unsigned int>(out_tex_desc.Width) * 4,
Common::AlignUp(static_cast<unsigned int>(out_tex_desc.Width) * 4,
D3D12_TEXTURE_DATA_PITCH_ALIGNMENT) *
out_tex_desc.Height),
D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_PPV_ARGS(&m_out_readback_buffer)));
@ -179,7 +180,7 @@ void PSTextureEncoder::Encode(u8* dst, u32 format, u32 native_width, u32 bytes_p
dst_location.PlacedFootprint.Footprint.Width = EFB_WIDTH * 4;
dst_location.PlacedFootprint.Footprint.Height = EFB_HEIGHT / 4;
dst_location.PlacedFootprint.Footprint.Depth = 1;
dst_location.PlacedFootprint.Footprint.RowPitch = D3D::AlignValue(
dst_location.PlacedFootprint.Footprint.RowPitch = Common::AlignUp(
dst_location.PlacedFootprint.Footprint.Width * 4, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
D3D12_TEXTURE_COPY_LOCATION src_location = {};