summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-03-22 23:40:53 +0100
committerGitHub <noreply@github.com>2019-03-22 23:40:53 +0100
commita7157fe27de5fc05037ec19e69f14064bd9696da (patch)
treee29237d96d66d10ce42eb156ee872583919e6f78
parentMerge pull request #2234 from lioncash/mutex (diff)
parentRevert "Devirtualize Register/Unregister and use a wrapper instead." (diff)
downloadyuzu-a7157fe27de5fc05037ec19e69f14064bd9696da.tar
yuzu-a7157fe27de5fc05037ec19e69f14064bd9696da.tar.gz
yuzu-a7157fe27de5fc05037ec19e69f14064bd9696da.tar.bz2
yuzu-a7157fe27de5fc05037ec19e69f14064bd9696da.tar.lz
yuzu-a7157fe27de5fc05037ec19e69f14064bd9696da.tar.xz
yuzu-a7157fe27de5fc05037ec19e69f14064bd9696da.tar.zst
yuzu-a7157fe27de5fc05037ec19e69f14064bd9696da.zip
-rw-r--r--src/video_core/rasterizer_cache.h4
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h8
3 files changed, 12 insertions, 8 deletions
diff --git a/src/video_core/rasterizer_cache.h b/src/video_core/rasterizer_cache.h
index ecd9986a0..9fc9f3056 100644
--- a/src/video_core/rasterizer_cache.h
+++ b/src/video_core/rasterizer_cache.h
@@ -132,7 +132,7 @@ protected:
}
/// 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};
object->SetIsRegistered(true);
@@ -142,7 +142,7 @@ protected:
}
/// 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};
object->SetIsRegistered(false);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 57329cd61..7bd0daa57 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -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
// the surface from the old one
Surface new_surface{RecreateSurface(surface, params)};
- UnregisterSurface(surface);
+ Unregister(surface);
Register(new_surface);
if (new_surface->IsUploaded()) {
RegisterReinterpretSurface(new_surface);
@@ -949,7 +949,7 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params, bool pres
return new_surface;
} else {
// 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,
Surface intersect) {
if (IsReinterpretInvalid(triggering_surface, intersect)) {
- UnregisterSurface(intersect);
+ Unregister(intersect);
return false;
}
if (!LayerFitReinterpretSurface(*this, triggering_surface, intersect)) {
if (IsReinterpretInvalidSecond(triggering_surface, intersect)) {
- UnregisterSurface(intersect);
+ Unregister(intersect);
return false;
}
FlushObject(intersect);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 9366f47f2..c919dd29b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -533,13 +533,17 @@ private:
return nullptr;
}
+ void Register(const Surface& object) {
+ RasterizerCache<Surface>::Register(object);
+ }
+
/// Unregisters an object from the cache
- void UnregisterSurface(const Surface& object) {
+ void Unregister(const Surface& object) {
if (object->IsReinterpreted()) {
auto interval = GetReinterpretInterval(object);
reinterpreted_surfaces.erase(interval);
}
- Unregister(object);
+ RasterizerCache<Surface>::Unregister(object);
}
};