From 50c5dbdb096ebc340c8c40cd3b70c2ba865e0790 Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 19 Mar 2011 01:55:57 +0000 Subject: [PATCH] Added a toggle switch for the OpenMP texture decoder in the graphics settings. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7375 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Dolphin.vcxproj | 1 + Source/Core/DolphinWX/Src/VideoConfigDiag.cpp | 7 +++++++ Source/Core/DolphinWX/Src/VideoConfigDiag.h | 4 +++- Source/Core/VideoCommon/Src/TextureDecoder.cpp | 4 ++-- Source/Core/VideoCommon/Src/VideoConfig.cpp | 12 ++++++++++++ Source/Core/VideoCommon/Src/VideoConfig.h | 3 +++ 6 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/Dolphin.vcxproj b/Source/Core/DolphinWX/Dolphin.vcxproj index a78422b1ec..ec8a22f871 100644 --- a/Source/Core/DolphinWX/Dolphin.vcxproj +++ b/Source/Core/DolphinWX/Dolphin.vcxproj @@ -188,6 +188,7 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / ..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\Core\Src;..\Core\Src\PowerPC\JitCommon;..\DebuggerWX\Src;..\..\..\Externals\Bochs_disasm;..\InputCommon\Src;..\DiscIO\Src;..\..\..\Externals\SFML\include;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories) + true diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index eca49d1d96..725ce23693 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -127,6 +127,7 @@ wxString free_look_tooltip = wxT(""); wxString crop_tooltip = wxT(""); wxString opencl_tooltip = wxT(""); wxString dlc_tooltip = wxT(""); +wxString omp_tooltip = wxT("Uses multiple threads to decode the textures in the game."); wxString hotkeys_tooltip = wxT(""); wxString ppshader_tooltip = wxT(""); wxString cache_efb_copies_tooltip = wxTRANSLATE("When using EFB to RAM we very often need to decode RAM data to a VRAM texture, which is a very time-consuming task.\nWith this option enabled, we'll skip decoding a texture if it didn't change.\nThis results in a nice speedup, but possibly causes glitches.\nIf you have any problems with this option enabled you should either try increasing the safety of the texture cache or disable this option.\n(NOTE: The safer the texture cache is adjusted the lower the speedup will be; accurate texture cache set to \"safe\" might actually be slower!)"); @@ -426,6 +427,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con szr_misc->Add(opencl = new SettingCheckBox(page_advanced, _("Enable OpenCL"), opencl_tooltip, vconfig.bEnableOpenCL), 0, wxLEFT|wxBOTTOM, 5); szr_misc->Add(dlcache = new SettingCheckBox(page_advanced, _("Enable Display List Caching"), dlc_tooltip, vconfig.bDlistCachingEnable), 0, wxBOTTOM, 5); szr_misc->Add(hotkeys = new SettingCheckBox(page_advanced, _("Enable Hotkeys"), hotkeys_tooltip, vconfig.bOSDHotKey), 0, wxLEFT|wxBOTTOM, 5); +#ifdef _OPENMP + szr_misc->Add(ompdecoder = new SettingCheckBox(page_advanced, _("OpenMP Texture Decoder"), omp_tooltip, vconfig.bOMPDecoder), 0, wxBOTTOM, 5); +#endif // postproc shader if (vconfig.backend_info.PPShaders.size()) @@ -626,6 +630,9 @@ void VideoConfigDiag::SetUIValuesFromConfig() crop->SetValue(vconfig.bCrop); opencl->SetValue(vconfig.bEnableOpenCL); dlcache->SetValue(vconfig.bDlistCachingEnable); +#ifdef _OPENMP + ompdecoder->SetValue(vconfig.bOMPDecoder); +#endif hotkeys->SetValue(vconfig.bOSDHotKey); if (choice_ppshader) diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.h b/Source/Core/DolphinWX/Src/VideoConfigDiag.h index 951ab92f3a..c811d2eb16 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.h +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.h @@ -161,7 +161,9 @@ protected: SettingCheckBox* opencl; SettingCheckBox* dlcache; SettingCheckBox* hotkeys; - +#ifdef _OPENMP + SettingCheckBox* ompdecoder; +#endif wxChoice* choice_ppshader; // TODO: Add options for diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp index d75efd9c7c..85872a8b0e 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp @@ -693,7 +693,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh { #ifdef _OPENMP //Dont use multithreading in small Textures - if(width > 127 && height > 127) + if ((width > 127 && height > 127) && g_ActiveConfig.bOMPDecoder) { //don't span to many threads they will kill the rest of the emu :) omp_set_num_threads((cpu_info.num_cores + 2) / 3); @@ -968,7 +968,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int height, int texformat, int tlutaddr, int tlutfmt) { #ifdef _OPENMP - if(width > 127 && height > 127) + if ((width > 127 && height > 127) && g_ActiveConfig.bOMPDecoder) { //don't span to many threads they will kill the rest of the emu :) omp_set_num_threads((cpu_info.num_cores + 2) / 3); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index bb66066b9b..71c90fb986 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -96,6 +96,9 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Settings", "DisableFog", &bDisableFog, 0); iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false); +#ifdef _OPENMP + iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false); +#endif iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0); iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x) @@ -170,6 +173,9 @@ void VideoConfig::GameIniLoad(const char *ini_file) iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog); iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL); +#ifdef _OPENMP + iniFile.GetIfExists("Video_Settings", "OMPDecoder", &bOMPDecoder); +#endif iniFile.GetIfExists("Video_Enhancements", "ForceFiltering", &bForceFiltering); iniFile.GetIfExists("Video_Enhancements", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x) @@ -272,6 +278,9 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Settings", "DisableFog", bDisableFog); iniFile.Set("Settings", "EnableOpenCL", bEnableOpenCL); +#ifdef _OPENMP + iniFile.Set("Settings", "OMPDecoder", bOMPDecoder); +#endif iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering); iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy); @@ -351,6 +360,9 @@ void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini) SET_IF_DIFFERS("Video_Settings", "DisableFog", bDisableFog); SET_IF_DIFFERS("Video_Settings", "EnableOpenCL", bEnableOpenCL); +#ifdef _OPENMP + SET_IF_DIFFERS("Video_Settings", "OMPDecoder", bOMPDecoder); +#endif SET_IF_DIFFERS("Video_Enhancements", "ForceFiltering", bForceFiltering); SET_IF_DIFFERS("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x) diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 7a3d95faa5..1fff22a811 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -121,6 +121,9 @@ struct VideoConfig // Hacks bool bEFBAccessEnable; bool bDlistCachingEnable; +#ifdef _OPENMP + bool bOMPDecoder; +#endif bool bEFBCopyEnable; bool bEFBCopyCacheEnable; bool bEFBEmulateFormatChanges;