diff options
| author | 2019-06-14 15:41:28 -0400 | |
|---|---|---|
| committer | 2019-06-20 21:38:34 -0300 | |
| commit | 03d489dcf5dbe13dff1ff788c609f964dd24019c (patch) | |
| tree | c0de7fa6a187b9cd4fa83f282ee17e92a784334b | |
| parent | gl_texture_cache: Use Stream Buffers instead of Persistant for Buffer Copies. (diff) | |
| download | yuzu-03d489dcf5dbe13dff1ff788c609f964dd24019c.tar.gz yuzu-03d489dcf5dbe13dff1ff788c609f964dd24019c.tar.xz yuzu-03d489dcf5dbe13dff1ff788c609f964dd24019c.zip | |
texture_cache: Initialize all siblings to invalid pixel format.
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 7a9b4c27d..8213f434d 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -227,12 +227,18 @@ protected: | |||
| 227 | } | 227 | } |
| 228 | SetEmptyDepthBuffer(); | 228 | SetEmptyDepthBuffer(); |
| 229 | staging_cache.SetSize(2); | 229 | staging_cache.SetSize(2); |
| 230 | siblings_table[PixelFormat::Z16] = PixelFormat::R16F; | 230 | auto make_siblings = ([this](PixelFormat a, PixelFormat b) { |
| 231 | siblings_table[PixelFormat::Z32F] = PixelFormat::R32F; | 231 | siblings_table[a] = b; |
| 232 | siblings_table[PixelFormat::Z32FS8] = PixelFormat::RG32F; | 232 | siblings_table[b] = a; |
| 233 | siblings_table[PixelFormat::R16F] = PixelFormat::Z16; | 233 | }); |
| 234 | siblings_table[PixelFormat::R32F] = PixelFormat::Z32F; | 234 | const u32 max_formats = static_cast<u32>(PixelFormat::Max); |
| 235 | siblings_table[PixelFormat::RG32F] = PixelFormat::Z32FS8; | 235 | siblings_table.reserve(max_formats); |
| 236 | for (u32 i = 0; i < max_formats; i++) { | ||
| 237 | siblings_table[static_cast<PixelFormat>(i)] = PixelFormat::Invalid; | ||
| 238 | } | ||
| 239 | make_siblings(PixelFormat::Z16, PixelFormat::R16F); | ||
| 240 | make_siblings(PixelFormat::Z32F, PixelFormat::R32F); | ||
| 241 | make_siblings(PixelFormat::Z32FS8, PixelFormat::RG32F); | ||
| 236 | } | 242 | } |
| 237 | 243 | ||
| 238 | ~TextureCache() = default; | 244 | ~TextureCache() = default; |
| @@ -766,6 +772,9 @@ private: | |||
| 766 | // Guards the cache for protection conflicts. | 772 | // Guards the cache for protection conflicts. |
| 767 | bool guard_cache{}; | 773 | bool guard_cache{}; |
| 768 | 774 | ||
| 775 | // The siblings table is for formats that can inter exchange with one another | ||
| 776 | // without causing issues. This is only valid when a conflict occurs on a non | ||
| 777 | // rendering use. | ||
| 769 | std::unordered_map<PixelFormat, PixelFormat> siblings_table; | 778 | std::unordered_map<PixelFormat, PixelFormat> siblings_table; |
| 770 | 779 | ||
| 771 | // The internal Cache is different for the Texture Cache. It's based on buckets | 780 | // The internal Cache is different for the Texture Cache. It's based on buckets |