mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-24 03:31:48 +01:00
Attach TextureView
to FenceCycle
The lifetime of `TextureView` objects wasn't correctly managed as they weren't being attached the the `FenceCycle` in `AttachTexture`, this led to them getting deleted and causing all sorts of UB.
This commit is contained in:
parent
ffaefc82d3
commit
cb7c3602e7
@ -46,7 +46,7 @@ namespace skyline::gpu::interconnect {
|
||||
lastSubpassDepthStencilAttachment = depthStencilAttachment;
|
||||
}};
|
||||
|
||||
if (renderPass == nullptr || (renderPass && (renderPass->renderArea != renderArea || subpassCount >= gpu.traits.quirks.maxSubpassCount))) {
|
||||
if (renderPass == nullptr || renderPass->renderArea != renderArea || subpassCount >= gpu.traits.quirks.maxSubpassCount) {
|
||||
// We need to create a render pass if one doesn't already exist or the current one isn't compatible
|
||||
if (renderPass != nullptr)
|
||||
nodes.emplace_back(std::in_place_type_t<node::RenderPassEndNode>());
|
||||
@ -101,6 +101,8 @@ namespace skyline::gpu::interconnect {
|
||||
// Avoids a potential deadlock with this resource being locked while acquiring the TextureManager lock while the thread owning it tries to acquire a lock on this texture
|
||||
textureManagerLock.emplace(gpu.texture);
|
||||
|
||||
cycle->AttachObject(view->shared_from_this());
|
||||
|
||||
bool didLock{view->LockWithTag(tag)};
|
||||
if (didLock)
|
||||
attachedTextures.emplace_back(view->texture);
|
||||
@ -286,7 +288,7 @@ namespace skyline::gpu::interconnect {
|
||||
nodes.clear();
|
||||
|
||||
for (const auto &attachedTexture : attachedTextures) {
|
||||
cycle->AttachObject(attachedTexture.texture);
|
||||
// We don't need to attach the Texture to the cycle as a TextureView will already be attached
|
||||
cycle->ChainCycle(attachedTexture->cycle);
|
||||
attachedTexture->cycle = cycle;
|
||||
}
|
||||
|
@ -809,7 +809,7 @@ namespace skyline::gpu {
|
||||
if (source->layout != vk::ImageLayout::eTransferSrcOptimal) {
|
||||
commandBuffer.pipelineBarrier(vk::PipelineStageFlagBits::eTopOfPipe, vk::PipelineStageFlagBits::eTransfer, {}, {}, {}, vk::ImageMemoryBarrier{
|
||||
.image = sourceBacking,
|
||||
.srcAccessMask = vk::AccessFlagBits::eMemoryRead | vk::AccessFlagBits::eMemoryWrite,
|
||||
.srcAccessMask = vk::AccessFlagBits::eMemoryWrite,
|
||||
.dstAccessMask = vk::AccessFlagBits::eTransferRead,
|
||||
.oldLayout = source->layout,
|
||||
.newLayout = vk::ImageLayout::eTransferSrcOptimal,
|
||||
@ -823,7 +823,7 @@ namespace skyline::gpu {
|
||||
if (layout != vk::ImageLayout::eTransferDstOptimal) {
|
||||
commandBuffer.pipelineBarrier(layout != vk::ImageLayout::eUndefined ? vk::PipelineStageFlagBits::eTopOfPipe : vk::PipelineStageFlagBits::eBottomOfPipe, vk::PipelineStageFlagBits::eTransfer, {}, {}, {}, vk::ImageMemoryBarrier{
|
||||
.image = destinationBacking,
|
||||
.srcAccessMask = vk::AccessFlagBits::eMemoryRead | vk::AccessFlagBits::eMemoryWrite,
|
||||
.srcAccessMask = vk::AccessFlagBits::eMemoryRead,
|
||||
.dstAccessMask = vk::AccessFlagBits::eTransferWrite,
|
||||
.oldLayout = layout,
|
||||
.newLayout = vk::ImageLayout::eTransferDstOptimal,
|
||||
|
Loading…
Reference in New Issue
Block a user