Skip to content

Commit

Permalink
VulkanHostDisplay: Fix uploading unaligned texture sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek authored and refractionpcsx2 committed Jun 20, 2022
1 parent fa3bd58 commit f536584
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pcsx2/Frontend/VulkanHostDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ std::string VulkanHostDisplay::GetDriverInfo() const
static bool UploadBufferToTexture(
Vulkan::Texture* texture, VkCommandBuffer cmdbuf, u32 width, u32 height, const void* data, u32 data_stride)
{
const u32 upload_stride = Common::AlignUpPow2(Vulkan::Util::GetTexelSize(texture->GetFormat()) * width,
g_vulkan_context->GetBufferCopyRowPitchAlignment());
const u32 texel_size = Vulkan::Util::GetTexelSize(texture->GetFormat());
const u32 upload_stride = Common::AlignUpPow2(texel_size * width, g_vulkan_context->GetBufferCopyRowPitchAlignment());
const u32 upload_size = upload_stride * height;

Vulkan::StreamBuffer& buf = g_vulkan_context->GetTextureUploadBuffer();
Expand All @@ -216,7 +216,7 @@ static bool UploadBufferToTexture(
StringUtil::StrideMemCpy(buf.GetCurrentHostPointer(), upload_stride, data, data_stride, upload_stride, height);
buf.CommitMemory(upload_size);

texture->UpdateFromBuffer(cmdbuf, 0, 0, 0, 0, width, height, width, buf.GetBuffer(), buf_offset);
texture->UpdateFromBuffer(cmdbuf, 0, 0, 0, 0, width, height, upload_stride / texel_size, buf.GetBuffer(), buf_offset);
return true;
}

Expand Down

0 comments on commit f536584

Please sign in to comment.