gl_texture_cache: Enable async downloads
This commit is contained in:
parent
9b112107e2
commit
d1c878fb41
5 changed files with 16 additions and 9 deletions
|
@ -151,7 +151,7 @@ StagingBufferMap BufferCacheRuntime::DownloadStagingBuffer(size_t size, bool def
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferCacheRuntime::FreeDeferredStagingBuffer(StagingBufferMap& buffer) {
|
void BufferCacheRuntime::FreeDeferredStagingBuffer(StagingBufferMap& buffer) {
|
||||||
staging_buffer_pool.FreeDeferredStagingBuffer(buffer.index);
|
staging_buffer_pool.FreeDeferredStagingBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 BufferCacheRuntime::GetDeviceMemoryUsage() const {
|
u64 BufferCacheRuntime::GetDeviceMemoryUsage() const {
|
||||||
|
|
|
@ -45,6 +45,7 @@ StagingBufferMap StagingBuffers::RequestMap(size_t requested_size, bool insert_f
|
||||||
}
|
}
|
||||||
|
|
||||||
void StagingBuffers::FreeDeferredStagingBuffer(size_t index) {
|
void StagingBuffers::FreeDeferredStagingBuffer(size_t index) {
|
||||||
|
ASSERT(allocs[index].deferred);
|
||||||
allocs[index].deferred = false;
|
allocs[index].deferred = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +153,8 @@ StagingBufferMap StagingBufferPool::RequestDownloadBuffer(size_t size, bool defe
|
||||||
return download_buffers.RequestMap(size, false, deferred);
|
return download_buffers.RequestMap(size, false, deferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StagingBufferPool::FreeDeferredStagingBuffer(size_t index) {
|
void StagingBufferPool::FreeDeferredStagingBuffer(StagingBufferMap& buffer) {
|
||||||
download_buffers.FreeDeferredStagingBuffer(index);
|
download_buffers.FreeDeferredStagingBuffer(buffer.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace OpenGL
|
} // namespace OpenGL
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
|
|
||||||
StagingBufferMap RequestUploadBuffer(size_t size);
|
StagingBufferMap RequestUploadBuffer(size_t size);
|
||||||
StagingBufferMap RequestDownloadBuffer(size_t size, bool deferred = false);
|
StagingBufferMap RequestDownloadBuffer(size_t size, bool deferred = false);
|
||||||
void FreeDeferredStagingBuffer(size_t index);
|
void FreeDeferredStagingBuffer(StagingBufferMap& buffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StagingBuffers upload_buffers{GL_MAP_WRITE_BIT, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT};
|
StagingBuffers upload_buffers{GL_MAP_WRITE_BIT, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT};
|
||||||
|
|
|
@ -557,8 +557,12 @@ StagingBufferMap TextureCacheRuntime::UploadStagingBuffer(size_t size) {
|
||||||
return staging_buffer_pool.RequestUploadBuffer(size);
|
return staging_buffer_pool.RequestUploadBuffer(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
StagingBufferMap TextureCacheRuntime::DownloadStagingBuffer(size_t size) {
|
StagingBufferMap TextureCacheRuntime::DownloadStagingBuffer(size_t size, bool deferred) {
|
||||||
return staging_buffer_pool.RequestDownloadBuffer(size);
|
return staging_buffer_pool.RequestDownloadBuffer(size, deferred);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureCacheRuntime::FreeDeferredStagingBuffer(StagingBufferMap& buffer) {
|
||||||
|
staging_buffer_pool.FreeDeferredStagingBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 TextureCacheRuntime::GetDeviceMemoryUsage() const {
|
u64 TextureCacheRuntime::GetDeviceMemoryUsage() const {
|
||||||
|
|
|
@ -74,7 +74,9 @@ public:
|
||||||
|
|
||||||
StagingBufferMap UploadStagingBuffer(size_t size);
|
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 {
|
u64 GetDeviceLocalMemory() const {
|
||||||
return device_access_memory;
|
return device_access_memory;
|
||||||
|
@ -359,7 +361,7 @@ struct TextureCacheParams {
|
||||||
static constexpr bool FRAMEBUFFER_BLITS = true;
|
static constexpr bool FRAMEBUFFER_BLITS = true;
|
||||||
static constexpr bool HAS_EMULATED_COPIES = true;
|
static constexpr bool HAS_EMULATED_COPIES = true;
|
||||||
static constexpr bool HAS_DEVICE_MEMORY_INFO = 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 Runtime = OpenGL::TextureCacheRuntime;
|
||||||
using Image = OpenGL::Image;
|
using Image = OpenGL::Image;
|
||||||
|
@ -367,7 +369,7 @@ struct TextureCacheParams {
|
||||||
using ImageView = OpenGL::ImageView;
|
using ImageView = OpenGL::ImageView;
|
||||||
using Sampler = OpenGL::Sampler;
|
using Sampler = OpenGL::Sampler;
|
||||||
using Framebuffer = OpenGL::Framebuffer;
|
using Framebuffer = OpenGL::Framebuffer;
|
||||||
using AsyncBuffer = u32;
|
using AsyncBuffer = OpenGL::StagingBufferMap;
|
||||||
using BufferType = GLuint;
|
using BufferType = GLuint;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue