mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Consolidate NCE::TrapRegions
functionality into CreateTrap
`NCE::TrapRegions` was a bit too overloaded as a method as it implicitly trapped which was unnecessary in all current usage cases, this has now been made more explicit by consolidating the functionality into `NCE::CreateTrap` which handles just creation of the trap and nothing past that, `RetrapRegions` has been renamed to `TrapRegions` and handles all trapping now. Co-authored-by: Billy Laws <blaws05@gmail.com>
This commit is contained in:
@ -17,7 +17,7 @@ namespace skyline::gpu {
|
||||
|
||||
// We can't just capture this in the lambda since the lambda could exceed the lifetime of the buffer
|
||||
std::weak_ptr<Buffer> weakThis{shared_from_this()};
|
||||
trapHandle = gpu.state.nce->TrapRegions(*guest, true, [weakThis] {
|
||||
trapHandle = gpu.state.nce->CreateTrap(*guest, [weakThis] {
|
||||
auto buffer{weakThis.lock()};
|
||||
if (!buffer)
|
||||
return;
|
||||
@ -107,7 +107,7 @@ namespace skyline::gpu {
|
||||
BlockAllCpuBackingWrites();
|
||||
AdvanceSequence(); // The GPU will modify buffer contents so advance to the next sequence
|
||||
|
||||
gpu.state.nce->RetrapRegions(*trapHandle, false);
|
||||
gpu.state.nce->TrapRegions(*trapHandle, false);
|
||||
}
|
||||
|
||||
void Buffer::WaitOnFence() {
|
||||
@ -163,7 +163,7 @@ namespace skyline::gpu {
|
||||
AdvanceSequence(); // We are modifying GPU backing contents so advance to the next sequence
|
||||
|
||||
if (!skipTrap)
|
||||
gpu.state.nce->RetrapRegions(*trapHandle, true); // Trap any future CPU writes to this buffer, must be done before the memcpy so that any modifications during the copy are tracked
|
||||
gpu.state.nce->TrapRegions(*trapHandle, true); // Trap any future CPU writes to this buffer, must be done before the memcpy so that any modifications during the copy are tracked
|
||||
std::memcpy(backing.data(), mirror.data(), mirror.size());
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ namespace skyline::gpu {
|
||||
}
|
||||
|
||||
if (!skipTrap)
|
||||
gpu.state.nce->RetrapRegions(*trapHandle, true);
|
||||
gpu.state.nce->TrapRegions(*trapHandle, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ namespace skyline::gpu {
|
||||
|
||||
// We can't just capture `this` in the lambda since the lambda could exceed the lifetime of the buffer
|
||||
std::weak_ptr<Texture> weakThis{weak_from_this()};
|
||||
trapHandle = gpu.state.nce->TrapRegions(mappings, true, [weakThis] {
|
||||
trapHandle = gpu.state.nce->CreateTrap(mappings, [weakThis] {
|
||||
auto texture{weakThis.lock()};
|
||||
if (!texture)
|
||||
return;
|
||||
@ -690,7 +690,7 @@ namespace skyline::gpu {
|
||||
if (gpuDirty && dirtyState == DirtyState::Clean) {
|
||||
// If a texture is Clean then we can just transition it to being GPU dirty and retrap it
|
||||
dirtyState = DirtyState::GpuDirty;
|
||||
gpu.state.nce->RetrapRegions(*trapHandle, false);
|
||||
gpu.state.nce->TrapRegions(*trapHandle, false);
|
||||
return;
|
||||
} else if (dirtyState != DirtyState::CpuDirty) {
|
||||
return; // If the texture has not been modified on the CPU, there is no need to synchronize it
|
||||
@ -709,7 +709,7 @@ namespace skyline::gpu {
|
||||
cycle = lCycle;
|
||||
}
|
||||
|
||||
gpu.state.nce->RetrapRegions(*trapHandle, !gpuDirty); // Trap any future CPU reads (optionally) + writes to this texture
|
||||
gpu.state.nce->TrapRegions(*trapHandle, !gpuDirty); // Trap any future CPU reads (optionally) + writes to this texture
|
||||
}
|
||||
|
||||
void Texture::SynchronizeHostInline(const vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr<FenceCycle> &pCycle, bool gpuDirty) {
|
||||
@ -722,7 +722,7 @@ namespace skyline::gpu {
|
||||
std::scoped_lock lock{stateMutex};
|
||||
if (gpuDirty && dirtyState == DirtyState::Clean) {
|
||||
dirtyState = DirtyState::GpuDirty;
|
||||
gpu.state.nce->RetrapRegions(*trapHandle, false);
|
||||
gpu.state.nce->TrapRegions(*trapHandle, false);
|
||||
return;
|
||||
} else if (dirtyState != DirtyState::CpuDirty) {
|
||||
return;
|
||||
@ -739,7 +739,7 @@ namespace skyline::gpu {
|
||||
cycle = pCycle;
|
||||
}
|
||||
|
||||
gpu.state.nce->RetrapRegions(*trapHandle, !gpuDirty); // Trap any future CPU reads (optionally) + writes to this texture
|
||||
gpu.state.nce->TrapRegions(*trapHandle, !gpuDirty); // Trap any future CPU reads (optionally) + writes to this texture
|
||||
}
|
||||
|
||||
void Texture::SynchronizeGuest(bool cpuDirty, bool skipTrap) {
|
||||
@ -790,7 +790,7 @@ namespace skyline::gpu {
|
||||
if (cpuDirty)
|
||||
gpu.state.nce->DeleteTrap(*trapHandle);
|
||||
else
|
||||
gpu.state.nce->RetrapRegions(*trapHandle, true); // Trap any future CPU writes to this texture
|
||||
gpu.state.nce->TrapRegions(*trapHandle, true); // Trap any future CPU writes to this texture
|
||||
}
|
||||
|
||||
std::shared_ptr<TextureView> Texture::GetView(vk::ImageViewType type, vk::ImageSubresourceRange range, texture::Format pFormat, vk::ComponentMapping mapping) {
|
||||
|
Reference in New Issue
Block a user