From dafcfa68ca0d14ea13e74b89f1bb01713add0a83 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Fri, 11 Mar 2022 21:33:10 +0530 Subject: [PATCH] Transition texture layout to `eGeneral` after creation As we no longer set the layout to general inside the Texture constructor, yet, we need it to be set prior to the image being used as an attachment. We need to transition the layout to `eGeneral` after creation of the texture object. --- app/src/main/cpp/skyline/gpu/texture/texture.cpp | 2 ++ app/src/main/cpp/skyline/gpu/texture_manager.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/app/src/main/cpp/skyline/gpu/texture/texture.cpp b/app/src/main/cpp/skyline/gpu/texture/texture.cpp index 106e64ec..58958cd3 100644 --- a/app/src/main/cpp/skyline/gpu/texture/texture.cpp +++ b/app/src/main/cpp/skyline/gpu/texture/texture.cpp @@ -148,6 +148,8 @@ namespace skyline::gpu { return stagingBuffer; } 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 into it rather than a staging buffer + if (layout == vk::ImageLayout::eUndefined) + TransitionLayout(vk::ImageLayout::eGeneral); bufferData = std::get(backing).data(); if (cycle.lock() != pCycle) WaitOnFence(); diff --git a/app/src/main/cpp/skyline/gpu/texture_manager.cpp b/app/src/main/cpp/skyline/gpu/texture_manager.cpp index 08091518..f72e6735 100644 --- a/app/src/main/cpp/skyline/gpu/texture_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/texture_manager.cpp @@ -69,6 +69,7 @@ namespace skyline::gpu { // Create a texture as we cannot find one that matches auto texture{std::make_shared(gpu, guestTexture)}; + texture->TransitionLayout(vk::ImageLayout::eGeneral); auto it{texture->guest->mappings.begin()}; textures.emplace(mappingEnd, TextureMapping{texture, it, guestMapping}); while ((++it) != texture->guest->mappings.end()) {