mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 12:35:29 +03:00
Cache staging buffer used for texture download
This commit is contained in:
parent
8c5e6d2bb4
commit
af7c54297f
@ -825,15 +825,16 @@ namespace skyline::gpu {
|
|||||||
WaitOnBacking();
|
WaitOnBacking();
|
||||||
|
|
||||||
if (tiling == vk::ImageTiling::eOptimal || !std::holds_alternative<memory::Image>(backing)) {
|
if (tiling == vk::ImageTiling::eOptimal || !std::holds_alternative<memory::Image>(backing)) {
|
||||||
auto stagingBuffer{gpu.memory.AllocateStagingBuffer(surfaceSize)};
|
if (!downloadStagingBuffer)
|
||||||
|
downloadStagingBuffer = gpu.memory.AllocateStagingBuffer(surfaceSize);
|
||||||
|
|
||||||
WaitOnFence();
|
WaitOnFence();
|
||||||
auto lCycle{gpu.scheduler.Submit([&](vk::raii::CommandBuffer &commandBuffer) {
|
auto lCycle{gpu.scheduler.Submit([&](vk::raii::CommandBuffer &commandBuffer) {
|
||||||
CopyIntoStagingBuffer(commandBuffer, stagingBuffer);
|
CopyIntoStagingBuffer(commandBuffer, downloadStagingBuffer);
|
||||||
})};
|
})};
|
||||||
lCycle->Wait(); // We block till the copy is complete
|
lCycle->Wait(); // We block till the copy is complete
|
||||||
|
|
||||||
CopyToGuest(stagingBuffer->data());
|
CopyToGuest(downloadStagingBuffer->data());
|
||||||
} else if (tiling == vk::ImageTiling::eLinear) {
|
} else if (tiling == vk::ImageTiling::eLinear) {
|
||||||
// We can optimize linear texture sync on a UMA by mapping the texture onto the CPU and copying directly from it rather than using a staging buffer
|
// We can optimize linear texture sync on a UMA by mapping the texture onto the CPU and copying directly from it rather than using a staging buffer
|
||||||
WaitOnFence();
|
WaitOnFence();
|
||||||
|
@ -406,6 +406,8 @@ namespace skyline::gpu {
|
|||||||
|
|
||||||
std::vector<TextureViewStorage> views;
|
std::vector<TextureViewStorage> views;
|
||||||
|
|
||||||
|
std::shared_ptr<memory::StagingBuffer> downloadStagingBuffer{};
|
||||||
|
|
||||||
u32 lastRenderPassIndex{}; //!< The index of the last render pass that used this texture
|
u32 lastRenderPassIndex{}; //!< The index of the last render pass that used this texture
|
||||||
texture::RenderPassUsage lastRenderPassUsage{texture::RenderPassUsage::None}; //!< The type of usage in the last render pass
|
texture::RenderPassUsage lastRenderPassUsage{texture::RenderPassUsage::None}; //!< The type of usage in the last render pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user