diff options
author | bunnei <bunneidev@gmail.com> | 2018-07-21 20:36:32 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-07-22 03:51:06 +0200 |
commit | 4301f0b53935cfedd80ab6d8fd3873f6e7706ba2 (patch) | |
tree | 1fd69b29887775eac666b00aafbce0f553558cc6 /src/video_core/renderer_opengl/gl_rasterizer_cache.h | |
parent | gl_rasterizer_cache: Use zeta_width and zeta_height registers for depth buffer. (diff) | |
download | yuzu-4301f0b53935cfedd80ab6d8fd3873f6e7706ba2.tar yuzu-4301f0b53935cfedd80ab6d8fd3873f6e7706ba2.tar.gz yuzu-4301f0b53935cfedd80ab6d8fd3873f6e7706ba2.tar.bz2 yuzu-4301f0b53935cfedd80ab6d8fd3873f6e7706ba2.tar.lz yuzu-4301f0b53935cfedd80ab6d8fd3873f6e7706ba2.tar.xz yuzu-4301f0b53935cfedd80ab6d8fd3873f6e7706ba2.tar.zst yuzu-4301f0b53935cfedd80ab6d8fd3873f6e7706ba2.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer_cache.h')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index d00746e8c..5124199b2 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -10,7 +10,6 @@ #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/renderer_opengl/gl_resource_manager.h" @@ -137,6 +136,7 @@ struct SurfaceParams { ASSERT(static_cast<size_t>(format) < bpp_table.size()); return bpp_table[static_cast<size_t>(format)]; } + u32 GetFormatBpp() const { return GetFormatBpp(pixel_format); } @@ -369,6 +369,18 @@ struct SurfaceParams { Tegra::GPUVAddr zeta_address, Tegra::DepthFormat format); + bool operator==(const SurfaceParams& other) const { + return std::tie(addr, is_tiled, block_height, pixel_format, component_type, type, width, + height, unaligned_height, size_in_bytes) == + std::tie(other.addr, other.is_tiled, other.block_height, other.pixel_format, + other.component_type, other.type, other.width, other.height, + other.unaligned_height, other.size_in_bytes); + } + + bool operator!=(const SurfaceParams& other) const { + return !operator==(other); + } + Tegra::GPUVAddr addr; bool is_tiled; u32 block_height; @@ -381,24 +393,6 @@ struct SurfaceParams { size_t size_in_bytes; }; -/// Hashable variation of SurfaceParams, used for a key in the surface cache -struct SurfaceKey : Common::HashableStruct<SurfaceParams> { - static SurfaceKey Create(const SurfaceParams& params) { - SurfaceKey res; - res.state = params; - return res; - } -}; - -namespace std { -template <> -struct hash<SurfaceKey> { - size_t operator()(const SurfaceKey& k) const { - return k.Hash(); - } -}; -} // namespace std - class CachedSurface final { public: CachedSurface(const SurfaceParams& params); @@ -444,8 +438,8 @@ public: SurfaceSurfaceRect_Tuple GetFramebufferSurfaces(bool using_color_fb, bool using_depth_fb, const MathUtil::Rectangle<s32>& viewport); - /// Marks the specified surface as "dirty", in that it is out of sync with Switch memory - void MarkSurfaceAsDirty(const Surface& surface); + /// Flushes the surface to Switch memory + void FlushSurface(const Surface& surface); /// Tries to find a framebuffer GPU address based on the provided CPU address Surface TryFindFramebufferSurface(VAddr cpu_addr) const; @@ -469,7 +463,7 @@ private: /// Increase/decrease the number of surface in pages touching the specified region void UpdatePagesCachedCount(Tegra::GPUVAddr addr, u64 size, int delta); - std::unordered_map<SurfaceKey, Surface> surface_cache; + std::unordered_map<Tegra::GPUVAddr, Surface> surface_cache; PageMap cached_pages; OGLFramebuffer read_framebuffer; |