diff options
Diffstat (limited to 'opencl')
-rw-r--r-- | opencl/inc/opencl_device.hxx | 3 | ||||
-rw-r--r-- | opencl/source/OpenCLZone.cxx | 4 | ||||
-rw-r--r-- | opencl/source/openclwrapper.cxx | 8 |
3 files changed, 13 insertions, 2 deletions
diff --git a/opencl/inc/opencl_device.hxx b/opencl/inc/opencl_device.hxx index 0963304e8f99..216af72de849 100644 --- a/opencl/inc/opencl_device.hxx +++ b/opencl/inc/opencl_device.hxx @@ -16,6 +16,9 @@ namespace opencl { ds_device getDeviceSelection(OUString const & pFileName, bool bForceSelection = false); +struct GPUEnv; +void releaseOpenCLEnv( GPUEnv *gpuInfo ); + } #endif diff --git a/opencl/source/OpenCLZone.cxx b/opencl/source/OpenCLZone.cxx index dc3a9522380b..03521a29c66f 100644 --- a/opencl/source/OpenCLZone.cxx +++ b/opencl/source/OpenCLZone.cxx @@ -7,7 +7,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <opencl/openclwrapper.hxx> #include <opencl/OpenCLZone.hxx> +#include "opencl_device.hxx" #include <memory> @@ -40,6 +42,8 @@ void OpenCLZone::hardDisable() auto xConfProvider = css::configuration::theDefaultProvider::get(comphelper::getProcessComponentContext()); css::uno::Reference<css::util::XFlushable> xFlushable(xConfProvider, css::uno::UNO_QUERY_THROW); xFlushable->flush(); + + releaseOpenCLEnv(&opencl::gpuEnv); } } diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index db6c7e51c09a..2aecdde9338f 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -268,6 +268,8 @@ bool initOpenCLAttr( OpenCLEnv * env ) return false; } +} + void releaseOpenCLEnv( GPUEnv *gpuInfo ) { OpenCLZone zone; @@ -298,6 +300,8 @@ void releaseOpenCLEnv( GPUEnv *gpuInfo ) return; } +namespace { + bool buildProgram(const char* buildOption, GPUEnv* gpuInfo, int idx) { cl_int clStatus; @@ -701,7 +705,7 @@ void findDeviceInfoFromDeviceId(cl_device_id aDeviceId, size_t& rDeviceId, size_ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEvaluation, OUString& rOutSelectedDeviceVersionIDString) { - if(fillOpenCLInfo().empty()) + if(fillOpenCLInfo().empty() || getenv("SAL_DISABLE_OPENCL")) return false; cl_device_id pDeviceId = nullptr; @@ -884,7 +888,7 @@ const char* errorString(cl_int nError) bool GPUEnv::isOpenCLEnabled() { - return gpuEnv.mpDevID; + return gpuEnv.mpDevID && gpuEnv.mpContext; } } |