diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-04-16 23:07:13 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-04-21 17:42:07 +0200 |
commit | 4c36b7856737556d9a7a0fb21eb710f614194b5d (patch) | |
tree | 621208445f515e876aa33c09a8f46c38cab86e78 /src/video_core/renderer_opengl/gl_rasterizer_cache.h | |
parent | RasterizerCache Redesign: Flush (diff) | |
download | yuzu-4c36b7856737556d9a7a0fb21eb710f614194b5d.tar yuzu-4c36b7856737556d9a7a0fb21eb710f614194b5d.tar.gz yuzu-4c36b7856737556d9a7a0fb21eb710f614194b5d.tar.bz2 yuzu-4c36b7856737556d9a7a0fb21eb710f614194b5d.tar.lz yuzu-4c36b7856737556d9a7a0fb21eb710f614194b5d.tar.xz yuzu-4c36b7856737556d9a7a0fb21eb710f614194b5d.tar.zst yuzu-4c36b7856737556d9a7a0fb21eb710f614194b5d.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 | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 4b21c555f..6263ef3e7 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -355,6 +355,12 @@ namespace OpenGL { class RasterizerOpenGL; +// This is used to store temporary big buffers, +// instead of creating/destroying all the time +struct RasterizerTemporaryMemory { + std::vector<std::vector<u8>> gl_buffer; +}; + class CachedSurface final : public RasterizerCacheObject { public: explicit CachedSurface(const SurfaceParams& params); @@ -393,11 +399,12 @@ public: } // Read/Write data in Switch memory to/from gl_buffer - void LoadGLBuffer(); - void FlushGLBuffer(); + void LoadGLBuffer(RasterizerTemporaryMemory& res_cache_tmp_mem); + void FlushGLBuffer(RasterizerTemporaryMemory& res_cache_tmp_mem); // Upload data in gl_buffer to this surface's texture - void UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle); + void UploadGLTexture(RasterizerTemporaryMemory& res_cache_tmp_mem, GLuint read_fb_handle, + GLuint draw_fb_handle); void UpdateSwizzle(Tegra::Texture::SwizzleSource swizzle_x, Tegra::Texture::SwizzleSource swizzle_y, @@ -425,13 +432,13 @@ public: } private: - void UploadGLMipmapTexture(u32 mip_map, GLuint read_fb_handle, GLuint draw_fb_handle); + void UploadGLMipmapTexture(RasterizerTemporaryMemory& res_cache_tmp_mem, u32 mip_map, + GLuint read_fb_handle, GLuint draw_fb_handle); void EnsureTextureDiscrepantView(); OGLTexture texture; OGLTexture discrepant_view; - std::vector<std::vector<u8>> gl_buffer; SurfaceParams params{}; GLenum gl_target{}; GLenum gl_internal_format{}; @@ -471,7 +478,7 @@ public: protected: void FlushObjectInner(const Surface& object) override { - object->FlushGLBuffer(); + object->FlushGLBuffer(temporal_memory); } private: @@ -520,6 +527,8 @@ private: std::array<Surface, Maxwell::NumRenderTargets> current_color_buffers; Surface last_depth_buffer; + RasterizerTemporaryMemory temporal_memory; + using SurfaceIntervalCache = boost::icl::interval_map<CacheAddr, Surface>; using SurfaceInterval = typename SurfaceIntervalCache::interval_type; |