mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-08 23:59:57 +00:00
Merge pull request #2277 from bunnei/fix-smo-transitions
Revert "Devirtualize Register/Unregister and use a wrapper instead."
This commit is contained in:
commit
a7157fe27d
3 changed files with 12 additions and 8 deletions
|
@ -132,7 +132,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Register an object into the cache
|
/// Register an object into the cache
|
||||||
void Register(const T& object) {
|
virtual void Register(const T& object) {
|
||||||
std::lock_guard<std::recursive_mutex> lock{mutex};
|
std::lock_guard<std::recursive_mutex> lock{mutex};
|
||||||
|
|
||||||
object->SetIsRegistered(true);
|
object->SetIsRegistered(true);
|
||||||
|
@ -142,7 +142,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unregisters an object from the cache
|
/// Unregisters an object from the cache
|
||||||
void Unregister(const T& object) {
|
virtual void Unregister(const T& object) {
|
||||||
std::lock_guard<std::recursive_mutex> lock{mutex};
|
std::lock_guard<std::recursive_mutex> lock{mutex};
|
||||||
|
|
||||||
object->SetIsRegistered(false);
|
object->SetIsRegistered(false);
|
||||||
|
|
|
@ -941,7 +941,7 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params, bool pres
|
||||||
// If surface parameters changed and we care about keeping the previous data, recreate
|
// If surface parameters changed and we care about keeping the previous data, recreate
|
||||||
// the surface from the old one
|
// the surface from the old one
|
||||||
Surface new_surface{RecreateSurface(surface, params)};
|
Surface new_surface{RecreateSurface(surface, params)};
|
||||||
UnregisterSurface(surface);
|
Unregister(surface);
|
||||||
Register(new_surface);
|
Register(new_surface);
|
||||||
if (new_surface->IsUploaded()) {
|
if (new_surface->IsUploaded()) {
|
||||||
RegisterReinterpretSurface(new_surface);
|
RegisterReinterpretSurface(new_surface);
|
||||||
|
@ -949,7 +949,7 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params, bool pres
|
||||||
return new_surface;
|
return new_surface;
|
||||||
} else {
|
} else {
|
||||||
// Delete the old surface before creating a new one to prevent collisions.
|
// Delete the old surface before creating a new one to prevent collisions.
|
||||||
UnregisterSurface(surface);
|
Unregister(surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1304,12 +1304,12 @@ static bool IsReinterpretInvalidSecond(const Surface render_surface,
|
||||||
bool RasterizerCacheOpenGL::PartialReinterpretSurface(Surface triggering_surface,
|
bool RasterizerCacheOpenGL::PartialReinterpretSurface(Surface triggering_surface,
|
||||||
Surface intersect) {
|
Surface intersect) {
|
||||||
if (IsReinterpretInvalid(triggering_surface, intersect)) {
|
if (IsReinterpretInvalid(triggering_surface, intersect)) {
|
||||||
UnregisterSurface(intersect);
|
Unregister(intersect);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!LayerFitReinterpretSurface(*this, triggering_surface, intersect)) {
|
if (!LayerFitReinterpretSurface(*this, triggering_surface, intersect)) {
|
||||||
if (IsReinterpretInvalidSecond(triggering_surface, intersect)) {
|
if (IsReinterpretInvalidSecond(triggering_surface, intersect)) {
|
||||||
UnregisterSurface(intersect);
|
Unregister(intersect);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
FlushObject(intersect);
|
FlushObject(intersect);
|
||||||
|
|
|
@ -533,13 +533,17 @@ private:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Register(const Surface& object) {
|
||||||
|
RasterizerCache<Surface>::Register(object);
|
||||||
|
}
|
||||||
|
|
||||||
/// Unregisters an object from the cache
|
/// Unregisters an object from the cache
|
||||||
void UnregisterSurface(const Surface& object) {
|
void Unregister(const Surface& object) {
|
||||||
if (object->IsReinterpreted()) {
|
if (object->IsReinterpreted()) {
|
||||||
auto interval = GetReinterpretInterval(object);
|
auto interval = GetReinterpretInterval(object);
|
||||||
reinterpreted_surfaces.erase(interval);
|
reinterpreted_surfaces.erase(interval);
|
||||||
}
|
}
|
||||||
Unregister(object);
|
RasterizerCache<Surface>::Unregister(object);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue