diff options
| author | 2019-06-29 20:10:31 -0300 | |
|---|---|---|
| committer | 2019-06-29 20:10:31 -0300 | |
| commit | 8eae66907e043e6e26d78cfc4b5cde7ea93a4f77 (patch) | |
| tree | d35eddb4b777c0534750b54805d59dcb05586b21 /src | |
| parent | texture_cache: Style changes (diff) | |
| download | yuzu-8eae66907e043e6e26d78cfc4b5cde7ea93a4f77.tar.gz yuzu-8eae66907e043e6e26d78cfc4b5cde7ea93a4f77.tar.xz yuzu-8eae66907e043e6e26d78cfc4b5cde7ea93a4f77.zip | |
texture_cache: Use std::vector reservation for sampled_textures
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 3df3e17dd..8edae3d97 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -97,25 +97,19 @@ public: | |||
| 97 | return {}; | 97 | return {}; |
| 98 | } | 98 | } |
| 99 | const auto params{SurfaceParams::CreateForTexture(system, config, entry)}; | 99 | const auto params{SurfaceParams::CreateForTexture(system, config, entry)}; |
| 100 | auto pair = GetSurface(gpu_addr, params, true, false); | 100 | const auto [surface, view] = GetSurface(gpu_addr, params, true, false); |
| 101 | if (guard_samplers) { | 101 | if (guard_samplers) { |
| 102 | if (sampled_textures_stack_pointer == sampled_textures_stack.size()) { | 102 | sampled_textures.push_back(surface); |
| 103 | sampled_textures_stack.resize(sampled_textures_stack.size() * 2); | ||
| 104 | } | ||
| 105 | sampled_textures_stack[sampled_textures_stack_pointer] = pair.first; | ||
| 106 | sampled_textures_stack_pointer++; | ||
| 107 | } | 103 | } |
| 108 | return pair.second; | 104 | return view; |
| 109 | } | 105 | } |
| 110 | 106 | ||
| 111 | bool TextureBarrier() { | 107 | bool TextureBarrier() { |
| 112 | bool must_do = false; | 108 | const bool any_rt = |
| 113 | for (u32 i = 0; i < sampled_textures_stack_pointer; i++) { | 109 | std::any_of(sampled_textures.begin(), sampled_textures.end(), |
| 114 | must_do |= sampled_textures_stack[i]->IsRenderTarget(); | 110 | [](const auto& surface) { return surface->IsRenderTarget(); }); |
| 115 | sampled_textures_stack[i] = nullptr; | 111 | sampled_textures.clear(); |
| 116 | } | 112 | return any_rt; |
| 117 | sampled_textures_stack_pointer = 0; | ||
| 118 | return must_do; | ||
| 119 | } | 113 | } |
| 120 | 114 | ||
| 121 | TView GetDepthBufferSurface(bool preserve_contents) { | 115 | TView GetDepthBufferSurface(bool preserve_contents) { |
| @@ -259,7 +253,7 @@ protected: | |||
| 259 | make_siblings(PixelFormat::Z32F, PixelFormat::R32F); | 253 | make_siblings(PixelFormat::Z32F, PixelFormat::R32F); |
| 260 | make_siblings(PixelFormat::Z32FS8, PixelFormat::RG32F); | 254 | make_siblings(PixelFormat::Z32FS8, PixelFormat::RG32F); |
| 261 | 255 | ||
| 262 | sampled_textures_stack.resize(64); | 256 | sampled_textures.reserve(64); |
| 263 | } | 257 | } |
| 264 | 258 | ||
| 265 | ~TextureCache() = default; | 259 | ~TextureCache() = default; |
| @@ -809,8 +803,7 @@ private: | |||
| 809 | render_targets; | 803 | render_targets; |
| 810 | FramebufferTargetInfo depth_buffer; | 804 | FramebufferTargetInfo depth_buffer; |
| 811 | 805 | ||
| 812 | std::vector<TSurface> sampled_textures_stack{}; | 806 | std::vector<TSurface> sampled_textures; |
| 813 | u32 sampled_textures_stack_pointer{}; | ||
| 814 | 807 | ||
| 815 | StagingCache staging_cache; | 808 | StagingCache staging_cache; |
| 816 | std::recursive_mutex mutex; | 809 | std::recursive_mutex mutex; |