Skip to content

Commit 7fe9802

Browse files
kd-11Nekotekina
authored andcommitted
vk: Properly use declared pitch when loading simple images
1 parent 14aebea commit 7fe9802

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

rpcs3/Emu/RSX/VK/VKPresent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ vk::image* VKGSRender::get_present_source(vk::present_surface_info* info, const
338338
}
339339

340340
m_texture_cache.invalidate_range(*m_current_command_buffer, range, rsx::invalidation_cause::read);
341-
image_to_flip = m_texture_cache.upload_image_simple(*m_current_command_buffer, info->address, info->width, info->height);
341+
image_to_flip = m_texture_cache.upload_image_simple(*m_current_command_buffer, info->address, info->width, info->height, info->pitch);
342342
}
343343

344344
return image_to_flip;

rpcs3/Emu/RSX/VK/VKTextureCache.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ namespace vk
14671467
baseclass::on_frame_end();
14681468
}
14691469

1470-
vk::image *upload_image_simple(vk::command_buffer& cmd, u32 address, u32 width, u32 height)
1470+
vk::image *upload_image_simple(vk::command_buffer& cmd, u32 address, u32 width, u32 height, u32 pitch)
14711471
{
14721472
if (!m_formats_support.bgra8_linear)
14731473
{
@@ -1490,7 +1490,6 @@ namespace vk
14901490

14911491
void* mem = image->memory->map(0, layout.rowPitch * height);
14921492

1493-
u32 row_pitch = width * 4;
14941493
auto src = vm::_ptr<const char>(address);
14951494
auto dst = static_cast<char*>(mem);
14961495

@@ -1503,7 +1502,7 @@ namespace vk
15031502
for (u32 col = 0; col < width; ++col)
15041503
casted_dst[col] = casted_src[col];
15051504

1506-
src += row_pitch;
1505+
src += pitch;
15071506
dst += layout.rowPitch;
15081507
}
15091508

0 commit comments

Comments
 (0)