mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Textures loading screen (#6478)
* Add a loading screen for the preloading textures *The PreloadTextures() function is called from the EmuThread to prevent citra to freezing *Add a the preloading textures loadingscreen in loading_screen.cpp *Add custom_tex_manager.reset() in core.cpp to release ram memory after exiting a game * Add custom textures loading in EmuThread * Remove useless variable * Revert "Add custom textures loading in EmuThread" This reverts commit 45ed46fa09159f782c5d20a4330b4eb7cfcdc253. * Moved include from bootmanager.h to bootmanager.cpp
This commit is contained in:
		
							parent
							
								
									62792b6b0e
								
							
						
					
					
						commit
						322d7a8287
					
				
					 6 changed files with 29 additions and 7 deletions
				
			
		|  | @ -190,8 +190,10 @@ void CustomTexManager::WriteConfig() { | |||
|     file.WriteString(output); | ||||
| } | ||||
| 
 | ||||
| void CustomTexManager::PreloadTextures() { | ||||
| void CustomTexManager::PreloadTextures(const std::atomic_bool& stop_run, | ||||
|                                        const VideoCore::DiskResourceLoadCallback& callback) { | ||||
|     u64 size_sum = 0; | ||||
|     size_t preloaded = 0; | ||||
|     const u64 sys_mem = Common::GetMemInfo().total_physical_memory; | ||||
|     const u64 recommended_min_mem = 2 * size_t(1024 * 1024 * 1024); | ||||
| 
 | ||||
|  | @ -206,8 +208,15 @@ void CustomTexManager::PreloadTextures() { | |||
|                 LOG_WARNING(Render, "Aborting texture preload due to insufficient memory"); | ||||
|                 return; | ||||
|             } | ||||
|             if (stop_run) { | ||||
|                 return; | ||||
|             } | ||||
|             material->LoadFromDisk(flip_png_files); | ||||
|             size_sum += material->size; | ||||
|             if (callback) { | ||||
|                 callback(VideoCore::LoadCallbackStage::Preload, preloaded, custom_textures.size()); | ||||
|             } | ||||
|             preloaded++; | ||||
|         } | ||||
|     }); | ||||
|     workers->WaitForRequests(); | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ | |||
| #include <unordered_set> | ||||
| #include "common/thread_worker.h" | ||||
| #include "video_core/custom_textures/material.h" | ||||
| #include "video_core/rasterizer_interface.h" | ||||
| 
 | ||||
| namespace Core { | ||||
| class System; | ||||
|  | @ -43,7 +44,8 @@ public: | |||
|     void WriteConfig(); | ||||
| 
 | ||||
|     /// Preloads all registered custom textures
 | ||||
|     void PreloadTextures(); | ||||
|     void PreloadTextures(const std::atomic_bool& stop_run, | ||||
|                          const VideoCore::DiskResourceLoadCallback& callback); | ||||
| 
 | ||||
|     /// Saves the provided pixel data described by params to disk as png
 | ||||
|     void DumpTexture(const SurfaceParams& params, u32 level, std::span<u8> data, u64 data_hash); | ||||
|  |  | |||
|  | @ -21,6 +21,7 @@ namespace VideoCore { | |||
| 
 | ||||
| enum class LoadCallbackStage { | ||||
|     Prepare, | ||||
|     Preload, | ||||
|     Decompile, | ||||
|     Build, | ||||
|     Complete, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue