Add a toggle option for OpenCL in Config (in Advanced Settings). Default is off.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5768 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
xsacha 2010-06-22 13:17:01 +00:00
parent 25aca8cc4a
commit 21fb4cb96c
8 changed files with 37 additions and 5 deletions

View File

@ -136,6 +136,7 @@ void SConfig::SaveSettings()
// Core
ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
ini.Set("Core", "EnableOpenCL", m_LocalCoreStartupParameter.bEnableOpenCL);
ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore);
ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread);
ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread);
@ -260,6 +261,7 @@ void SConfig::LoadSettings()
// Core
ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, true);
ini.Get("Core", "EnableOpenCL", &m_LocalCoreStartupParameter.bHLE_BS2, false);
ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1);
ini.Get("Core", "DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false);
ini.Get("Core", "CPUThread", &m_LocalCoreStartupParameter.bCPUThread, true);

View File

@ -69,6 +69,7 @@ struct SCoreStartupParameter
bool bSkipIdle;
bool bNTSC;
bool bHLE_BS2;
bool bEnableOpenCL;
bool bUseFastMem;
bool bLockThreads;
bool bEnableCheats;

View File

@ -30,6 +30,8 @@
#include "Frame.h"
#include "HotkeyDlg.h"
#include "..\..\Common\Src\OpenCL.h"
#ifdef __APPLE__
#include <Cocoa/Cocoa.h>
#endif
@ -62,6 +64,7 @@ EVT_CHOICE(ID_FRAMELIMIT, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_FRAMELIMIT_USEFPSFORLIMITING, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_ENABLE_OPENCL, CConfigMain::CoreSettingsChanged)
EVT_RADIOBOX(ID_CPUENGINE, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_LOCKTHREADS, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_DSPTHREAD, CConfigMain::CoreSettingsChanged)
@ -158,6 +161,7 @@ void CConfigMain::UpdateGUI()
EnableCheats->Disable();
AlwaysHLE_BS2->Disable();
EnableOpenCL->Disable();
CPUEngine->Disable();
LockThreads->Disable();
DSPThread->Disable();
@ -261,6 +265,7 @@ void CConfigMain::InitializeGUIValues()
// General - Advanced
AlwaysHLE_BS2->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2);
EnableOpenCL->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableOpenCL);
CPUEngine->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore);
LockThreads->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads);
DSPThread->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread);
@ -328,6 +333,7 @@ void CConfigMain::InitializeGUITooltips()
// General - Advanced
DSPThread->SetToolTip(wxT("Run DSPLLE on a dedicated thread (not recommended)."));
EnableOpenCL->SetToolTip(wxT("Allow videocard to accelerate texture decoding."));
// Display - Display
@ -397,6 +403,10 @@ void CConfigMain::CreateGUIControls()
// Core Settings - Advanced
sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings"));
AlwaysHLE_BS2 = new wxCheckBox(GeneralPage, ID_ALWAYS_HLE_BS2, wxT("HLE the IPL (recommended)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
EnableOpenCL = new wxCheckBox(GeneralPage, ID_ENABLE_OPENCL, wxT("Enable OpenCL"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
#if !(defined(HAVE_OPENCL) && HAVE_OPENCL)
EnableOpenCL->Enable(false);
#endif
CPUEngine = new wxRadioBox(GeneralPage, ID_CPUENGINE, wxT("CPU Emulator Engine"), wxDefaultPosition, wxDefaultSize, arrayStringFor_CPUEngine, 0, wxRA_SPECIFY_ROWS);
LockThreads = new wxCheckBox(GeneralPage, ID_LOCKTHREADS, wxT("Lock threads to cores"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
DSPThread = new wxCheckBox(GeneralPage, ID_DSPTHREAD, wxT("DSPLLE on thread"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -412,6 +422,7 @@ void CConfigMain::CreateGUIControls()
sbBasic->Add(sFramelimit, 0, wxALL | wxEXPAND, 5);
sbAdvanced->Add(AlwaysHLE_BS2, 0, wxALL, 5);
sbAdvanced->Add(EnableOpenCL, 0, wxALL, 5);
sbAdvanced->Add(CPUEngine, 0, wxALL, 5);
sbAdvanced->Add(LockThreads, 0, wxALL, 5);
sbAdvanced->Add(DSPThread, 0, wxALL, 5);
@ -807,6 +818,9 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
case ID_ALWAYS_HLE_BS2:
SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2 = AlwaysHLE_BS2->IsChecked();
break;
case ID_ENABLE_OPENCL:
SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableOpenCL = EnableOpenCL->IsChecked();
break;
case ID_CPUENGINE:
SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = CPUEngine->GetSelection();
if (main_frame->g_pCodeWindow)

View File

@ -67,6 +67,7 @@ private:
// Advanced
wxCheckBox* AlwaysHLE_BS2;
wxCheckBox* EnableOpenCL;
wxRadioBox* CPUEngine;
wxCheckBox* DSPThread;
wxCheckBox* LockThreads;
@ -185,6 +186,7 @@ private:
ID_FRAMELIMIT_USEFPSFORLIMITING,
ID_ALWAYS_HLE_BS2,
ID_ENABLE_OPENCL,
ID_CPUENGINE,
ID_LOCKTHREADS,
ID_DSPTHREAD,

View File

@ -45,6 +45,7 @@
#include "OpenCL.h"
#if defined(HAVE_OPENCL) && HAVE_OPENCL
#include "OpenCL/OCLTextureDecoder.h"
#include "VideoConfig.h"
#endif
u8* g_pVideoData = 0;
@ -385,8 +386,11 @@ void OpcodeDecoder_Init()
g_pVideoData = FAKE_GetFifoStartPtr();
#if defined(HAVE_OPENCL) && HAVE_OPENCL
OpenCL::Initialize();
TexDecoder_OpenCL_Initialize();
if (g_Config.bEnableOpenCL)
{
OpenCL::Initialize();
TexDecoder_OpenCL_Initialize();
}
#endif
}
@ -394,8 +398,11 @@ void OpcodeDecoder_Init()
void OpcodeDecoder_Shutdown()
{
#if defined(HAVE_OPENCL) && HAVE_OPENCL
TexDecoder_OpenCL_Shutdown();
OpenCL::Destroy();
if (g_Config.bEnableOpenCL)
{
TexDecoder_OpenCL_Shutdown();
OpenCL::Destroy();
}
#endif
}

View File

@ -32,6 +32,7 @@
#include "OpenCL.h"
#if defined(HAVE_OPENCL) && HAVE_OPENCL
#include "OpenCL/OCLTextureDecoder.h"
#include "VideoConfig.h"
#endif
#include "LookUpTables.h"
@ -1269,7 +1270,8 @@ PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, in
PC_TexFormat retval = PC_TEX_FMT_NONE;
#if defined(HAVE_OPENCL) && HAVE_OPENCL
retval = TexDecoder_Decode_OpenCL(dst, src, width, height, texformat, tlutaddr, tlutfmt, rgbaOnly);
if (g_Config.bEnableOpenCL)
retval = TexDecoder_Decode_OpenCL(dst, src, width, height, texformat, tlutaddr, tlutfmt, rgbaOnly);
#endif
if(retval == PC_TEX_FMT_NONE)

View File

@ -107,6 +107,7 @@ void VideoConfig::Load(const char *ini_file)
bool bTmp;
iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true);
SetEnableAlert(bTmp);
iniFile.Get("Core", "EnableOpenCL", &bEnableOpenCL, false);
}
void VideoConfig::GameIniLoad(const char *ini_file)

View File

@ -77,6 +77,9 @@ struct VideoConfig
bool bUseRealXFB;
bool bAutoScale; // Removes annoying borders without using XFB. Doesn't always work perfectly.
bool bUseNativeMips;
// OpenCL
bool bEnableOpenCL;
// Enhancements
int iMultisampleMode;