mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Prepare frontend for multiple graphics APIs (#6347)
* externals: Update dynarmic * settings: Introduce GraphicsAPI enum * For now it's OpenGL only but will be expanded upon later * citra_qt: Introduce backend agnostic context management * Mostly a direct port from yuzu * core: Simplify context acquire * settings: Add option to create debug contexts * renderer_opengl: Abstract initialization to Driver * This commit also updates glad and adds some useful extensions which we will use in part 2 * Rasterizer construction is moved to the specific renderer instead of RendererBase. Software rendering has been disable to achieve this but will be brought back in the next commit. * video_core: Remove Init/Shutdown methods from renderer * The constructor and destructor can do the same job * In addition move opengl function loading to Qt since SDL already does this. Also remove ErrorVideoCore which is never reached * citra_qt: Decouple software renderer from opengl part 1 * citra: Decouple software renderer from opengl part 2 * android: Decouple software renderer from opengl part 3 * swrasterizer: Decouple software renderer from opengl part 4 * This commit simply enforces the renderer naming conventions in the software renderer * video_core: Move RendererBase to VideoCore * video_core: De-globalize screenshot state * video_core: Pass system to the renderers * video_core: Commonize shader uniform data * video_core: Abstract backend agnostic rasterizer operations * bootmanager: Remove references to OpenGL for macOS OpenGL macOS headers definitions clash heavily with each other * citra_qt: Proper title for api settings * video_core: Reduce boost usage * bootmanager: Fix hide mouse option Remove event handlers from RenderWidget for events that are already handled by the parent GRenderWindow. Also enable mouse tracking on the RenderWidget. * android: Remove software from graphics api list * code: Address review comments * citra: Port per-game settings read * Having to update the default value for all backends is a pain so lets centralize it * android: Rename to OpenGLES --------- Co-authored-by: MerryMage <MerryMage@users.noreply.github.com> Co-authored-by: Vitor Kiguchi <vitor-kiguchi@hotmail.com>
This commit is contained in:
		
							parent
							
								
									9ef42040af
								
							
						
					
					
						commit
						b5d6f645bd
					
				
					 99 changed files with 3165 additions and 4501 deletions
				
			
		|  | @ -55,6 +55,60 @@ __declspec(dllimport) void __stdcall DebugBreak(void); | |||
| 
 | ||||
| #endif // _MSC_VER
 | ||||
| 
 | ||||
| #define DECLARE_ENUM_FLAG_OPERATORS(type)                                                          \ | ||||
|     [[nodiscard]] constexpr type operator|(type a, type b) noexcept {                              \ | ||||
|         using T = std::underlying_type_t<type>;                                                    \ | ||||
|         return static_cast<type>(static_cast<T>(a) | static_cast<T>(b));                           \ | ||||
|     }                                                                                              \ | ||||
|     [[nodiscard]] constexpr type operator&(type a, type b) noexcept {                              \ | ||||
|         using T = std::underlying_type_t<type>;                                                    \ | ||||
|         return static_cast<type>(static_cast<T>(a) & static_cast<T>(b));                           \ | ||||
|     }                                                                                              \ | ||||
|     [[nodiscard]] constexpr type operator^(type a, type b) noexcept {                              \ | ||||
|         using T = std::underlying_type_t<type>;                                                    \ | ||||
|         return static_cast<type>(static_cast<T>(a) ^ static_cast<T>(b));                           \ | ||||
|     }                                                                                              \ | ||||
|     [[nodiscard]] constexpr type operator<<(type a, type b) noexcept {                             \ | ||||
|         using T = std::underlying_type_t<type>;                                                    \ | ||||
|         return static_cast<type>(static_cast<T>(a) << static_cast<T>(b));                          \ | ||||
|     }                                                                                              \ | ||||
|     [[nodiscard]] constexpr type operator>>(type a, type b) noexcept {                             \ | ||||
|         using T = std::underlying_type_t<type>;                                                    \ | ||||
|         return static_cast<type>(static_cast<T>(a) >> static_cast<T>(b));                          \ | ||||
|     }                                                                                              \ | ||||
|     constexpr type& operator|=(type& a, type b) noexcept {                                         \ | ||||
|         a = a | b;                                                                                 \ | ||||
|         return a;                                                                                  \ | ||||
|     }                                                                                              \ | ||||
|     constexpr type& operator&=(type& a, type b) noexcept {                                         \ | ||||
|         a = a & b;                                                                                 \ | ||||
|         return a;                                                                                  \ | ||||
|     }                                                                                              \ | ||||
|     constexpr type& operator^=(type& a, type b) noexcept {                                         \ | ||||
|         a = a ^ b;                                                                                 \ | ||||
|         return a;                                                                                  \ | ||||
|     }                                                                                              \ | ||||
|     constexpr type& operator<<=(type& a, type b) noexcept {                                        \ | ||||
|         a = a << b;                                                                                \ | ||||
|         return a;                                                                                  \ | ||||
|     }                                                                                              \ | ||||
|     constexpr type& operator>>=(type& a, type b) noexcept {                                        \ | ||||
|         a = a >> b;                                                                                \ | ||||
|         return a;                                                                                  \ | ||||
|     }                                                                                              \ | ||||
|     [[nodiscard]] constexpr type operator~(type key) noexcept {                                    \ | ||||
|         using T = std::underlying_type_t<type>;                                                    \ | ||||
|         return static_cast<type>(~static_cast<T>(key));                                            \ | ||||
|     }                                                                                              \ | ||||
|     [[nodiscard]] constexpr bool True(type key) noexcept {                                         \ | ||||
|         using T = std::underlying_type_t<type>;                                                    \ | ||||
|         return static_cast<T>(key) != 0;                                                           \ | ||||
|     }                                                                                              \ | ||||
|     [[nodiscard]] constexpr bool False(type key) noexcept {                                        \ | ||||
|         using T = std::underlying_type_t<type>;                                                    \ | ||||
|         return static_cast<T>(key) == 0;                                                           \ | ||||
|     } | ||||
| 
 | ||||
| // Generic function to get last error message.
 | ||||
| // Call directly after the command or use the error num.
 | ||||
| // This function might change the error code.
 | ||||
|  |  | |||
|  | @ -20,6 +20,8 @@ | |||
| 
 | ||||
| namespace Settings { | ||||
| 
 | ||||
| namespace { | ||||
| 
 | ||||
| std::string_view GetAudioEmulationName(AudioEmulation emulation) { | ||||
|     switch (emulation) { | ||||
|     case AudioEmulation::HLE: | ||||
|  | @ -31,6 +33,17 @@ std::string_view GetAudioEmulationName(AudioEmulation emulation) { | |||
|     } | ||||
| }; | ||||
| 
 | ||||
| std::string_view GetGraphicsAPIName(GraphicsAPI api) { | ||||
|     switch (api) { | ||||
|     case GraphicsAPI::Software: | ||||
|         return "Software"; | ||||
|     case GraphicsAPI::OpenGL: | ||||
|         return "OpenGL"; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| } // Anonymous namespace
 | ||||
| 
 | ||||
| Values values = {}; | ||||
| static bool configuring_global = true; | ||||
| 
 | ||||
|  | @ -38,7 +51,6 @@ void Apply() { | |||
|     GDBStub::SetServerPort(values.gdbstub_port.GetValue()); | ||||
|     GDBStub::ToggleServer(values.use_gdbstub.GetValue()); | ||||
| 
 | ||||
|     VideoCore::g_hw_renderer_enabled = values.use_hw_renderer.GetValue(); | ||||
|     VideoCore::g_shader_jit_enabled = values.use_shader_jit.GetValue(); | ||||
|     VideoCore::g_hw_shader_enabled = values.use_hw_shader.GetValue(); | ||||
|     VideoCore::g_separable_shader_enabled = values.separable_shader.GetValue(); | ||||
|  | @ -101,7 +113,7 @@ void LogSettings() { | |||
|     log_setting("Core_UseCpuJit", values.use_cpu_jit.GetValue()); | ||||
|     log_setting("Core_CPUClockPercentage", values.cpu_clock_percentage.GetValue()); | ||||
|     log_setting("Renderer_UseGLES", values.use_gles.GetValue()); | ||||
|     log_setting("Renderer_UseHwRenderer", values.use_hw_renderer.GetValue()); | ||||
|     log_setting("Renderer_GraphicsAPI", GetGraphicsAPIName(values.graphics_api.GetValue())); | ||||
|     log_setting("Renderer_UseHwShader", values.use_hw_shader.GetValue()); | ||||
|     log_setting("Renderer_SeparableShader", values.separable_shader.GetValue()); | ||||
|     log_setting("Renderer_ShadersAccurateMul", values.shaders_accurate_mul.GetValue()); | ||||
|  | @ -186,7 +198,7 @@ void RestoreGlobalState(bool is_powered_on) { | |||
|     values.is_new_3ds.SetGlobal(true); | ||||
| 
 | ||||
|     // Renderer
 | ||||
|     values.use_hw_renderer.SetGlobal(true); | ||||
|     values.graphics_api.SetGlobal(true); | ||||
|     values.use_hw_shader.SetGlobal(true); | ||||
|     values.separable_shader.SetGlobal(true); | ||||
|     values.use_disk_shader_cache.SetGlobal(true); | ||||
|  |  | |||
|  | @ -15,6 +15,11 @@ | |||
| 
 | ||||
| namespace Settings { | ||||
| 
 | ||||
| enum class GraphicsAPI { | ||||
|     Software = 0, | ||||
|     OpenGL = 1, | ||||
| }; | ||||
| 
 | ||||
| enum class InitClock : u32 { | ||||
|     SystemTime = 0, | ||||
|     FixedTime = 1, | ||||
|  | @ -415,8 +420,9 @@ struct Values { | |||
|     Setting<bool> allow_plugin_loader{true, "allow_plugin_loader"}; | ||||
| 
 | ||||
|     // Renderer
 | ||||
|     SwitchableSetting<GraphicsAPI> graphics_api{GraphicsAPI::OpenGL, "graphics_api"}; | ||||
|     Setting<bool> use_gles{false, "use_gles"}; | ||||
|     SwitchableSetting<bool> use_hw_renderer{true, "use_hw_renderer"}; | ||||
|     Setting<bool> renderer_debug{false, "renderer_debug"}; | ||||
|     SwitchableSetting<bool> use_hw_shader{true, "use_hw_shader"}; | ||||
|     SwitchableSetting<bool> separable_shader{false, "use_separable_shader"}; | ||||
|     SwitchableSetting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"}; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue