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.
This commit is contained in:
PixelyIon 2022-03-11 21:33:10 +05:30
parent 5dea15632c
commit dafcfa68ca
2 changed files with 3 additions and 0 deletions

View File

@ -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<memory::Image>(backing).data();
if (cycle.lock() != pCycle)
WaitOnFence();

View File

@ -69,6 +69,7 @@ namespace skyline::gpu {
// Create a texture as we cannot find one that matches
auto texture{std::make_shared<Texture>(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()) {