mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu-mainline.git
				synced 2025-03-21 01:53:15 +00:00 
			
		
		
		
	texture_cache: Use std::vector reservation for sampled_textures
This commit is contained in:
		
							parent
							
								
									f6f1a8f26a
								
							
						
					
					
						commit
						8eae66907e
					
				| @ -97,25 +97,19 @@ public: | |||||||
|             return {}; |             return {}; | ||||||
|         } |         } | ||||||
|         const auto params{SurfaceParams::CreateForTexture(system, config, entry)}; |         const auto params{SurfaceParams::CreateForTexture(system, config, entry)}; | ||||||
|         auto pair = GetSurface(gpu_addr, params, true, false); |         const auto [surface, view] = GetSurface(gpu_addr, params, true, false); | ||||||
|         if (guard_samplers) { |         if (guard_samplers) { | ||||||
|             if (sampled_textures_stack_pointer == sampled_textures_stack.size()) { |             sampled_textures.push_back(surface); | ||||||
|                 sampled_textures_stack.resize(sampled_textures_stack.size() * 2); |  | ||||||
|             } |  | ||||||
|             sampled_textures_stack[sampled_textures_stack_pointer] = pair.first; |  | ||||||
|             sampled_textures_stack_pointer++; |  | ||||||
|         } |         } | ||||||
|         return pair.second; |         return view; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     bool TextureBarrier() { |     bool TextureBarrier() { | ||||||
|         bool must_do = false; |         const bool any_rt = | ||||||
|         for (u32 i = 0; i < sampled_textures_stack_pointer; i++) { |             std::any_of(sampled_textures.begin(), sampled_textures.end(), | ||||||
|             must_do |= sampled_textures_stack[i]->IsRenderTarget(); |                         [](const auto& surface) { return surface->IsRenderTarget(); }); | ||||||
|             sampled_textures_stack[i] = nullptr; |         sampled_textures.clear(); | ||||||
|         } |         return any_rt; | ||||||
|         sampled_textures_stack_pointer = 0; |  | ||||||
|         return must_do; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     TView GetDepthBufferSurface(bool preserve_contents) { |     TView GetDepthBufferSurface(bool preserve_contents) { | ||||||
| @ -259,7 +253,7 @@ protected: | |||||||
|         make_siblings(PixelFormat::Z32F, PixelFormat::R32F); |         make_siblings(PixelFormat::Z32F, PixelFormat::R32F); | ||||||
|         make_siblings(PixelFormat::Z32FS8, PixelFormat::RG32F); |         make_siblings(PixelFormat::Z32FS8, PixelFormat::RG32F); | ||||||
| 
 | 
 | ||||||
|         sampled_textures_stack.resize(64); |         sampled_textures.reserve(64); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ~TextureCache() = default; |     ~TextureCache() = default; | ||||||
| @ -809,8 +803,7 @@ private: | |||||||
|         render_targets; |         render_targets; | ||||||
|     FramebufferTargetInfo depth_buffer; |     FramebufferTargetInfo depth_buffer; | ||||||
| 
 | 
 | ||||||
|     std::vector<TSurface> sampled_textures_stack{}; |     std::vector<TSurface> sampled_textures; | ||||||
|     u32 sampled_textures_stack_pointer{}; |  | ||||||
| 
 | 
 | ||||||
|     StagingCache staging_cache; |     StagingCache staging_cache; | ||||||
|     std::recursive_mutex mutex; |     std::recursive_mutex mutex; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 ReinUsesLisp
						ReinUsesLisp