mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
GPU/D3D11: Fix possible buffer overwrite when reading back
This commit is contained in:
parent
8be2b66ebb
commit
6e9ebfa5b5
|
@ -55,7 +55,7 @@ public:
|
||||||
{
|
{
|
||||||
const u8* src_ptr = static_cast<u8*>(m_map.pData) + (y * m_map.RowPitch) + (x * sizeof(T));
|
const u8* src_ptr = static_cast<u8*>(m_map.pData) + (y * m_map.RowPitch) + (x * sizeof(T));
|
||||||
u8* dst_ptr = reinterpret_cast<u8*>(data);
|
u8* dst_ptr = reinterpret_cast<u8*>(data);
|
||||||
if (m_map.RowPitch != stride)
|
if (m_map.RowPitch != stride || width != m_width || x != 0)
|
||||||
{
|
{
|
||||||
for (u32 row = 0; row < height; row++)
|
for (u32 row = 0; row < height; row++)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ public:
|
||||||
{
|
{
|
||||||
const u8* src_ptr = reinterpret_cast<const u8*>(data);
|
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));
|
u8* dst_ptr = static_cast<u8*>(m_map.pData) + (y * m_map.RowPitch) + (x * sizeof(T));
|
||||||
if (m_map.RowPitch != stride)
|
if (m_map.RowPitch != stride || width != m_width || x != 0)
|
||||||
{
|
{
|
||||||
for (u32 row = 0; row < height; row++)
|
for (u32 row = 0; row < height; row++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -267,9 +267,9 @@ bool GPU_HW_D3D11::CreateFramebuffer()
|
||||||
((m_downsample_mode == GPUDownsampleMode::Adaptive) ? VRAM_WIDTH : GPU_MAX_DISPLAY_WIDTH) * m_resolution_scale,
|
((m_downsample_mode == GPUDownsampleMode::Adaptive) ? VRAM_WIDTH : GPU_MAX_DISPLAY_WIDTH) * m_resolution_scale,
|
||||||
GPU_MAX_DISPLAY_HEIGHT * m_resolution_scale, 1, 1, texture_format,
|
GPU_MAX_DISPLAY_HEIGHT * m_resolution_scale, 1, 1, texture_format,
|
||||||
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) ||
|
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) ||
|
||||||
!m_vram_encoding_texture.Create(m_device.Get(), VRAM_WIDTH, VRAM_HEIGHT, 1, 1, texture_format,
|
!m_vram_encoding_texture.Create(m_device.Get(), VRAM_WIDTH / 2, VRAM_HEIGHT, 1, 1, texture_format,
|
||||||
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) ||
|
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) ||
|
||||||
!m_vram_readback_texture.Create(m_device.Get(), VRAM_WIDTH, VRAM_HEIGHT, texture_format, false))
|
!m_vram_readback_texture.Create(m_device.Get(), VRAM_WIDTH / 2, VRAM_HEIGHT, texture_format, false))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue