summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_rasterizer_cache.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h37
1 files changed, 10 insertions, 27 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index c8c615df2..8a6ca2a4b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -8,12 +8,12 @@
#include <map>
#include <memory>
#include <vector>
-#include <boost/icl/interval_map.hpp>
#include "common/common_types.h"
#include "common/hash.h"
#include "common/math_util.h"
#include "video_core/engines/maxwell_3d.h"
+#include "video_core/rasterizer_cache.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"
#include "video_core/textures/texture.h"
@@ -22,7 +22,6 @@ namespace OpenGL {
class CachedSurface;
using Surface = std::shared_ptr<CachedSurface>;
using SurfaceSurfaceRect_Tuple = std::tuple<Surface, Surface, MathUtil::Rectangle<u32>>;
-using PageMap = boost::icl::interval_map<u64, int>;
struct SurfaceParams {
enum class PixelFormat {
@@ -632,11 +631,6 @@ struct SurfaceParams {
/// Returns the CPU virtual address for this surface
VAddr GetCpuAddr() const;
- /// Returns true if the specified region overlaps with this surface's region in Switch memory
- bool IsOverlappingRegion(Tegra::GPUVAddr region_addr, size_t region_size) const {
- return addr <= (region_addr + region_size) && region_addr <= (addr + size_in_bytes);
- }
-
/// Creates SurfaceParams from a texture configuration
static SurfaceParams CreateForTexture(const Tegra::Texture::FullTextureInfo& config);
@@ -708,6 +702,14 @@ class CachedSurface final {
public:
CachedSurface(const SurfaceParams& params);
+ Tegra::GPUVAddr GetAddr() const {
+ return params.addr;
+ }
+
+ size_t GetSizeInBytes() const {
+ return params.size_in_bytes;
+ }
+
const OGLTexture& Texture() const {
return texture;
}
@@ -737,10 +739,9 @@ private:
SurfaceParams params;
};
-class RasterizerCacheOpenGL final : NonCopyable {
+class RasterizerCacheOpenGL final : public RasterizerCache<Surface> {
public:
RasterizerCacheOpenGL();
- ~RasterizerCacheOpenGL();
/// Get a surface based on the texture configuration
Surface GetTextureSurface(const Tegra::Texture::FullTextureInfo& config);
@@ -755,12 +756,6 @@ public:
/// Tries to find a framebuffer GPU address based on the provided CPU address
Surface TryFindFramebufferSurface(VAddr cpu_addr) const;
- /// Write any cached resources overlapping the region back to memory (if dirty)
- void FlushRegion(Tegra::GPUVAddr addr, size_t size);
-
- /// Mark the specified region as being invalidated
- void InvalidateRegion(Tegra::GPUVAddr addr, size_t size);
-
private:
void LoadSurface(const Surface& surface);
Surface GetSurface(const SurfaceParams& params, bool preserve_contents = true);
@@ -768,24 +763,12 @@ private:
/// Recreates a surface with new parameters
Surface RecreateSurface(const Surface& surface, const SurfaceParams& new_params);
- /// Register surface into the cache
- void RegisterSurface(const Surface& surface);
-
- /// Remove surface from the cache
- void UnregisterSurface(const Surface& surface);
-
/// Reserves a unique surface that can be reused later
void ReserveSurface(const Surface& surface);
/// Tries to get a reserved surface for the specified parameters
Surface TryGetReservedSurface(const SurfaceParams& params);
- /// Increase/decrease the number of surface in pages touching the specified region
- void UpdatePagesCachedCount(Tegra::GPUVAddr addr, u64 size, int delta);
-
- std::unordered_map<Tegra::GPUVAddr, Surface> surface_cache;
- PageMap cached_pages;
-
/// The surface reserve is a "backup" cache, this is where we put unique surfaces that have
/// previously been used. This is to prevent surfaces from being constantly created and
/// destroyed when used with different surface parameters.