diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-12-01 15:16:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-01 15:16:56 +0100 |
commit | 1c21d6c2c2c82bea668f37beec150c6edcde1b81 (patch) | |
tree | 8c1c0c7d99b91dd705a5fd5477617f434bc42b11 /src/video_core/renderer_opengl/gl_staging_buffer_pool.h | |
parent | Merge pull request #12234 from abouvier/unbundle-gamemode (diff) | |
parent | gl_texture_cache: Enable async downloads (diff) | |
download | yuzu-1c21d6c2c2c82bea668f37beec150c6edcde1b81.tar yuzu-1c21d6c2c2c82bea668f37beec150c6edcde1b81.tar.gz yuzu-1c21d6c2c2c82bea668f37beec150c6edcde1b81.tar.bz2 yuzu-1c21d6c2c2c82bea668f37beec150c6edcde1b81.tar.lz yuzu-1c21d6c2c2c82bea668f37beec150c6edcde1b81.tar.xz yuzu-1c21d6c2c2c82bea668f37beec150c6edcde1b81.tar.zst yuzu-1c21d6c2c2c82bea668f37beec150c6edcde1b81.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_staging_buffer_pool.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_staging_buffer_pool.h b/src/video_core/renderer_opengl/gl_staging_buffer_pool.h index 60f72d3a0..07a56b4d2 100644 --- a/src/video_core/renderer_opengl/gl_staging_buffer_pool.h +++ b/src/video_core/renderer_opengl/gl_staging_buffer_pool.h @@ -26,23 +26,30 @@ struct StagingBufferMap { size_t offset = 0; OGLSync* sync; GLuint buffer; + size_t index; }; struct StagingBuffers { explicit StagingBuffers(GLenum storage_flags_, GLenum map_flags_); ~StagingBuffers(); - StagingBufferMap RequestMap(size_t requested_size, bool insert_fence); + StagingBufferMap RequestMap(size_t requested_size, bool insert_fence, bool deferred = false); + + void FreeDeferredStagingBuffer(size_t index); size_t RequestBuffer(size_t requested_size); std::optional<size_t> FindBuffer(size_t requested_size); - std::vector<OGLSync> syncs; - std::vector<OGLBuffer> buffers; - std::vector<u8*> maps; - std::vector<size_t> sizes; - std::vector<size_t> sync_indices; + struct StagingBufferAlloc { + OGLSync sync; + OGLBuffer buffer; + u8* map; + size_t size; + size_t sync_index; + bool deferred; + }; + std::vector<StagingBufferAlloc> allocs; GLenum storage_flags; GLenum map_flags; size_t current_sync_index = 0; @@ -85,7 +92,8 @@ public: ~StagingBufferPool() = default; StagingBufferMap RequestUploadBuffer(size_t size); - StagingBufferMap RequestDownloadBuffer(size_t size); + StagingBufferMap RequestDownloadBuffer(size_t size, bool deferred = false); + void FreeDeferredStagingBuffer(StagingBufferMap& buffer); private: StagingBuffers upload_buffers{GL_MAP_WRITE_BIT, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT}; |