diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-07-19 16:50:40 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-08-21 18:14:22 +0200 |
commit | 862bec001b7ada13ba0e97f95d6ad108ae8a8d0c (patch) | |
tree | d366f7768d0acd4cbe1514a57b9fddcfb4c79eaa /src/video_core/renderer_opengl/gl_buffer_cache.h | |
parent | Merge pull request #2748 from FernandoS27/align-memory (diff) | |
download | yuzu-862bec001b7ada13ba0e97f95d6ad108ae8a8d0c.tar yuzu-862bec001b7ada13ba0e97f95d6ad108ae8a8d0c.tar.gz yuzu-862bec001b7ada13ba0e97f95d6ad108ae8a8d0c.tar.bz2 yuzu-862bec001b7ada13ba0e97f95d6ad108ae8a8d0c.tar.lz yuzu-862bec001b7ada13ba0e97f95d6ad108ae8a8d0c.tar.xz yuzu-862bec001b7ada13ba0e97f95d6ad108ae8a8d0c.tar.zst yuzu-862bec001b7ada13ba0e97f95d6ad108ae8a8d0c.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_buffer_cache.h')
-rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index 8c8ac4038..fb93f22dd 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h @@ -7,7 +7,7 @@ #include <memory> #include "common/common_types.h" -#include "video_core/buffer_cache.h" +#include "video_core/buffer_cache/buffer_cache.h" #include "video_core/rasterizer_cache.h" #include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/renderer_opengl/gl_stream_buffer.h" @@ -21,7 +21,24 @@ namespace OpenGL { class OGLStreamBuffer; class RasterizerOpenGL; -class OGLBufferCache final : public VideoCommon::BufferCache<OGLBuffer, GLuint, OGLStreamBuffer> { +class CachedBufferBlock; + +using Buffer = std::shared_ptr<CachedBufferBlock>; + +class CachedBufferBlock : public VideoCommon::BufferBlock { +public: + explicit CachedBufferBlock(CacheAddr cache_addr, const std::size_t size); + ~CachedBufferBlock(); + + const GLuint* GetHandle() const { + return &gl_buffer.handle; + } + +private: + OGLBuffer gl_buffer{}; +}; + +class OGLBufferCache final : public VideoCommon::BufferCache<Buffer, GLuint, OGLStreamBuffer> { public: explicit OGLBufferCache(RasterizerOpenGL& rasterizer, Core::System& system, std::size_t stream_size); @@ -30,17 +47,19 @@ public: const GLuint* GetEmptyBuffer(std::size_t) override; protected: - OGLBuffer CreateBuffer(std::size_t size) override; + Buffer CreateBlock(CacheAddr cache_addr, std::size_t size) override; + + void WriteBarrier() override; - const GLuint* ToHandle(const OGLBuffer& buffer) override; + const GLuint* ToHandle(const Buffer& buffer) override; - void UploadBufferData(const OGLBuffer& buffer, std::size_t offset, std::size_t size, + void UploadBlockData(const Buffer& buffer, std::size_t offset, std::size_t size, const u8* data) override; - void DownloadBufferData(const OGLBuffer& buffer, std::size_t offset, std::size_t size, + void DownloadBlockData(const Buffer& buffer, std::size_t offset, std::size_t size, u8* data) override; - void CopyBufferData(const OGLBuffer& src, const OGLBuffer& dst, std::size_t src_offset, + void CopyBlock(const Buffer& src, const Buffer& dst, std::size_t src_offset, std::size_t dst_offset, std::size_t size) override; }; |