diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx index ec8f432816eb..cbe37dd6ed54 100644 --- a/cui/source/options/optopencl.cxx +++ b/cui/source/options/optopencl.cxx @@ -47,20 +47,17 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(vcl::Window* pParent, const SfxItemSet& rSet) { get(mpUseSwInterpreter, "useswinterpreter"); get(mpUseOpenCL, "useopencl"); - get(clUsed,"openclused"); + get(mpOclUsed,"openclused"); + get(mpOclNotUsed,"openclnotused"); mpUseSwInterpreter->Check(officecfg::Office::Common::Misc::UseSwInterpreter::get()); mpUseOpenCL->Check(maConfig.mbUseOpenCL); mpUseOpenCL->SetClickHdl(LINK(this, SvxOpenCLTabPage, EnableOpenCLHdl)); - cl_device_id idTest=opencl::gpuEnv.mpDevID; - if(!idTest) - { - clUsed->SetText("Yes"); - }else{ - clUsed->SetText("No"); - } + bool bCLUsed = opencl::GPUEnv::isOpenCLEnabled(); + mpOclUsed->Show(bCLUsed); + mpOclNotUsed->Show(!bCLUsed); } SvxOpenCLTabPage::~SvxOpenCLTabPage() diff --git a/cui/source/options/optopencl.hxx b/cui/source/options/optopencl.hxx index d6379682c310..ab628932632f 100644 --- a/cui/source/options/optopencl.hxx +++ b/cui/source/options/optopencl.hxx @@ -34,7 +34,8 @@ private: VclPtr mpUseSwInterpreter; VclPtr mpUseOpenCL; - VclPtr clUsed; + VclPtr mpOclUsed; + VclPtr mpOclNotUsed; DECL_STATIC_LINK_TYPED(SvxOpenCLTabPage, EnableOpenCLHdl, Button*, void); diff --git a/cui/uiconfig/ui/optopenclpage.ui b/cui/uiconfig/ui/optopenclpage.ui index 6b78e67a3862..86eee5774d6e 100644 --- a/cui/uiconfig/ui/optopenclpage.ui +++ b/cui/uiconfig/ui/optopenclpage.ui @@ -57,26 +57,11 @@ 1 - - - True - False - 0 - Will OpenCL be used? - - - - - - False - True - 2 - - - True + False False + OpenCL is available for use. False @@ -85,10 +70,16 @@ - - - - + + False + False + OpenCL is not used. + + + False + True + 3 + diff --git a/include/opencl/openclwrapper.hxx b/include/opencl/openclwrapper.hxx index 178c685834ae..b83c1fc2ff00 100644 --- a/include/opencl/openclwrapper.hxx +++ b/include/opencl/openclwrapper.hxx @@ -35,7 +35,7 @@ struct KernelEnv cl_program mpkProgram; }; -struct GPUEnv +struct OPENCL_DLLPUBLIC GPUEnv { //share vb in all modules in hb library cl_platform_id mpPlatformID; @@ -48,9 +48,12 @@ struct GPUEnv bool mnKhrFp64Flag; bool mnAmdFp64Flag; cl_uint mnPreferredVectorWidthFloat; + + static bool isOpenCLEnabled(); }; extern OPENCL_DLLPUBLIC GPUEnv gpuEnv; + OPENCL_DLLPUBLIC bool generatBinFromKernelSource( cl_program program, const char * clFileName ); OPENCL_DLLPUBLIC bool buildProgramFromBinary(const char* buildOption, GPUEnv* gpuEnv, const char* filename, int idx); OPENCL_DLLPUBLIC void setKernelEnv( KernelEnv *envInfo ); diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index ace3210e9013..a54d86a70fc4 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -865,6 +865,11 @@ const char* errorString(cl_int nError) #undef CASE } +bool GPUEnv::isOpenCLEnabled() +{ + return gpuEnv.mpDevID; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */