diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2023-02-22 06:26:07 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2023-02-22 06:26:07 +0100 |
commit | 090bc588e5498c6a2cea136d28bfe43354aa2096 (patch) | |
tree | b3502ca38982960bc25664b6e860c45bd062d8fb /src/video_core/texture_cache/texture_cache_base.h | |
parent | Merge pull request #9847 from german77/timeout (diff) | |
download | yuzu-090bc588e5498c6a2cea136d28bfe43354aa2096.tar yuzu-090bc588e5498c6a2cea136d28bfe43354aa2096.tar.gz yuzu-090bc588e5498c6a2cea136d28bfe43354aa2096.tar.bz2 yuzu-090bc588e5498c6a2cea136d28bfe43354aa2096.tar.lz yuzu-090bc588e5498c6a2cea136d28bfe43354aa2096.tar.xz yuzu-090bc588e5498c6a2cea136d28bfe43354aa2096.tar.zst yuzu-090bc588e5498c6a2cea136d28bfe43354aa2096.zip |
Diffstat (limited to 'src/video_core/texture_cache/texture_cache_base.h')
-rw-r--r-- | src/video_core/texture_cache/texture_cache_base.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index 485eaabaa..013836933 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h @@ -3,6 +3,7 @@ #pragma once +#include <atomic> #include <deque> #include <limits> #include <mutex> @@ -18,6 +19,7 @@ #include "common/lru_cache.h" #include "common/polyfill_ranges.h" #include "common/scratch_buffer.h" +#include "common/thread_worker.h" #include "video_core/compatible_formats.h" #include "video_core/control/channel_state_cache.h" #include "video_core/delayed_destruction_ring.h" @@ -54,6 +56,14 @@ struct ImageViewInOut { ImageViewId id{}; }; +struct AsyncDecodeContext { + ImageId image_id; + Common::ScratchBuffer<u8> decoded_data; + std::vector<BufferImageCopy> copies; + std::mutex mutex; + std::atomic_bool complete; +}; + using TextureCacheGPUMap = std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>; class TextureCacheChannelInfo : public ChannelInfo { @@ -377,6 +387,9 @@ private: bool ScaleDown(Image& image); u64 GetScaledImageSizeBytes(const ImageBase& image); + void QueueAsyncDecode(Image& image, ImageId image_id); + void TickAsyncDecode(); + Runtime& runtime; VideoCore::RasterizerInterface& rasterizer; @@ -430,6 +443,9 @@ private: u64 modification_tick = 0; u64 frame_tick = 0; + + Common::ThreadWorker texture_decode_worker{1, "TextureDecoder"}; + std::vector<std::unique_ptr<AsyncDecodeContext>> async_decodes; }; } // namespace VideoCommon |