Common/D3D11: Stride should be byte width
This commit is contained in:
parent
bf5f53e1d1
commit
757bef7b6d
|
@ -55,18 +55,18 @@ public:
|
|||
{
|
||||
const u8* src_ptr = static_cast<u8*>(m_map.pData) + (y * m_map.RowPitch) + (x * sizeof(T));
|
||||
u8* dst_ptr = reinterpret_cast<u8*>(data);
|
||||
if (m_map.RowPitch != (sizeof(T) * stride))
|
||||
if (m_map.RowPitch != stride)
|
||||
{
|
||||
for (u32 row = 0; row < height; row++)
|
||||
{
|
||||
std::memcpy(dst_ptr, src_ptr, sizeof(T) * width);
|
||||
src_ptr += m_map.RowPitch;
|
||||
dst_ptr += sizeof(T) * stride;
|
||||
dst_ptr += stride;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::memcpy(dst_ptr, src_ptr, (sizeof(T) * stride) * height);
|
||||
std::memcpy(dst_ptr, src_ptr, stride * height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,18 +89,18 @@ public:
|
|||
{
|
||||
const u8* src_ptr = reinterpret_cast<const u8*>(data);
|
||||
u8* dst_ptr = static_cast<u8*>(m_map.pData) + (y * m_map.RowPitch) + (x * sizeof(T));
|
||||
if (m_map.RowPitch != (sizeof(T) * stride))
|
||||
if (m_map.RowPitch != stride)
|
||||
{
|
||||
for (u32 row = 0; row < height; row++)
|
||||
{
|
||||
std::memcpy(dst_ptr, src_ptr, sizeof(T) * width);
|
||||
src_ptr += sizeof(T) * stride;
|
||||
src_ptr += stride;
|
||||
dst_ptr += m_map.RowPitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::memcpy(dst_ptr, src_ptr, (sizeof(T) * stride) * height);
|
||||
std::memcpy(dst_ptr, src_ptr, stride * height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -961,8 +961,9 @@ void GPU_HW_D3D11::ReadVRAM(u32 x, u32 y, u32 width, u32 height)
|
|||
// And copy it into our shadow buffer.
|
||||
if (m_vram_readback_texture.Map(m_context.Get(), false))
|
||||
{
|
||||
m_vram_readback_texture.ReadPixels(0, 0, encoded_width * 2, encoded_height, VRAM_WIDTH,
|
||||
&m_vram_shadow[copy_rect.top * VRAM_WIDTH + copy_rect.left]);
|
||||
m_vram_readback_texture.ReadPixels<u32>(
|
||||
0, 0, encoded_width, encoded_height, VRAM_WIDTH * sizeof(u16),
|
||||
reinterpret_cast<u32*>(&m_vram_shadow[copy_rect.top * VRAM_WIDTH + copy_rect.left]));
|
||||
m_vram_readback_texture.Unmap(m_context.Get());
|
||||
}
|
||||
else
|
||||
|
|
|
@ -157,13 +157,13 @@ bool D3D11HostDisplay::DownloadTexture(const void* texture_handle, HostDisplayPi
|
|||
|
||||
if (srv_desc.Format == DXGI_FORMAT_B5G6R5_UNORM || srv_desc.Format == DXGI_FORMAT_B5G5R5A1_UNORM)
|
||||
{
|
||||
return m_readback_staging_texture.ReadPixels<u16>(m_context.Get(), 0, 0, width, height,
|
||||
out_data_stride / sizeof(u16), static_cast<u16*>(out_data));
|
||||
return m_readback_staging_texture.ReadPixels<u16>(m_context.Get(), 0, 0, width, height, out_data_stride,
|
||||
static_cast<u16*>(out_data));
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_readback_staging_texture.ReadPixels<u32>(m_context.Get(), 0, 0, width, height,
|
||||
out_data_stride / sizeof(u32), static_cast<u32*>(out_data));
|
||||
return m_readback_staging_texture.ReadPixels<u32>(m_context.Get(), 0, 0, width, height, out_data_stride,
|
||||
static_cast<u32*>(out_data));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue