diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-11-22 20:27:48 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-11-25 20:44:58 +0100 |
commit | 7524119f965c54b863c9a67a19ff0a212c77879f (patch) | |
tree | 9f4b8bff25ea684f524a7ea8ddb9a9eead921a4a /sc/source/core/tool | |
parent | eff099b9083ed5a5f83b45162d45c55e5c6d714a (diff) |
provide UNO API for OpenCL selection
Change-Id: If5eb71e9298cefdac3dda98cb1ff67fe913ad3c3
Diffstat (limited to 'sc/source/core/tool')
-rw-r--r-- | sc/source/core/tool/formulagroup.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index f3ec3e08d5eb..372e8fca1cc3 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -33,6 +33,7 @@ extern "C" size_t getOpenCLPlatformCount(void); extern "C" void fillOpenCLInfo(sc::OpenclPlatformInfo*, size_t); extern "C" bool switchOpenClDevice(const OUString*, bool); extern "C" sc::FormulaGroupInterpreter* createFormulaGroupOpenCLInterpreter(); +extern "C" void getOpenCLDeviceInfo(size_t*, size_t*); #endif @@ -504,6 +505,7 @@ typedef FormulaGroupInterpreter* (*__createFormulaGroupOpenCLInterpreter)(void); typedef size_t (*__getOpenCLPlatformCount)(void); typedef void (*__fillOpenCLInfo)(OpenclPlatformInfo*, size_t); typedef bool (*__switchOpenClDevice)(const OUString*, bool); +typedef void (*__getOpenCLDeviceInfo)(size_t*, size_t*); #endif @@ -653,6 +655,37 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool return false; } +void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int32& rPlatformId) +{ + rDeviceId = -1; + rPlatformId = -1; + bool bOpenCLEnabled = ScInterpreter::GetGlobalConfig().mbOpenCLEnabled; + if(bOpenCLEnabled) + return; + +#if HAVE_FEATURE_OPENCL + + size_t aDeviceId = -1; + size_t aPlatformId = -1; + +#ifndef DISABLE_DYNLOADING + osl::Module* pModule = getOpenCLModule(); + if (!pModule) + return; + + oslGenericFunction fn = pModule->getFunctionSymbol("getOpenCLDeviceInfo"); + if (!fn) + return; + + reinterpret_cast<__getOpenCLDeviceInfo>(fn)(&aDeviceId, &aPlatformId); +#else + getOpenCLDeviceInfo(&aDeviceId, &aPlatformId); +#endif + rDeviceId = aDeviceId; + rPlatformId = aPlatformId; +#endif +} + void FormulaGroupInterpreter::enableOpenCL(bool bEnable) { ScCalcConfig aConfig = ScInterpreter::GetGlobalConfig(); |