mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-24 02:54:35 +00:00
Fix image extent in buffer copy to image (#2961)
This commit is contained in:
parent
f9bbde9c79
commit
e518a7062c
@ -538,10 +538,16 @@ void TextureCache::RefreshImage(Image& image, Vulkan::Scheduler* custom_schedule
|
|||||||
image.mip_hashes[m] = hash;
|
image.mip_hashes[m] = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto mip_pitch = static_cast<u32>(mip.pitch);
|
||||||
|
auto mip_height = static_cast<u32>(mip.height);
|
||||||
|
|
||||||
|
auto image_extent_width = mip_pitch ? std::min(mip_pitch, width) : width;
|
||||||
|
auto image_extent_height = mip_height ? std::min(mip_height, height) : height;
|
||||||
|
|
||||||
image_copy.push_back({
|
image_copy.push_back({
|
||||||
.bufferOffset = mip.offset,
|
.bufferOffset = mip.offset,
|
||||||
.bufferRowLength = static_cast<u32>(mip.pitch),
|
.bufferRowLength = mip_pitch,
|
||||||
.bufferImageHeight = static_cast<u32>(mip.height),
|
.bufferImageHeight = mip_height,
|
||||||
.imageSubresource{
|
.imageSubresource{
|
||||||
.aspectMask = image.aspect_mask & ~vk::ImageAspectFlagBits::eStencil,
|
.aspectMask = image.aspect_mask & ~vk::ImageAspectFlagBits::eStencil,
|
||||||
.mipLevel = m,
|
.mipLevel = m,
|
||||||
@ -549,7 +555,7 @@ void TextureCache::RefreshImage(Image& image, Vulkan::Scheduler* custom_schedule
|
|||||||
.layerCount = num_layers,
|
.layerCount = num_layers,
|
||||||
},
|
},
|
||||||
.imageOffset = {0, 0, 0},
|
.imageOffset = {0, 0, 0},
|
||||||
.imageExtent = {width, height, depth},
|
.imageExtent = {image_extent_width, image_extent_height, depth},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user