yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

gl_texture_cache: Enable async downloads

This commit is contained in:
Ameer J 2023-08-13 23:17:28 -04:00
parent 9b112107e2
commit d1c878fb41
5 changed files with 16 additions and 9 deletions

View File

@ -151,7 +151,7 @@ StagingBufferMap BufferCacheRuntime::DownloadStagingBuffer(size_t size, bool def
}
void BufferCacheRuntime::FreeDeferredStagingBuffer(StagingBufferMap& buffer) {
staging_buffer_pool.FreeDeferredStagingBuffer(buffer.index);
staging_buffer_pool.FreeDeferredStagingBuffer(buffer);
}
u64 BufferCacheRuntime::GetDeviceMemoryUsage() const {

View File

@ -45,6 +45,7 @@ StagingBufferMap StagingBuffers::RequestMap(size_t requested_size, bool insert_f
}
void StagingBuffers::FreeDeferredStagingBuffer(size_t index) {
ASSERT(allocs[index].deferred);
allocs[index].deferred = false;
}
@ -152,8 +153,8 @@ StagingBufferMap StagingBufferPool::RequestDownloadBuffer(size_t size, bool defe
return download_buffers.RequestMap(size, false, deferred);
}
void StagingBufferPool::FreeDeferredStagingBuffer(size_t index) {
download_buffers.FreeDeferredStagingBuffer(index);
void StagingBufferPool::FreeDeferredStagingBuffer(StagingBufferMap& buffer) {
download_buffers.FreeDeferredStagingBuffer(buffer.index);
}
} // namespace OpenGL

View File

@ -93,7 +93,7 @@ public:
StagingBufferMap RequestUploadBuffer(size_t size);
StagingBufferMap RequestDownloadBuffer(size_t size, bool deferred = false);
void FreeDeferredStagingBuffer(size_t index);
void FreeDeferredStagingBuffer(StagingBufferMap& buffer);
private:
StagingBuffers upload_buffers{GL_MAP_WRITE_BIT, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT};

View File

@ -557,8 +557,12 @@ StagingBufferMap TextureCacheRuntime::UploadStagingBuffer(size_t size) {
return staging_buffer_pool.RequestUploadBuffer(size);
}
StagingBufferMap TextureCacheRuntime::DownloadStagingBuffer(size_t size) {
return staging_buffer_pool.RequestDownloadBuffer(size);
StagingBufferMap TextureCacheRuntime::DownloadStagingBuffer(size_t size, bool deferred) {
return staging_buffer_pool.RequestDownloadBuffer(size, deferred);
}
void TextureCacheRuntime::FreeDeferredStagingBuffer(StagingBufferMap& buffer) {
staging_buffer_pool.FreeDeferredStagingBuffer(buffer);
}
u64 TextureCacheRuntime::GetDeviceMemoryUsage() const {

View File

@ -74,7 +74,9 @@ public:
StagingBufferMap UploadStagingBuffer(size_t size);
StagingBufferMap DownloadStagingBuffer(size_t size);
StagingBufferMap DownloadStagingBuffer(size_t size, bool deferred = false);
void FreeDeferredStagingBuffer(StagingBufferMap& buffer);
u64 GetDeviceLocalMemory() const {
return device_access_memory;
@ -359,7 +361,7 @@ struct TextureCacheParams {
static constexpr bool FRAMEBUFFER_BLITS = true;
static constexpr bool HAS_EMULATED_COPIES = true;
static constexpr bool HAS_DEVICE_MEMORY_INFO = true;
static constexpr bool IMPLEMENTS_ASYNC_DOWNLOADS = false;
static constexpr bool IMPLEMENTS_ASYNC_DOWNLOADS = true;
using Runtime = OpenGL::TextureCacheRuntime;
using Image = OpenGL::Image;
@ -367,7 +369,7 @@ struct TextureCacheParams {
using ImageView = OpenGL::ImageView;
using Sampler = OpenGL::Sampler;
using Framebuffer = OpenGL::Framebuffer;
using AsyncBuffer = u32;
using AsyncBuffer = OpenGL::StagingBufferMap;
using BufferType = GLuint;
};