[Libreoffice-commits] core.git: Branch 'private/kohei/formula-opencl-work' - 162 commits - afms/ExternalPackage_fontunxafm.mk android/experimental android/sdremote bridges/Module_bridges.mk bridges/Package_jnilib_java_uno.mk bridges/source config_host.mk.in configmgr/CppunitTest_configmgr_unit.mk configure.ac connectivity/source cppuhelper/source ct2n/ExternalPackage_ct2n.mk cui/source dbaccess/Library_dba.mk desktop/Module_desktop.mk desktop/Package_branding_custom.mk desktop/Package_branding.mk desktop/Package_desktop_install.mk desktop/Package_scripts_install.mk desktop/Package_scripts.mk desktop/Package_soffice_bin.mk desktop/Package_soffice_sh.mk desktop/scripts editeng/qa editeng/source extensions/Package_mdibundle.mk extensions/Package_OOoSpotlightImporter.mk external/Package_mingw_dlls.mk external/Package_msvc_dlls.mk extras/ExternalPackage_accessoriesgallerydrawspeople.mk extras/ExternalPackage_accessoriesgalleryelementsbullets2.mk extras/ExternalPackage_accessoriesgallery.mk ext ras/ExternalPackage_accessoriesgallerynonfree.mk extras/ExternalPackage_accessoriesgalleryphotosbuildings.mk extras/ExternalPackage_accessoriesgalleryphotoscelebration.mk extras/ExternalPackage_accessoriesgalleryphotoscities.mk extras/ExternalPackage_accessoriesgalleryphotosfauna.mk extras/ExternalPackage_accessoriesgalleryphotosflowers.mk extras/ExternalPackage_accessoriesgalleryphotosfoodsanddrinks.mk extras/ExternalPackage_accessoriesgalleryphotoshumans.mk extras/ExternalPackage_accessoriesgalleryphotoslandscapes.mk extras/ExternalPackage_accessoriesgalleryphotosobjects.mk extras/ExternalPackage_accessoriesgalleryphotosplants.mk extras/ExternalPackage_accessoriesgalleryphotosspace.mk extras/ExternalPackage_accessoriesgalleryphotosstatues.mk extras/ExternalPackage_accessoriesgalleryphotostravel.mk extras/ExternalPackage_accessoriestemplatescommoneducate.mk extras/ExternalPackage_accessoriestemplatescommonfinance.mk extras/ExternalPackage_accessoriestemplatescommonforms.mk extras/ExternalPackage_accessoriestemplatescommonlabels.mk extras/ExternalPackage_accessoriestemplatescommonlayout.mk extras/ExternalPackage_accessoriestemplatescommonmisc.mk extras/ExternalPackage_accessoriestemplatescommon.mk extras/ExternalPackage_accessoriestemplatescommonofficorr.mk extras/ExternalPackage_accessoriestemplatescommonoffimisc.mk extras/ExternalPackage_accessoriestemplatescommonpersonal.mk extras/ExternalPackage_accessoriestemplatescommonpresent.mk extras/ExternalPackage_extra_fonts.mk extras/Package_autocorr.mk extras/Package_autotextuser.mk extras/Package_cfgsrvbitmapunx.mk extras/Package_cfgsrvnolang.mk extras/Package_cfgusr.mk extras/Package_databasebiblio.mk extras/Package_database.mk extras/Package_fonts.mk extras/Package_gallbullets.mk extras/Package_gallhtmlexpo.mk extras/Package_gallmytheme.mk extras/Package_gallroot.mk extras/Package_gallsystem.mk extras/Package_gallwwwback.mk extras/Package_gallwwwgraf.mk extras/Package_glade.mk extras/Package_la bels.mk extras/Package_newfiles.mk extras/Package_palettes.mk extras/Package_tpllayoutimpr.mk extras/Package_tplwizagenda.mk extras/Package_tplwizbitmap.mk extras/Package_tplwizdesktop.mk extras/Package_tplwizfax.mk extras/Package_tplwizletter.mk extras/Package_tplwizreport.mk extras/Package_tplwizstyles.mk filter/Configuration_filter.mk filter/Package_docbook.mk filter/Package_xhtml.mk filter/Package_xslt.mk framework/Package_dtd.mk helpcontent2 i18nlangtag/qa i18nlangtag/README i18nlangtag/source i18npool/CustomTarget_localedata.mk i18npool/Library_localedata_euro.mk i18npool/source icon-themes/galaxy include/editeng include/i18nlangtag include/linguistic include/oox include/svl include/svx include/tools instsetoo_native/CustomTarget_setup.mk instsetoo_native/Package_setup.mk instsetoo_native/util ios/CustomTarget_LibreOffice_app.mk jvmfwk/Package_jreproperties.mk jvmfwk/Package_rcfiles.mk l10ntools/source libexttextcat/ExternalPackage_fingerprint.mk liblangtag/ExternalPac kage_liblangtag_data.mk librelogo/Package_librelogo.mk librelogo/Package_librelogo_properties.mk linguistic/source lotuswordpro/source more_fonts/ExternalPackage_dejavu.mk more_fonts/ExternalPackage_gentium.mk more_fonts/ExternalPackage_liberation.mk more_fonts/ExternalPackage_liberation_narrow.mk more_fonts/ExternalPackage_libertineg.mk more_fonts/ExternalPackage_opensans.mk more_fonts/ExternalPackage_ptserif.mk more_fonts/ExternalPackage_sourcecode.mk more_fonts/ExternalPackage_sourcesans.mk more_fonts/Package_conf.mk moz/ExternalPackage_runtime.mk odk/CustomTarget_check.mk odk/CustomTarget_doxygen.mk odk/CustomTarget_javadoc.mk odk/CustomTarget_settings.mk odk/docs odk/GeneratedPackage_odk_doxygen.mk odk/GeneratedPackage_uno_loader_classes.mk odk/Module_odk.mk odk/pack odk/Package_macosx.mk odk/settings odk/util officecfg/Package_misc.mk officecfg/registry oovbaapi/ooo oovbaapi/UnoApi_oovbaapi.mk oox/source package/Package_dtd.mk padmin/Package_padmin.mk postprocess/Custo mTarget_images.mk postprocess/Package_images.mk postprocess/Package_registry_install.mk psprint_config/Package_fontunxppds.mk psprint_config/Package_fontunxpsprint.mk python3/ExternalPackage_python3.mk python3/GeneratedPackage_python3.mk pyuno/Package_python_scripts.mk pyuno/Package_python_shell.mk readlicense_oo/CustomTarget_readme.mk readlicense_oo/docs reportbuilder/Package_reportbuilder-templates.mk RepositoryExternal.mk RepositoryFixes.mk Repository.mk RepositoryModule_host.mk sal/CppunitTest_sal_rtl_oustring.mk sal/CppunitTest_sal_rtl_process.mk sal/Module_sal.mk sal/osl sal/qa sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_sc.mk sc/Library_scopencl.mk sc/Module_sc.mk scp2/inc scp2/source scripting/Package_java_jars.mk scripting/Package_java.mk scripting/Package_scriptbindinglib.mk scripting/Package_scriptproviderforpython.mk scripting/Package_ScriptsBeanShell.mk scripting/Package_ScriptsJavaScript.mk scripting/Package_ScriptsPython.mk sc/source sd/inc sd/Package_opengl. mk sd/Package_web.mk sd/Package_xml.mk sd/source setup_native/source sfx2/source shell/Package_scripts_gnome.mk shell/Package_scripts_kde.mk shell/Package_scripts.mk shell/Package_senddoc.mk solenv/bin solenv/gbuild solenv/inc starmath/source svtools/source svx/source svx/uiconfig sw/AllLangResTarget_sw.mk sw/inc sw/qa sw/source sw/uiconfig sw/UIConfig_swriter.mk sysui/Package_infoplist.mk sysui/Package_osxicons.mk testtools/CustomTarget_bridgetest.mk testtools/CustomTarget_uno_test.mk tools/source translations unotools/source ure/Package_install.mk vcl/generic vcl/Package_osxres.mk vcl/source wizards/com wizards/Package_depot.mk wizards/Package_euro.mk wizards/Package_form.mk wizards/Package_gimmicks.mk wizards/Package_import.mk wizards/Package_share.mk wizards/Package_standard.mk wizards/Package_template.mk wizards/Package_tools.mk wizards/Package_tutorials.mk wizards/Package_usr.mk wizards/source writerfilter/qa writerfilter/source xmlhelp/Package_helpxsl.mk xmloff/Packag e_dtd.mk xmlscript/Package_dtd.mk

Kohei Yoshida kohei.yoshida at gmail.com
Sun Sep 15 17:22:55 PDT 2013


Rebased ref, commits from common ancestor:
commit 7c94346a60ddf44f7ce82a11d0d374831afc7e9b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Sep 12 07:36:34 2013 -0400

    Additional build fix for Windows.
    
    Change-Id: Ie1d6eec25c442e8dba31936e502249ee04c13177

diff --git a/sc/Library_scopencl.mk b/sc/Library_scopencl.mk
index 0eab89eb..2942e47 100644
--- a/sc/Library_scopencl.mk
+++ b/sc/Library_scopencl.mk
@@ -10,31 +10,38 @@
 $(eval $(call gb_Library_Library,scopencl))
 
 $(eval $(call gb_Library_set_include,scopencl,\
-	-I$(SRCDIR)/sc/source/core/inc \
-	-I$(SRCDIR)/sc/inc \
-	$$(INCLUDE) \
+        -I$(SRCDIR)/sc/source/core/inc \
+        -I$(SRCDIR)/sc/inc \
+        $$(INCLUDE) \
 ))
 
 $(eval $(call gb_Library_set_precompiled_header,scopencl,$(SRCDIR)/sc/inc/pch/precompiled_scopencl))
 
 $(eval $(call gb_Library_use_sdk_api,scopencl))
 
+$(eval $(call gb_Library_use_externals,scopencl,\
+        boost_headers \
+))
+
 $(eval $(call gb_Library_use_libraries,scopencl,\
-	for \
-	sal \
-	sc \
-	$(gb_UWINAPI) \
+        cppu \
+        cppuhelper \
+        for \
+        sal \
+        sc \
+        tl \
+        $(gb_UWINAPI) \
 ))
 
 $(eval $(call gb_Library_add_exception_objects,scopencl,\
-	sc/source/core/opencl/formulagroupcl \
-	sc/source/core/opencl/openclwrapper \
-	sc/source/core/opencl/clcc/clew \
+        sc/source/core/opencl/formulagroupcl \
+        sc/source/core/opencl/openclwrapper \
+        sc/source/core/opencl/clcc/clew \
 ))
 
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Library_add_libs,scopencl,\
-	-ldl \
+        -ldl \
 ))
 endif
 
commit 058416fa31c8fae861691ad8d060b46ca08321ae
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Sep 11 22:12:57 2013 -0400

    Don't forget assignment operators.
    
    Change-Id: If9ee3f140a09b1977afaad8ad00406c67bbe224f

diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 8a1d0df..5481d99 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -1204,11 +1204,11 @@ const sal_Int32 a3Flags[] = {
     BMP_ICON_SET_FLAGS_RED, BMP_ICON_SET_FLAGS_YELLOW, BMP_ICON_SET_FLAGS_GREEN
 };
 
-const sal_Int32 a3Smilies[] {
+const sal_Int32 a3Smilies[] = {
     BMP_ICON_SET_POSITIVE_YELLOW_SMILIE, BMP_ICON_SET_NEUTRAL_YELLOW_SMILIE, BMP_ICON_SET_NEGATIVE_YELLOW_SMILIE
 };
 
-const sal_Int32 a3ColorSmilies[] {
+const sal_Int32 a3ColorSmilies[] = {
     BMP_ICON_SET_POSITIVE_GREEN_SMILIE, BMP_ICON_SET_NEUTRAL_YELLOW_SMILIE, BMP_ICON_SET_NEGATIVE_RED_SMILIE
 };
 
commit 863c51e4985ce3faf1909a989331f80ef062d6b7
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Sep 11 22:04:20 2013 -0400

    Use ScDocumentImport to populate cell storage during xls import.
    
    Change-Id: I205c5b7c1202862ea7129fbd61d54e48cd37b06e

diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 82a3ae5..c99f67a 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -34,6 +34,7 @@
 #include "xihelper.hxx"
 #include "xilink.hxx"
 #include "xiname.hxx"
+#include "documentimport.hxx"
 
 using ::std::vector;
 
@@ -110,6 +111,7 @@ void ImportExcel::Formula(
     const ScTokenArray* pResult = NULL;
 
     pFormConv->Reset( aScPos );
+    ScDocumentImport& rDoc = GetDocImport();
 
     if (bShrFmla)
     {
@@ -119,16 +121,11 @@ void ImportExcel::Formula(
         {
             if (xGroup->mnStart == aScPos.Row())
                 // Generate code for the top cell only.
-                xGroup->compileCode(*pD, aScPos, formula::FormulaGrammar::GRAM_DEFAULT);
+                xGroup->compileCode(rDoc.getDoc(), aScPos, formula::FormulaGrammar::GRAM_DEFAULT);
 
             ScFormulaCell* pCell = new ScFormulaCell(pD, aScPos, xGroup);
-            pD->EnsureTable(aScPos.Tab());
-            bool bInserted = pD->SetGroupFormulaCell(aScPos, pCell);
-            if (!bInserted)
-            {
-                delete pCell;
-                return;
-            }
+            rDoc.getDoc().EnsureTable(aScPos.Tab());
+            rDoc.setFormulaCell(aScPos, pCell);
             xGroup->mnLength = aScPos.Row() - xGroup->mnStart + 1;
             pCell->SetNeedNumberFormat(false);
             if (!rtl::math::isNan(fCurVal))
@@ -145,18 +142,13 @@ void ImportExcel::Formula(
 
     if (pResult)
     {
-        pCell = new ScFormulaCell( pD, aScPos, pResult );
-        pD->EnsureTable(aScPos.Tab());
-        bool bInserted = pD->SetGroupFormulaCell(aScPos, pCell);
-        if (!bInserted)
-        {
-            delete pCell;
-            return;
-        }
+        pCell = new ScFormulaCell(&rDoc.getDoc(), aScPos, pResult);
+        rDoc.getDoc().EnsureTable(aScPos.Tab());
+        rDoc.setFormulaCell(aScPos, pCell);
     }
     else
     {
-        pCell = pD->GetFormulaCell(aScPos);
+        pCell = rDoc.getDoc().GetFormulaCell(aScPos);
         if (pCell)
             pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
     }
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 5b849be..92c3cfb 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -297,7 +297,7 @@ void ImportExcel8::Labelsst( void )
         GetXFRangeBuffer().SetXF( aScPos, nXF );
         const XclImpString* pXclStr = GetSst().GetString(nSst);
         if (pXclStr)
-            XclImpStringHelper::SetToDocument(GetDoc(), aScPos, *this, *pXclStr, nXF);
+            XclImpStringHelper::SetToDocument(GetDocImport(), aScPos, *this, *pXclStr, nXF);
     }
 }
 
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 28ddd9f..e03980b 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -75,6 +75,7 @@
 
 #include "excimp8.hxx"
 #include "excform.hxx"
+#include "documentimport.hxx"
 
 #if defined( WNT )
 #include <math.h>
@@ -308,7 +309,7 @@ void ImportExcel::ReadNumber()
         maStrm >> fValue;
 
         GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
-        GetDoc().SetValue(aScPos, fValue);
+        GetDocImport().setNumericCell(aScPos, fValue);
     }
 }
 
@@ -338,7 +339,7 @@ void ImportExcel::ReadLabel()
         SetTextEncoding( eOldTextEnc );
 
         GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
-        XclImpStringHelper::SetToDocument(GetDoc(), aScPos, GetRoot(), aString, nXFIdx);
+        XclImpStringHelper::SetToDocument(GetDocImport(), aScPos, GetRoot(), aString, nXFIdx);
     }
 }
 
@@ -380,7 +381,7 @@ void ImportExcel::ReadRk()
         maStrm >> nRk;
 
         GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
-        GetDoc().SetValue(aScPos, XclTools::GetDoubleFromRK(nRk));
+        GetDocImport().setNumericCell(aScPos, XclTools::GetDoubleFromRK(nRk));
     }
 }
 
@@ -853,7 +854,7 @@ void ImportExcel::Mulrk( void )
         if( GetAddressConverter().ConvertAddress( aScPos, aCurrXclPos, GetCurrScTab(), true ) )
         {
             GetXFRangeBuffer().SetXF( aScPos, nXF );
-            GetDoc().SetValue(aScPos, XclTools::GetDoubleFromRK(nRkNum));
+            GetDocImport().setNumericCell(aScPos, XclTools::GetDoubleFromRK(nRkNum));
         }
     }
 }
@@ -901,7 +902,7 @@ void ImportExcel::Rstring( void )
             aString.ReadFormats( maStrm );
 
         GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
-        XclImpStringHelper::SetToDocument(GetDoc(), aScPos, *this, aString, nXFIdx);
+        XclImpStringHelper::SetToDocument(GetDocImport(), aScPos, *this, aString, nXFIdx);
     }
 }
 
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index 01629f5..ae89246 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -34,6 +34,7 @@
 #include "xiescher.hxx"
 #include "xipivot.hxx"
 #include "XclImpChangeTrack.hxx"
+#include "documentimport.hxx"
 
 #include "root.hxx"
 #include "imp_op.hxx"
@@ -747,6 +748,7 @@ FltError ImportExcel::Read( void )
     {
         pProgress.reset();
 
+        GetDocImport().finalize();
         AdjustRowHeight();
         PostDocLoad();
 
@@ -1284,7 +1286,8 @@ FltError ImportExcel8::Read( void )
         if( GetBiff() == EXC_BIFF8 )
             GetPivotTableManager().ConvertPivotTables();
 
-        pD->RebuildFormulaGroups();
+        ScDocumentImport& rDoc = GetDocImport();
+        rDoc.finalize();
         pProgress.reset();
 #if 0
         // Excel documents look much better without this call; better in the
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index bc3eadd..c62dde8 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -57,6 +57,7 @@
 
 #include "excform.hxx"
 #include "tabprotection.hxx"
+#include "documentimport.hxx"
 
 #include <memory>
 
@@ -151,25 +152,25 @@ void lclGetAbsPath( OUString& rPath, sal_uInt16 nLevel, SfxObjectShell* pDocShel
 }
 
 /** Inserts the URL into a text cell. Does not modify value or formula cells. */
-void lclInsertUrl( const XclImpRoot& rRoot, const String& rUrl, SCCOL nScCol, SCROW nScRow, SCTAB nScTab )
+void lclInsertUrl( XclImpRoot& rRoot, const String& rUrl, SCCOL nScCol, SCROW nScRow, SCTAB nScTab )
 {
-    ScDocument& rDoc = rRoot.GetDoc();
+    ScDocumentImport& rDoc = rRoot.GetDocImport();
     ScAddress aScPos( nScCol, nScRow, nScTab );
-    CellType eCellType = rDoc.GetCellType( aScPos );
+    CellType eCellType = rDoc.getDoc().GetCellType(aScPos);
     switch( eCellType )
     {
         // #i54261# hyperlinks in string cells
         case CELLTYPE_STRING:
         case CELLTYPE_EDIT:
         {
-            OUString aDisplText = rDoc.GetString(nScCol, nScRow, nScTab);
+            OUString aDisplText = rDoc.getDoc().GetString(nScCol, nScRow, nScTab);
             if (aDisplText.isEmpty())
                 aDisplText = rUrl;
 
             ScEditEngineDefaulter& rEE = rRoot.GetEditEngine();
             SvxURLField aUrlField( rUrl, aDisplText, SVXURLFORMAT_APPDEFAULT );
 
-            const EditTextObject* pEditObj = rDoc.GetEditText(aScPos);
+            const EditTextObject* pEditObj = rDoc.getDoc().GetEditText(aScPos);
             if( pEditObj )
             {
                 rEE.SetText( *pEditObj );
@@ -179,7 +180,7 @@ void lclInsertUrl( const XclImpRoot& rRoot, const String& rUrl, SCCOL nScCol, SC
             {
                 rEE.SetText( EMPTY_STRING );
                 rEE.QuickInsertField( SvxFieldItem( aUrlField, EE_FEATURE_FIELD ), ESelection() );
-                if( const ScPatternAttr* pPattern = rDoc.GetPattern( aScPos.Col(), aScPos.Row(), nScTab ) )
+                if( const ScPatternAttr* pPattern = rDoc.getDoc().GetPattern( aScPos.Col(), aScPos.Row(), nScTab ) )
                 {
                     SfxItemSet aItemSet( rEE.GetEmptyItemSet() );
                     pPattern->FillEditItemSet( &aItemSet );
@@ -188,7 +189,7 @@ void lclInsertUrl( const XclImpRoot& rRoot, const String& rUrl, SCCOL nScCol, SC
             }
 
             // The cell will own the text object instance.
-            rDoc.SetEditText(aScPos, rEE.CreateTextObject());
+            rDoc.setEditCell(aScPos, rEE.CreateTextObject());
         }
         break;
 
@@ -204,7 +205,7 @@ void lclInsertUrl( const XclImpRoot& rRoot, const String& rUrl, SCCOL nScCol, SC
         // attribute ) for better interoperability.
         {
             SfxStringItem aItem( ATTR_HYPERLINK, rUrl );
-            rDoc.ApplyAttr( nScCol, nScRow, nScTab, aItem );
+            rDoc.getDoc().ApplyAttr(nScCol, nScRow, nScTab, aItem);
             break;
         }
     }
@@ -396,7 +397,7 @@ void XclImpHyperlink::ConvertToValidTabName(String& rUrl)
     rUrl = aNewUrl;
 }
 
-void XclImpHyperlink::InsertUrl( const XclImpRoot& rRoot, const XclRange& rXclRange, const String& rUrl )
+void XclImpHyperlink::InsertUrl( XclImpRoot& rRoot, const XclRange& rXclRange, const String& rUrl )
 {
     String aUrl(rUrl);
     ConvertToValidTabName(aUrl);
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index 2dc0b0b..db721e2 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -34,6 +34,7 @@
 #include "excform.hxx"
 #include "stringutil.hxx"
 #include "scmatrix.hxx"
+#include "documentimport.hxx"
 
 // Excel->Calc cell address/range conversion ==================================
 
@@ -221,7 +222,7 @@ EditTextObject* XclImpStringHelper::CreateTextObject(
 }
 
 void XclImpStringHelper::SetToDocument(
-        ScDocument& rDoc, const ScAddress& rPos, const XclImpRoot& rRoot,
+        ScDocumentImport& rDoc, const ScAddress& rPos, const XclImpRoot& rRoot,
         const XclImpString& rString, sal_uInt16 nXFIndex )
 {
     if (!rString.GetText().Len())
@@ -231,7 +232,7 @@ void XclImpStringHelper::SetToDocument(
 
     if (pTextObj.get())
     {
-        rDoc.SetEditText(rPos, pTextObj.release());
+        rDoc.setEditCell(rPos, pTextObj.release());
     }
     else
     {
@@ -239,16 +240,14 @@ void XclImpStringHelper::SetToDocument(
         if (aStr.indexOf('\n') != -1 || aStr.indexOf(CHAR_CR) != -1)
         {
             // Multiline content.
-            ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
+            ScFieldEditEngine& rEngine = rDoc.getDoc().GetEditEngine();
             rEngine.SetText(aStr);
-            rDoc.SetEditText(rPos, rEngine.CreateTextObject());
+            rDoc.setEditCell(rPos, rEngine.CreateTextObject());
         }
         else
         {
             // Normal text cell.
-            ScSetStringParam aParam;
-            aParam.setTextInput();
-            rDoc.SetString(rPos, aStr, &aParam);
+            rDoc.setStringCell(rPos, aStr);
         }
     }
 }
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index ad39d02..01577b0 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -48,6 +48,7 @@
 //! TODO ExcelToSc usage
 #include "excform.hxx"
 #include "xltable.hxx"
+#include "documentimport.hxx"
 
 #include <vector>
 
@@ -82,25 +83,26 @@ XclImpPCItem::XclImpPCItem( XclImpStream& rStrm )
 
 namespace {
 
-void lclSetValue( const XclImpRoot& rRoot, const ScAddress& rScPos, double fValue, short nFormatType )
+void lclSetValue( XclImpRoot& rRoot, const ScAddress& rScPos, double fValue, short nFormatType )
 {
-    ScDocument& rDoc = rRoot.GetDoc();
-    rDoc.SetValue( rScPos.Col(), rScPos.Row(), rScPos.Tab(), fValue );
+    ScDocumentImport& rDoc = rRoot.GetDocImport();
+    rDoc.setNumericCell(rScPos, fValue);
     sal_uInt32 nScNumFmt = rRoot.GetFormatter().GetStandardFormat( nFormatType, rRoot.GetDocLanguage() );
-    rDoc.ApplyAttr( rScPos.Col(), rScPos.Row(), rScPos.Tab(), SfxUInt32Item( ATTR_VALUE_FORMAT, nScNumFmt ) );
+    rDoc.getDoc().ApplyAttr(
+        rScPos.Col(), rScPos.Row(), rScPos.Tab(), SfxUInt32Item(ATTR_VALUE_FORMAT, nScNumFmt));
 }
 
 } // namespace
 
-void XclImpPCItem::WriteToSource( const XclImpRoot& rRoot, const ScAddress& rScPos ) const
+void XclImpPCItem::WriteToSource( XclImpRoot& rRoot, const ScAddress& rScPos ) const
 {
-    ScDocument& rDoc = rRoot.GetDoc();
+    ScDocumentImport& rDoc = rRoot.GetDocImport();
     if( const OUString* pText = GetText() )
-        rDoc.SetString( rScPos.Col(), rScPos.Row(), rScPos.Tab(), *pText );
+        rDoc.setStringCell(rScPos, *pText);
     else if( const double* pfValue = GetDouble() )
-        rDoc.SetValue( rScPos.Col(), rScPos.Row(), rScPos.Tab(), *pfValue );
+        rDoc.setNumericCell(rScPos, *pfValue);
     else if( const sal_Int16* pnValue = GetInteger() )
-        rDoc.SetValue( rScPos.Col(), rScPos.Row(), rScPos.Tab(), *pnValue );
+        rDoc.setNumericCell(rScPos, *pnValue);
     else if( const bool* pbValue = GetBool() )
         lclSetValue( rRoot, rScPos, *pbValue ? 1.0 : 0.0, NUMBERFORMAT_LOGICAL );
     else if( const DateTime* pDateTime = GetDateTime() )
@@ -119,9 +121,9 @@ void XclImpPCItem::WriteToSource( const XclImpRoot& rRoot, const ScAddress& rScP
         sal_uInt8 nErrCode = static_cast< sal_uInt8 >( *pnError );
         const ScTokenArray* pScTokArr = rRoot.GetOldFmlaConverter().GetBoolErr(
             XclTools::ErrorToEnum( fValue, EXC_BOOLERR_ERROR, nErrCode ) );
-        ScFormulaCell* pCell = new ScFormulaCell( &rDoc, rScPos, pScTokArr );
+        ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), rScPos, pScTokArr);
         pCell->SetHybridDouble( fValue );
-        rDoc.SetFormulaCell(rScPos, pCell);
+        rDoc.setFormulaCell(rScPos, pCell);
     }
 }
 
@@ -217,20 +219,20 @@ const XclImpPCItem* XclImpPCField::GetLimitItem( sal_uInt16 nItemIdx ) const
     return (nItemIdx < maNumGroupItems.size()) ? maNumGroupItems[ nItemIdx ].get() : 0;
 }
 
-void XclImpPCField::WriteFieldNameToSource( SCCOL nScCol, SCTAB nScTab ) const
+void XclImpPCField::WriteFieldNameToSource( SCCOL nScCol, SCTAB nScTab )
 {
     OSL_ENSURE( HasOrigItems(), "XclImpPCField::WriteFieldNameToSource - only for standard fields" );
-    GetDoc().SetString( nScCol, 0, nScTab, maFieldInfo.maName );
+    GetDocImport().setStringCell(ScAddress(nScCol, 0, nScTab), maFieldInfo.maName);
     mnSourceScCol = nScCol;
 }
 
-void XclImpPCField::WriteOrigItemToSource( SCROW nScRow, SCTAB nScTab, sal_uInt16 nItemIdx ) const
+void XclImpPCField::WriteOrigItemToSource( SCROW nScRow, SCTAB nScTab, sal_uInt16 nItemIdx )
 {
     if( nItemIdx < maOrigItems.size() )
         maOrigItems[ nItemIdx ]->WriteToSource( GetRoot(), ScAddress( mnSourceScCol, nScRow, nScTab ) );
 }
 
-void XclImpPCField::WriteLastOrigItemToSource( SCROW nScRow, SCTAB nScTab ) const
+void XclImpPCField::WriteLastOrigItemToSource( SCROW nScRow, SCTAB nScTab )
 {
     if( !maOrigItems.empty() )
         maOrigItems.back()->WriteToSource( GetRoot(), ScAddress( mnSourceScCol, nScRow, nScTab ) );
diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx
index 6d53ae9..3835d64 100644
--- a/sc/source/filter/excel/xiroot.cxx
+++ b/sc/source/filter/excel/xiroot.cxx
@@ -35,12 +35,14 @@
 
 #include "root.hxx"
 #include "excimp8.hxx"
+#include "documentimport.hxx"
 
 // Global data ================================================================
 
 XclImpRootData::XclImpRootData( XclBiff eBiff, SfxMedium& rMedium,
         SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) :
     XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, false ),
+    mxDocImport(new ScDocumentImport(rDoc)),
     mbHasCodePage( false ),
     mbHasBasic( false )
 {
@@ -295,6 +297,11 @@ void XclImpRoot::ReadCodeName( XclImpStream& rStrm, bool bGlobals )
     }
 }
 
+ScDocumentImport& XclImpRoot::GetDocImport()
+{
+    return *mrImpData.mxDocImport;
+}
+
 // ============================================================================
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/xicontent.hxx b/sc/source/filter/inc/xicontent.hxx
index 6fc6285..2a8f140 100644
--- a/sc/source/filter/inc/xicontent.hxx
+++ b/sc/source/filter/inc/xicontent.hxx
@@ -81,7 +81,7 @@ public:
     static OUString     ReadEmbeddedData( XclImpStream& rStrm );
 
     /** Inserts the URL into a range of cells. Does not modify value or formula cells. */
-    static void         InsertUrl( const XclImpRoot& rRoot, const XclRange& rXclRange, const String& rUrl );
+    static void InsertUrl( XclImpRoot& rRoot, const XclRange& rXclRange, const String& rUrl );
 
     /** Convert the sheet name with invalid character(s) in URL when the URL is
         to a location within the same document (e.g. #'Sheet&Name'.A1). */
diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx
index 07e3772..5884aae 100644
--- a/sc/source/filter/inc/xihelper.hxx
+++ b/sc/source/filter/inc/xihelper.hxx
@@ -109,7 +109,7 @@ public:
                             const XclImpString& rString );
 
     static void SetToDocument(
-        ScDocument& rDoc, const ScAddress& rPos, const XclImpRoot& rRoot,
+        ScDocumentImport& rDoc, const ScAddress& rPos, const XclImpRoot& rRoot,
         const XclImpString& rString, sal_uInt16 nXFIndex = 0 );
 
 private:
diff --git a/sc/source/filter/inc/xipivot.hxx b/sc/source/filter/inc/xipivot.hxx
index 07014e9..f296fed 100644
--- a/sc/source/filter/inc/xipivot.hxx
+++ b/sc/source/filter/inc/xipivot.hxx
@@ -39,7 +39,7 @@ public:
     explicit            XclImpPCItem( XclImpStream& rStrm );
 
     /** Inserts the item data into the passed document. */
-    void                WriteToSource( const XclImpRoot& rRoot, const ScAddress& rScPos ) const;
+    void WriteToSource( XclImpRoot& rRoot, const ScAddress& rScPos ) const;
 
 private:
     /** Reads an SXDOUBLE record describing a floating-point item. */
@@ -89,11 +89,11 @@ public:
     const XclImpPCItem* GetLimitItem( sal_uInt16 nItemIdx ) const;
 
     /** Inserts the field name into the document. */
-    void                WriteFieldNameToSource( SCCOL nScCol, SCTAB nScTab ) const;
+    void WriteFieldNameToSource( SCCOL nScCol, SCTAB nScTab );
     /** Inserts the specified item data into the document. */
-    void                WriteOrigItemToSource( SCROW nScRow, SCTAB nScTab, sal_uInt16 nItemIdx ) const;
+    void WriteOrigItemToSource( SCROW nScRow, SCTAB nScTab, sal_uInt16 nItemIdx );
     /** Inserts the data of the last inserted item into the document. */
-    void                WriteLastOrigItemToSource( SCROW nScRow, SCTAB nScTab ) const;
+    void WriteLastOrigItemToSource( SCROW nScRow, SCTAB nScTab );
 
     // records ----------------------------------------------------------------
 
diff --git a/sc/source/filter/inc/xiroot.hxx b/sc/source/filter/inc/xiroot.hxx
index 95a211d..c0220d1 100644
--- a/sc/source/filter/inc/xiroot.hxx
+++ b/sc/source/filter/inc/xiroot.hxx
@@ -58,6 +58,7 @@ class XclImpDocProtectBuffer;
 
 class _ScRangeListTabs;
 class ExcelToSc;
+class ScDocumentImport;
 
 /** Stores global buffers and data needed for Excel import filter. */
 struct XclImpRootData : public XclRootData
@@ -111,6 +112,8 @@ struct XclImpRootData : public XclRootData
     XclImpTabProtectRef mxTabProtect;       /// Sheet protection options for current sheet.
     XclImpDocProtectRef mxDocProtect;       /// Document protection options.
 
+    boost::shared_ptr<ScDocumentImport> mxDocImport;
+
     bool                mbHasCodePage;      /// true = CODEPAGE record exists.
     bool                mbHasBasic;         /// true = document contains VB project.
 
@@ -129,6 +132,7 @@ public:
 
     /** Returns this root instance - for code readability in derived classes. */
     inline const XclImpRoot& GetRoot() const { return *this; }
+    inline XclImpRoot& GetRoot() { return *this; }
 
     /** Sets a code page read from a CODEPAGE record for byte string import. */
     void                SetCodePage( sal_uInt16 nCodePage );
@@ -208,6 +212,8 @@ public:
     /** Reads the CODENAME record and inserts the codename into the document. */
     void                ReadCodeName( XclImpStream& rStrm, bool bGlobals );
 
+    ScDocumentImport& GetDocImport();
+
 private:
     XclImpRootData& mrImpData;      /// Reference to the global import data struct.
 };
commit 41466b3fcaf58ac717ff475912f99394b5c81e56
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Sep 11 19:21:35 2013 -0400

    OpenCL code shouldn't be needing any UI code.
    
    Change-Id: I789ac7b9c1404b2f7b35178d9c43c59182a20cea

diff --git a/sc/Library_scopencl.mk b/sc/Library_scopencl.mk
index 0ec2b47..0eab89eb 100644
--- a/sc/Library_scopencl.mk
+++ b/sc/Library_scopencl.mk
@@ -21,7 +21,6 @@ $(eval $(call gb_Library_use_sdk_api,scopencl))
 
 $(eval $(call gb_Library_use_libraries,scopencl,\
 	for \
-	forui \
 	sal \
 	sc \
 	$(gb_UWINAPI) \
commit b565942ac7c1ee3222c9b22cfca460cc12f0c5d2
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Sep 11 19:20:54 2013 -0400

    Move the clewInit to where the Windows DLL is manually loaded.
    
    Change-Id: I58c8bcbd76c28c458fb28c21d65887159fa0ea34

diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index f186df1..0cad340 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -73,6 +73,11 @@ void OpenclDevice::freeOpenclDll()
 
 int OpenclDevice::initEnv()
 {
+    // TODO: Make the path configurable.
+    int status = clewInit("/opt/AMDAPP/lib/x86_64/libOpenCL.so");
+    if (status < 0)
+        return 1;
+
 #ifdef WIN32
     while( 1 )
     {
@@ -707,10 +712,6 @@ int OpenclDevice::runKernel( const char *kernelName, void **userdata)
 
 int OpenclDevice::initOpenclRunEnv( int argc )
 {
-    int status = clewInit("/opt/AMDAPP/lib/x86_64/libOpenCL.so");
-    if (status < 0)
-        return 1;
-
     if ( MAX_CLKERNEL_NUM <= 0 )
     {
         return 1;
@@ -722,7 +723,7 @@ int OpenclDevice::initOpenclRunEnv( int argc )
     {
         registOpenclKernel();
         //initialize devices, context, comand_queue
-        status = initOpenclRunEnv( &gpuEnv );
+        int status = initOpenclRunEnv( &gpuEnv );
         if ( status )
         {
             printf("init_opencl_env failed.\n");
commit 54a51886b92e989229d5f7db6e7dd5b6b8bec42d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Sep 11 17:46:35 2013 -0400

    Allow enable / disable opencl at build time.
    
    Change-Id: I65e2a71aae8317930d1575e7d82c11c3fd2b74de

diff --git a/Repository.mk b/Repository.mk
index 6f785f4..4d5125b 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -153,9 +153,9 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,calc, \
 	sc \
 	scd \
 	scfilt \
-	scopencl \
 	scui \
 	solver \
+	$(if $(ENABLE_OPENCL),scopencl) \
 	$(if $(DISABLE_SCRIPTING),,vbaobj) \
 	$(if $(ENABLE_TELEPATHY),tubes) \
 ))
diff --git a/config_host.mk.in b/config_host.mk.in
index 4ea343f..5097d8e 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -146,6 +146,7 @@ export ENABLE_NPAPI_FROM_BROWSER=@ENABLE_NPAPI_FROM_BROWSER@
 export ENABLE_NPAPI_INTO_BROWSER=@ENABLE_NPAPI_INTO_BROWSER@
 export ENABLE_ONLINE_UPDATE=@ENABLE_ONLINE_UPDATE@
 export ENABLE_OPENGL=@ENABLE_OPENGL@
+export ENABLE_OPENCL=@ENABLE_OPENCL@
 export ENABLE_PACKAGEKIT=@ENABLE_PACKAGEKIT@
 export ENABLE_PCH=@ENABLE_PCH@
 export ENABLE_PDFIMPORT=@ENABLE_PDFIMPORT@
diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in
index 08720a7..100706a 100644
--- a/config_host/config_features.h.in
+++ b/config_host/config_features.h.in
@@ -67,6 +67,13 @@
 
 #define HAVE_FEATURE_MULTIUSER_ENVIRONMENT 0
 
+/*
+ * Whether we have the OpenCL headers and should compile in any
+ * support for that abstraction.
+ */
+
+#define HAVE_FEATURE_OPENCL 0
+
 /* 
  * Whether the OS has Avahi support, 
  * This library is used for zeroconf service publication on the local network
diff --git a/configure.ac b/configure.ac
index f7c0f1e..4742dbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -909,6 +909,10 @@ AC_ARG_ENABLE(opengl,
     AS_HELP_STRING([--disable-opengl],
         [Determines whether to build the OpenGL 3D slide transitions component.]))
 
+AC_ARG_ENABLE(opencl,
+    AS_HELP_STRING([--disable-opencl],
+        [Determines whether to build with OpenCL support.]))
+
 AC_ARG_ENABLE(dbus,
     AS_HELP_STRING([--disable-dbus],
         [Determines whether to enable features that depend on dbus.
@@ -10167,6 +10171,26 @@ fi
 AC_SUBST(SYSTEM_MESA_HEADERS)
 AC_SUBST(ENABLE_OPENGL)
 
+dnl =================================================
+dnl Check whether to build with OpenCL support.
+dnl =================================================
+
+AC_MSG_CHECKING([whether to build with the OpenCL support.])
+ENABLE_OPENCL=
+
+if test "x$enable_opencl" != "xno"; then
+    AC_MSG_RESULT([yes])
+    enable_opencl=yes
+    ENABLE_OPENCL=TRUE
+    AC_DEFINE(HAVE_FEATURE_OPENCL)
+else
+    AC_MSG_RESULT([no])
+    enable_opencl=no
+    ENABLE_OPENCL=FALSE
+fi
+
+AC_SUBST(ENABLE_OPENCL)
+
 # presenter minimizer extension?
 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 510cc82..6522862 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -15,11 +15,16 @@ $(eval $(call gb_Module_add_targets,sc,\
 	Library_sc \
 	Library_scd \
 	Library_scfilt \
-	Library_scopencl \
 	Library_scui \
 	UIConfig_scalc \
 ))
 
+ifeq ($(ENABLE_OPENCL),TRUE)
+$(eval $(call gb_Module_add_targets,sc,\
+	Library_scopencl \
+))
+endif
+
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
 $(eval $(call gb_Module_add_targets,sc,\
 	Library_scqahelper \
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 90c43ce..3b929fa 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -358,6 +358,7 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
 
     if ( !msInstance )
     {
+#if HAVE_FEATURE_OPENCL
         if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled )
         {
 #ifdef DISABLE_DYNLOADING
@@ -382,7 +383,7 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
                 msInstance = new sc::FormulaGroupInterpreterOpenCLMissing();
 #endif
         }
-
+#endif
         if ( !msInstance ) // software fallback
         {
             fprintf(stderr, "Create S/W interp\n");
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 2ded895..6639f35 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -196,7 +196,9 @@ void ScCalcOptionsDialog::FillOptionsList()
     }
 
     pModel->Insert(createBoolItem(maCaptionEmptyStringAsZero,maConfig.mbEmptyStringAsZero));
+#if HAVE_FEATURE_OPENCL
     pModel->Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled));
+#endif
 
     mpLbSettings->SetUpdateMode(true);
 }
commit 0007a603219a88762fab4951a9d7519598ab8bba
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Sep 11 14:45:36 2013 -0400

    Remove opencl-sdk configure option, and build time opencl conditionals.
    
    We now load OpenCL library dynmically at run-time as needed. So there
    is no build time dependency on any OpenCL implementations.
    
    Change-Id: I214399060398a7c5e37b9a254147ccc2834e7866

diff --git a/Repository.mk b/Repository.mk
index 4d5125b..6f785f4 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -153,9 +153,9 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,calc, \
 	sc \
 	scd \
 	scfilt \
+	scopencl \
 	scui \
 	solver \
-	$(if $(ENABLE_OPENCL),scopencl) \
 	$(if $(DISABLE_SCRIPTING),,vbaobj) \
 	$(if $(ENABLE_TELEPATHY),tubes) \
 ))
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 8a8d06c..8d22faa 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -29,23 +29,6 @@
 
 # External headers
 
-ifeq ($(ENABLE_OPENCL),TRUE)
-
-define gb_LinkTarget__use_opencl
-$(call gb_LinkTarget_set_include,$(1),\
-	$$(INCLUDE) \
-    $(OPENCL_CFLAGS) \
-)
-$(call gb_LinkTarget_add_libs,$(1),$(OPENCL_LIBS))
-
-endef
-
-else # ENABLE_OPENCL != TRUE
-
-gb_LinkTarget__use_opencl :=
-
-endif
-
 ifeq ($(SYSTEM_MARIADB),YES)
 
 define gb_LinkTarget__use_mariadb
diff --git a/config_host.mk.in b/config_host.mk.in
index f391bdd..4ea343f 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -146,7 +146,6 @@ export ENABLE_NPAPI_FROM_BROWSER=@ENABLE_NPAPI_FROM_BROWSER@
 export ENABLE_NPAPI_INTO_BROWSER=@ENABLE_NPAPI_INTO_BROWSER@
 export ENABLE_ONLINE_UPDATE=@ENABLE_ONLINE_UPDATE@
 export ENABLE_OPENGL=@ENABLE_OPENGL@
-export ENABLE_OPENCL=@ENABLE_OPENCL@
 export ENABLE_PACKAGEKIT=@ENABLE_PACKAGEKIT@
 export ENABLE_PCH=@ENABLE_PCH@
 export ENABLE_PDFIMPORT=@ENABLE_PDFIMPORT@
@@ -402,8 +401,6 @@ export OOOP_SAMPLES_PACK=@OOOP_SAMPLES_PACK@
 export OOOP_TEMPLATES_PACK=@OOOP_TEMPLATES_PACK@
 export OOO_JUNIT_JAR=@OOO_JUNIT_JAR@
 export OOO_VENDOR=@OOO_VENDOR@
-export OPENCL_CFLAGS=$(gb_SPACE)@OPENCL_CFLAGS@
-export OPENCL_LIBS=$(gb_SPACE)@OPENCL_LIBS@
 export OPENSSL_CFLAGS=$(gb_SPACE)@OPENSSL_CFLAGS@
 export OPENSSL_LIBS=$(gb_SPACE)@OPENSSL_LIBS@
 export ORCUS_CFLAGS=$(gb_SPACE)@ORCUS_CFLAGS@
diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in
index 100706a..08720a7 100644
--- a/config_host/config_features.h.in
+++ b/config_host/config_features.h.in
@@ -67,13 +67,6 @@
 
 #define HAVE_FEATURE_MULTIUSER_ENVIRONMENT 0
 
-/*
- * Whether we have the OpenCL headers and should compile in any
- * support for that abstraction.
- */
-
-#define HAVE_FEATURE_OPENCL 0
-
 /* 
  * Whether the OS has Avahi support, 
  * This library is used for zeroconf service publication on the local network
diff --git a/configure.ac b/configure.ac
index b23cc0e..f7c0f1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1802,16 +1802,6 @@ AC_ARG_WITH(windows-sdk,
     ],
 ,)
 
-AC_ARG_WITH(opencl-sdk,
-    AS_HELP_STRING([--with-opencl-sdk],
-        [If you have the AMD HSA / opencl SDK installed (cf.
-         http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads/ )
-         Pass the absolute path to where that SDK is unpacked.])
-    [
-                          Usage:     --with-opencl-sdk=/opt/AMDAPP
-    ],
-,)
-
 AC_ARG_WITH(lang,
     AS_HELP_STRING([--with-lang],
         [Use this option to build LibreOffice with additional language support.
@@ -10177,44 +10167,6 @@ fi
 AC_SUBST(SYSTEM_MESA_HEADERS)
 AC_SUBST(ENABLE_OPENGL)
 
-dnl =================================================
-dnl Check whether the OpenCL libraries are available
-dnl =================================================
-
-OPENCL_LIBS=
-OPENCL_CFLAGS=
-ENABLE_OPENCL=
-AC_MSG_CHECKING([OpenCL])
-if test \( -z "$with_opencl_sdk" -o "$with_opencl_sdk" = yes \) -a $_os = Darwin -a "$with_macosx_sdk" != 10.6; then
-    # OS X SDK > 10.6
-    AC_MSG_RESULT([yes, always on OS X > 10.6])
-    ENABLE_OPENCL=TRUE
-    OPENCL_CFLAGS=
-    OPENCL_LIBS="-framework OpenCL"
-    AC_DEFINE(HAVE_FEATURE_OPENCL)
-elif test -z "$with_opencl_sdk" -o "$with_opencl_sdk" = no; then
-    AC_MSG_RESULT([no])
-else
-    if test -d "$with_opencl_sdk/include"; then
-        ENABLE_OPENCL=TRUE
-        if test "$_os" = "WINNT"; then
-            PathFormat "$with_opencl_sdk"
-            OPENCL_CFLAGS="-I$formatted_path/include"
-            OPENCL_LIBS="-LIBPATH:$formatted_path/lib/x86 OpenCL.lib"
-        else
-            OPENCL_CFLAGS="-I$with_opencl_sdk/include"
-            OPENCL_LIBS="-L$with_opencl_sdk/lib/x86 -lOpenCL"
-        fi
-        AC_MSG_RESULT([found at path $with_opencl_sdk])
-        AC_DEFINE(HAVE_FEATURE_OPENCL)
-    else
-        AC_MSG_ERROR([no headers found found at $with_opencl_sdk/include ])
-    fi
-fi
-AC_SUBST(OPENCL_CFLAGS)
-AC_SUBST(OPENCL_LIBS)
-AC_SUBST(ENABLE_OPENCL)
-
 # presenter minimizer extension?
 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index fd438f6..a40733d 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -26,9 +26,6 @@ $(eval $(call gb_CppunitTest_use_library_objects,sc_ucalc, \
 ifeq ($(ENABLE_TELEPATHY),TRUE)
 $(eval $(call gb_CppunitTest_use_libraries,sc_ucalc,tubes))
 endif
-ifeq ($(ENABLE_OPENCL),TRUE)
-$(eval $(call gb_CppunitTest_use_externals,sc_ucalc,opencl))
-endif
 
 $(eval $(call gb_CppunitTest_use_externals,sc_ucalc,\
 	boost_headers \
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 6522862..510cc82 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -15,16 +15,11 @@ $(eval $(call gb_Module_add_targets,sc,\
 	Library_sc \
 	Library_scd \
 	Library_scfilt \
+	Library_scopencl \
 	Library_scui \
 	UIConfig_scalc \
 ))
 
-ifeq ($(ENABLE_OPENCL),TRUE)
-$(eval $(call gb_Module_add_targets,sc,\
-	Library_scopencl \
-))
-endif
-
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
 $(eval $(call gb_Module_add_targets,sc,\
 	Library_scqahelper \
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 3b929fa..90c43ce 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -358,7 +358,6 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
 
     if ( !msInstance )
     {
-#if HAVE_FEATURE_OPENCL
         if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled )
         {
 #ifdef DISABLE_DYNLOADING
@@ -383,7 +382,7 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
                 msInstance = new sc::FormulaGroupInterpreterOpenCLMissing();
 #endif
         }
-#endif
+
         if ( !msInstance ) // software fallback
         {
             fprintf(stderr, "Create S/W interp\n");
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 6639f35..2ded895 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -196,9 +196,7 @@ void ScCalcOptionsDialog::FillOptionsList()
     }
 
     pModel->Insert(createBoolItem(maCaptionEmptyStringAsZero,maConfig.mbEmptyStringAsZero));
-#if HAVE_FEATURE_OPENCL
     pModel->Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled));
-#endif
 
     mpLbSettings->SetUpdateMode(true);
 }
commit 66a39bd6e365d264819ec942824c6c632587cb74
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Sep 11 14:22:48 2013 -0400

    Use clew from clcc to allow run-time loading of opencl drivers.
    
    Change-Id: I9f6ce113d637dbec069caa86b32459e2001ec0a0

diff --git a/sc/Library_scopencl.mk b/sc/Library_scopencl.mk
index f30f9c4..0ec2b47 100644
--- a/sc/Library_scopencl.mk
+++ b/sc/Library_scopencl.mk
@@ -27,11 +27,16 @@ $(eval $(call gb_Library_use_libraries,scopencl,\
 	$(gb_UWINAPI) \
 ))
 
-$(eval $(call gb_Library_use_externals,scopencl,opencl))
-
 $(eval $(call gb_Library_add_exception_objects,scopencl,\
 	sc/source/core/opencl/formulagroupcl \
 	sc/source/core/opencl/openclwrapper \
+	sc/source/core/opencl/clcc/clew \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_add_libs,scopencl,\
+	-ldl \
 ))
+endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/sc/source/core/opencl/clcc/clew.cxx b/sc/source/core/opencl/clcc/clew.cxx
new file mode 100644
index 0000000..3a7db16
--- /dev/null
+++ b/sc/source/core/opencl/clcc/clew.cxx
@@ -0,0 +1,326 @@
+//////////////////////////////////////////////////////////////////////////
+//  Copyright (c) 2009-2011 Organic Vectory B.V.
+//  Written by George van Venrooij
+//
+//  Distributed under the Boost Software License, Version 1.0.
+//  (See accompanying file license.txt)
+//////////////////////////////////////////////////////////////////////////
+
+#include "clew.h"
+
+//! \file clew.c
+//! \brief OpenCL run-time loader source
+
+#ifndef CLCC_GENERATE_DOCUMENTATION
+    #ifdef _WIN32
+        #define WIN32_LEAN_AND_MEAN
+        #define VC_EXTRALEAN
+        #include <windows.h>
+
+        typedef HMODULE             CLCC_DYNLIB_HANDLE;
+
+        #define CLCC_DYNLIB_OPEN    LoadLibrary
+        #define CLCC_DYNLIB_CLOSE   FreeLibrary
+        #define CLCC_DYNLIB_IMPORT  GetProcAddress
+    #else
+        #include <dlfcn.h>
+
+        typedef void*                   CLCC_DYNLIB_HANDLE;
+
+        #define CLCC_DYNLIB_OPEN(path)  dlopen(path, RTLD_NOW | RTLD_GLOBAL)
+        #define CLCC_DYNLIB_CLOSE       dlclose
+        #define CLCC_DYNLIB_IMPORT      dlsym
+    #endif
+#else
+    //typedef implementation_defined  CLCC_DYNLIB_HANDLE;
+    //#define CLCC_DYNLIB_OPEN(path)  implementation_defined
+    //#define CLCC_DYNLIB_CLOSE       implementation_defined
+    //#define CLCC_DYNLIB_IMPORT      implementation_defined
+#endif
+
+#include <stdlib.h>
+
+//! \brief module handle
+static CLCC_DYNLIB_HANDLE module = NULL;
+
+//  Variables holding function entry points
+#ifndef CLCC_GENERATE_DOCUMENTATION
+PFNCLGETPLATFORMIDS                 __clewGetPlatformIDs                = NULL;
+PFNCLGETPLATFORMINFO                __clewGetPlatformInfo               = NULL;
+PFNCLGETDEVICEIDS                   __clewGetDeviceIDs                  = NULL;
+PFNCLGETDEVICEINFO                  __clewGetDeviceInfo                 = NULL;
+PFNCLCREATECONTEXT                  __clewCreateContext                 = NULL;
+PFNCLCREATECONTEXTFROMTYPE          __clewCreateContextFromType         = NULL;
+PFNCLRETAINCONTEXT                  __clewRetainContext                 = NULL;
+PFNCLRELEASECONTEXT                 __clewReleaseContext                = NULL;
+PFNCLGETCONTEXTINFO                 __clewGetContextInfo                = NULL;
+PFNCLCREATECOMMANDQUEUE             __clewCreateCommandQueue            = NULL;
+PFNCLRETAINCOMMANDQUEUE             __clewRetainCommandQueue            = NULL;
+PFNCLRELEASECOMMANDQUEUE            __clewReleaseCommandQueue           = NULL;
+PFNCLGETCOMMANDQUEUEINFO            __clewGetCommandQueueInfo           = NULL;
+PFNCLSETCOMMANDQUEUEPROPERTY        __clewSetCommandQueueProperty       = NULL;
+PFNCLCREATEBUFFER                   __clewCreateBuffer                  = NULL;
+PFNCLCREATEIMAGE2D                  __clewCreateImage2D                 = NULL;
+PFNCLCREATEIMAGE3D                  __clewCreateImage3D                 = NULL;
+PFNCLRETAINMEMOBJECT                __clewRetainMemObject               = NULL;
+PFNCLRELEASEMEMOBJECT               __clewReleaseMemObject              = NULL;
+PFNCLGETSUPPORTEDIMAGEFORMATS       __clewGetSupportedImageFormats      = NULL;
+PFNCLGETMEMOBJECTINFO               __clewGetMemObjectInfo              = NULL;
+PFNCLGETIMAGEINFO                   __clewGetImageInfo                  = NULL;
+PFNCLCREATESAMPLER                  __clewCreateSampler                 = NULL;
+PFNCLRETAINSAMPLER                  __clewRetainSampler                 = NULL;
+PFNCLRELEASESAMPLER                 __clewReleaseSampler                = NULL;
+PFNCLGETSAMPLERINFO                 __clewGetSamplerInfo                = NULL;
+PFNCLCREATEPROGRAMWITHSOURCE        __clewCreateProgramWithSource       = NULL;
+PFNCLCREATEPROGRAMWITHBINARY        __clewCreateProgramWithBinary       = NULL;
+PFNCLRETAINPROGRAM                  __clewRetainProgram                 = NULL;
+PFNCLRELEASEPROGRAM                 __clewReleaseProgram                = NULL;
+PFNCLBUILDPROGRAM                   __clewBuildProgram                  = NULL;
+PFNCLUNLOADCOMPILER                 __clewUnloadCompiler                = NULL;
+PFNCLGETPROGRAMINFO                 __clewGetProgramInfo                = NULL;
+PFNCLGETPROGRAMBUILDINFO            __clewGetProgramBuildInfo           = NULL;
+PFNCLCREATEKERNEL                   __clewCreateKernel                  = NULL;
+PFNCLCREATEKERNELSINPROGRAM         __clewCreateKernelsInProgram        = NULL;
+PFNCLRETAINKERNEL                   __clewRetainKernel                  = NULL;
+PFNCLRELEASEKERNEL                  __clewReleaseKernel                 = NULL;
+PFNCLSETKERNELARG                   __clewSetKernelArg                  = NULL;
+PFNCLGETKERNELINFO                  __clewGetKernelInfo                 = NULL;
+PFNCLGETKERNELWORKGROUPINFO         __clewGetKernelWorkGroupInfo        = NULL;
+PFNCLWAITFOREVENTS                  __clewWaitForEvents                 = NULL;
+PFNCLGETEVENTINFO                   __clewGetEventInfo                  = NULL;
+PFNCLRETAINEVENT                    __clewRetainEvent                   = NULL;
+PFNCLRELEASEEVENT                   __clewReleaseEvent                  = NULL;
+PFNCLGETEVENTPROFILINGINFO          __clewGetEventProfilingInfo         = NULL;
+PFNCLFLUSH                          __clewFlush                         = NULL;
+PFNCLFINISH                         __clewFinish                        = NULL;
+PFNCLENQUEUEREADBUFFER              __clewEnqueueReadBuffer             = NULL;
+PFNCLENQUEUEWRITEBUFFER             __clewEnqueueWriteBuffer            = NULL;
+PFNCLENQUEUECOPYBUFFER              __clewEnqueueCopyBuffer             = NULL;
+PFNCLENQUEUEREADIMAGE               __clewEnqueueReadImage              = NULL;
+PFNCLENQUEUEWRITEIMAGE              __clewEnqueueWriteImage             = NULL;
+PFNCLENQUEUECOPYIMAGE               __clewEnqueueCopyImage              = NULL;
+PFNCLENQUEUECOPYIMAGETOBUFFER       __clewEnqueueCopyImageToBuffer      = NULL;
+PFNCLENQUEUECOPYBUFFERTOIMAGE       __clewEnqueueCopyBufferToImage      = NULL;
+PFNCLENQUEUEMAPBUFFER               __clewEnqueueMapBuffer              = NULL;
+PFNCLENQUEUEMAPIMAGE                __clewEnqueueMapImage               = NULL;
+PFNCLENQUEUEUNMAPMEMOBJECT          __clewEnqueueUnmapMemObject         = NULL;
+PFNCLENQUEUENDRANGEKERNEL           __clewEnqueueNDRangeKernel          = NULL;
+PFNCLENQUEUETASK                    __clewEnqueueTask                   = NULL;
+PFNCLENQUEUENATIVEKERNEL            __clewEnqueueNativeKernel           = NULL;
+PFNCLENQUEUEMARKER                  __clewEnqueueMarker                 = NULL;
+PFNCLENQUEUEWAITFOREVENTS           __clewEnqueueWaitForEvents          = NULL;
+PFNCLENQUEUEBARRIER                 __clewEnqueueBarrier                = NULL;
+PFNCLGETEXTENSIONFUNCTIONADDRESS    __clewGetExtensionFunctionAddress   = NULL;
+#endif  //  CLCC_GENERATE_DOCUMENTATION
+
+
+//! \brief Unloads OpenCL dynamic library, should not be called directly
+static void clewExit(void)
+{
+    if (module != NULL)
+    {
+        //  Ignore errors
+        CLCC_DYNLIB_CLOSE(module);
+        module = NULL;
+    }
+}
+
+#define CLEW_CHECK_FUNCTION(f)              \
+    if ((f) == NULL)                        \
+    {                                       \
+        CLCC_DYNLIB_CLOSE(module);          \
+        module = NULL;                      \
+        return CLEW_ERROR_IMPORT_FAILED;    \
+    }                                       \
+
+//! \param path path to dynamic library to load
+//! \return CLEW_ERROR_OPEN_FAILED if the library could not be opened
+//! CLEW_ERROR_ATEXIT_FAILED if atexit(clewExit) failed
+//! CLEW_SUCCESS when the library was succesfully loaded
+int clewInit(const char* path)
+{
+    int error = 0;
+
+    //  Check if already initialized
+    if (module != NULL)
+    {
+        return CLEW_SUCCESS;
+    }
+
+    //  Load library
+    module = CLCC_DYNLIB_OPEN(path);
+
+    //  Check for errors
+    if (module == NULL)
+    {
+        return CLEW_ERROR_OPEN_FAILED;
+    }
+
+    //  Set unloading
+    error = atexit(clewExit);
+
+    if (error)
+    {
+        //  Failure queing atexit, shutdown with error
+        CLCC_DYNLIB_CLOSE(module);
+        module = NULL;
+
+        return CLEW_ERROR_ATEXIT_FAILED;
+    }
+
+    //  Determine function entry-points
+    CLEW_CHECK_FUNCTION(__clewGetPlatformIDs                = (PFNCLGETPLATFORMIDS              )CLCC_DYNLIB_IMPORT(module, "clGetPlatformIDs"));
+    CLEW_CHECK_FUNCTION(__clewGetPlatformInfo               = (PFNCLGETPLATFORMINFO             )CLCC_DYNLIB_IMPORT(module, "clGetPlatformInfo"));
+    CLEW_CHECK_FUNCTION(__clewGetDeviceIDs                  = (PFNCLGETDEVICEIDS                )CLCC_DYNLIB_IMPORT(module, "clGetDeviceIDs"));
+    CLEW_CHECK_FUNCTION(__clewGetDeviceInfo                 = (PFNCLGETDEVICEINFO               )CLCC_DYNLIB_IMPORT(module, "clGetDeviceInfo"));
+    CLEW_CHECK_FUNCTION(__clewCreateContext                 = (PFNCLCREATECONTEXT               )CLCC_DYNLIB_IMPORT(module, "clCreateContext"));
+    CLEW_CHECK_FUNCTION(__clewCreateContextFromType         = (PFNCLCREATECONTEXTFROMTYPE       )CLCC_DYNLIB_IMPORT(module, "clCreateContextFromType"));
+    CLEW_CHECK_FUNCTION(__clewRetainContext                 = (PFNCLRETAINCONTEXT               )CLCC_DYNLIB_IMPORT(module, "clRetainContext"));
+    CLEW_CHECK_FUNCTION(__clewReleaseContext                = (PFNCLRELEASECONTEXT              )CLCC_DYNLIB_IMPORT(module, "clReleaseContext"));
+    CLEW_CHECK_FUNCTION(__clewGetContextInfo                = (PFNCLGETCONTEXTINFO              )CLCC_DYNLIB_IMPORT(module, "clGetContextInfo"));
+    CLEW_CHECK_FUNCTION(__clewCreateCommandQueue            = (PFNCLCREATECOMMANDQUEUE          )CLCC_DYNLIB_IMPORT(module, "clCreateCommandQueue"));
+    CLEW_CHECK_FUNCTION(__clewRetainCommandQueue            = (PFNCLRETAINCOMMANDQUEUE          )CLCC_DYNLIB_IMPORT(module, "clRetainCommandQueue"));
+    CLEW_CHECK_FUNCTION(__clewReleaseCommandQueue           = (PFNCLRELEASECOMMANDQUEUE         )CLCC_DYNLIB_IMPORT(module, "clReleaseCommandQueue"));
+    CLEW_CHECK_FUNCTION(__clewGetCommandQueueInfo           = (PFNCLGETCOMMANDQUEUEINFO         )CLCC_DYNLIB_IMPORT(module, "clGetCommandQueueInfo"));
+    CLEW_CHECK_FUNCTION(__clewSetCommandQueueProperty       = (PFNCLSETCOMMANDQUEUEPROPERTY     )CLCC_DYNLIB_IMPORT(module, "clSetCommandQueueProperty"));
+    CLEW_CHECK_FUNCTION(__clewCreateBuffer                  = (PFNCLCREATEBUFFER                )CLCC_DYNLIB_IMPORT(module, "clCreateBuffer"));
+    CLEW_CHECK_FUNCTION(__clewCreateImage2D                 = (PFNCLCREATEIMAGE2D               )CLCC_DYNLIB_IMPORT(module, "clCreateImage2D"));
+    CLEW_CHECK_FUNCTION(__clewCreateImage3D                 = (PFNCLCREATEIMAGE3D               )CLCC_DYNLIB_IMPORT(module, "clCreateImage3D"));
+    CLEW_CHECK_FUNCTION(__clewRetainMemObject               = (PFNCLRETAINMEMOBJECT             )CLCC_DYNLIB_IMPORT(module, "clRetainMemObject"));
+    CLEW_CHECK_FUNCTION(__clewReleaseMemObject              = (PFNCLRELEASEMEMOBJECT            )CLCC_DYNLIB_IMPORT(module, "clReleaseMemObject"));
+    CLEW_CHECK_FUNCTION(__clewGetSupportedImageFormats      = (PFNCLGETSUPPORTEDIMAGEFORMATS    )CLCC_DYNLIB_IMPORT(module, "clGetSupportedImageFormats"));
+    CLEW_CHECK_FUNCTION(__clewGetMemObjectInfo              = (PFNCLGETMEMOBJECTINFO            )CLCC_DYNLIB_IMPORT(module, "clGetMemObjectInfo"));
+    CLEW_CHECK_FUNCTION(__clewGetImageInfo                  = (PFNCLGETIMAGEINFO                )CLCC_DYNLIB_IMPORT(module, "clGetImageInfo"));
+    CLEW_CHECK_FUNCTION(__clewCreateSampler                 = (PFNCLCREATESAMPLER               )CLCC_DYNLIB_IMPORT(module, "clCreateSampler"));
+    CLEW_CHECK_FUNCTION(__clewRetainSampler                 = (PFNCLRETAINSAMPLER               )CLCC_DYNLIB_IMPORT(module, "clRetainSampler"));
+    CLEW_CHECK_FUNCTION(__clewReleaseSampler                = (PFNCLRELEASESAMPLER              )CLCC_DYNLIB_IMPORT(module, "clReleaseSampler"));
+    CLEW_CHECK_FUNCTION(__clewGetSamplerInfo                = (PFNCLGETSAMPLERINFO              )CLCC_DYNLIB_IMPORT(module, "clGetSamplerInfo"));
+    CLEW_CHECK_FUNCTION(__clewCreateProgramWithSource       = (PFNCLCREATEPROGRAMWITHSOURCE     )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithSource"));
+    CLEW_CHECK_FUNCTION(__clewCreateProgramWithBinary       = (PFNCLCREATEPROGRAMWITHBINARY     )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithBinary"));
+    CLEW_CHECK_FUNCTION(__clewRetainProgram                 = (PFNCLRETAINPROGRAM               )CLCC_DYNLIB_IMPORT(module, "clRetainProgram"));
+    CLEW_CHECK_FUNCTION(__clewReleaseProgram                = (PFNCLRELEASEPROGRAM              )CLCC_DYNLIB_IMPORT(module, "clReleaseProgram"));
+    CLEW_CHECK_FUNCTION(__clewBuildProgram                  = (PFNCLBUILDPROGRAM                )CLCC_DYNLIB_IMPORT(module, "clBuildProgram"));
+    CLEW_CHECK_FUNCTION(__clewUnloadCompiler                = (PFNCLUNLOADCOMPILER              )CLCC_DYNLIB_IMPORT(module, "clUnloadCompiler"));
+    CLEW_CHECK_FUNCTION(__clewGetProgramInfo                = (PFNCLGETPROGRAMINFO              )CLCC_DYNLIB_IMPORT(module, "clGetProgramInfo"));
+    CLEW_CHECK_FUNCTION(__clewGetProgramBuildInfo           = (PFNCLGETPROGRAMBUILDINFO         )CLCC_DYNLIB_IMPORT(module, "clGetProgramBuildInfo"));
+    CLEW_CHECK_FUNCTION(__clewCreateKernel                  = (PFNCLCREATEKERNEL                )CLCC_DYNLIB_IMPORT(module, "clCreateKernel"));
+    CLEW_CHECK_FUNCTION(__clewCreateKernelsInProgram        = (PFNCLCREATEKERNELSINPROGRAM      )CLCC_DYNLIB_IMPORT(module, "clCreateKernelsInProgram"));
+    CLEW_CHECK_FUNCTION(__clewRetainKernel                  = (PFNCLRETAINKERNEL                )CLCC_DYNLIB_IMPORT(module, "clRetainKernel"));
+    CLEW_CHECK_FUNCTION(__clewReleaseKernel                 = (PFNCLRELEASEKERNEL               )CLCC_DYNLIB_IMPORT(module, "clReleaseKernel"));
+    CLEW_CHECK_FUNCTION(__clewSetKernelArg                  = (PFNCLSETKERNELARG                )CLCC_DYNLIB_IMPORT(module, "clSetKernelArg"));
+    CLEW_CHECK_FUNCTION(__clewGetKernelInfo                 = (PFNCLGETKERNELINFO               )CLCC_DYNLIB_IMPORT(module, "clGetKernelInfo"));
+    CLEW_CHECK_FUNCTION(__clewGetKernelWorkGroupInfo        = (PFNCLGETKERNELWORKGROUPINFO      )CLCC_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo"));
+    CLEW_CHECK_FUNCTION(__clewWaitForEvents                 = (PFNCLWAITFOREVENTS               )CLCC_DYNLIB_IMPORT(module, "clWaitForEvents"));
+    CLEW_CHECK_FUNCTION(__clewGetEventInfo                  = (PFNCLGETEVENTINFO                )CLCC_DYNLIB_IMPORT(module, "clGetEventInfo"));
+    CLEW_CHECK_FUNCTION(__clewRetainEvent                   = (PFNCLRETAINEVENT                 )CLCC_DYNLIB_IMPORT(module, "clRetainEvent"));
+    CLEW_CHECK_FUNCTION(__clewReleaseEvent                  = (PFNCLRELEASEEVENT                )CLCC_DYNLIB_IMPORT(module, "clReleaseEvent"));
+    CLEW_CHECK_FUNCTION(__clewGetEventProfilingInfo         = (PFNCLGETEVENTPROFILINGINFO       )CLCC_DYNLIB_IMPORT(module, "clGetEventProfilingInfo"));
+    CLEW_CHECK_FUNCTION(__clewFlush                         = (PFNCLFLUSH                       )CLCC_DYNLIB_IMPORT(module, "clFlush"));
+    CLEW_CHECK_FUNCTION(__clewFinish                        = (PFNCLFINISH                      )CLCC_DYNLIB_IMPORT(module, "clFinish"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueReadBuffer             = (PFNCLENQUEUEREADBUFFER           )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadBuffer"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueWriteBuffer            = (PFNCLENQUEUEWRITEBUFFER          )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueCopyBuffer             = (PFNCLENQUEUECOPYBUFFER           )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueReadImage              = (PFNCLENQUEUEREADIMAGE            )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadImage"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueWriteImage             = (PFNCLENQUEUEWRITEIMAGE           )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteImage"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueCopyImage              = (PFNCLENQUEUECOPYIMAGE            )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImage"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueCopyImageToBuffer      = (PFNCLENQUEUECOPYIMAGETOBUFFER    )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueCopyBufferToImage      = (PFNCLENQUEUECOPYBUFFERTOIMAGE    )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueMapBuffer              = (PFNCLENQUEUEMAPBUFFER            )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapBuffer"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueMapImage               = (PFNCLENQUEUEMAPIMAGE             )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapImage"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueUnmapMemObject         = (PFNCLENQUEUEUNMAPMEMOBJECT       )CLCC_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueNDRangeKernel          = (PFNCLENQUEUENDRANGEKERNEL        )CLCC_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueTask                   = (PFNCLENQUEUETASK                 )CLCC_DYNLIB_IMPORT(module, "clEnqueueTask"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueNativeKernel           = (PFNCLENQUEUENATIVEKERNEL         )CLCC_DYNLIB_IMPORT(module, "clEnqueueNativeKernel"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueMarker                 = (PFNCLENQUEUEMARKER               )CLCC_DYNLIB_IMPORT(module, "clEnqueueMarker"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueWaitForEvents          = (PFNCLENQUEUEWAITFOREVENTS        )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents"));
+    CLEW_CHECK_FUNCTION(__clewEnqueueBarrier                = (PFNCLENQUEUEBARRIER              )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier"));
+    CLEW_CHECK_FUNCTION(__clewGetExtensionFunctionAddress   = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress"));
+
+    return CLEW_SUCCESS;
+}
+
+//! \param error CL error code
+//! \return a string representation of the error code
+const char* clewErrorString(cl_int error)
+{
+    static const char* strings[] =
+    {
+        // Error Codes
+          "CL_SUCCESS"                                  //   0
+        , "CL_DEVICE_NOT_FOUND"                         //  -1
+        , "CL_DEVICE_NOT_AVAILABLE"                     //  -2
+        , "CL_COMPILER_NOT_AVAILABLE"                   //  -3
+        , "CL_MEM_OBJECT_ALLOCATION_FAILURE"            //  -4
+        , "CL_OUT_OF_RESOURCES"                         //  -5
+        , "CL_OUT_OF_HOST_MEMORY"                       //  -6
+        , "CL_PROFILING_INFO_NOT_AVAILABLE"             //  -7
+        , "CL_MEM_COPY_OVERLAP"                         //  -8
+        , "CL_IMAGE_FORMAT_MISMATCH"                    //  -9
+        , "CL_IMAGE_FORMAT_NOT_SUPPORTED"               //  -10
+        , "CL_BUILD_PROGRAM_FAILURE"                    //  -11
+        , "CL_MAP_FAILURE"                              //  -12
+
+        , ""    //  -13
+        , ""    //  -14
+        , ""    //  -15
+        , ""    //  -16
+        , ""    //  -17
+        , ""    //  -18
+        , ""    //  -19
+
+        , ""    //  -20
+        , ""    //  -21
+        , ""    //  -22
+        , ""    //  -23
+        , ""    //  -24
+        , ""    //  -25
+        , ""    //  -26
+        , ""    //  -27
+        , ""    //  -28
+        , ""    //  -29
+
+        , "CL_INVALID_VALUE"                            //  -30
+        , "CL_INVALID_DEVICE_TYPE"                      //  -31
+        , "CL_INVALID_PLATFORM"                         //  -32
+        , "CL_INVALID_DEVICE"                           //  -33
+        , "CL_INVALID_CONTEXT"                          //  -34
+        , "CL_INVALID_QUEUE_PROPERTIES"                 //  -35
+        , "CL_INVALID_COMMAND_QUEUE"                    //  -36
+        , "CL_INVALID_HOST_PTR"                         //  -37
+        , "CL_INVALID_MEM_OBJECT"                       //  -38
+        , "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR"          //  -39
+        , "CL_INVALID_IMAGE_SIZE"                       //  -40
+        , "CL_INVALID_SAMPLER"                          //  -41
+        , "CL_INVALID_BINARY"                           //  -42
+        , "CL_INVALID_BUILD_OPTIONS"                    //  -43
+        , "CL_INVALID_PROGRAM"                          //  -44
+        , "CL_INVALID_PROGRAM_EXECUTABLE"               //  -45
+        , "CL_INVALID_KERNEL_NAME"                      //  -46
+        , "CL_INVALID_KERNEL_DEFINITION"                //  -47
+        , "CL_INVALID_KERNEL"                           //  -48
+        , "CL_INVALID_ARG_INDEX"                        //  -49
+        , "CL_INVALID_ARG_VALUE"                        //  -50
+        , "CL_INVALID_ARG_SIZE"                         //  -51
+        , "CL_INVALID_KERNEL_ARGS"                      //  -52
+        , "CL_INVALID_WORK_DIMENSION"                   //  -53
+        , "CL_INVALID_WORK_GROUP_SIZE"                  //  -54
+        , "CL_INVALID_WORK_ITEM_SIZE"                   //  -55
+        , "CL_INVALID_GLOBAL_OFFSET"                    //  -56
+        , "CL_INVALID_EVENT_WAIT_LIST"                  //  -57
+        , "CL_INVALID_EVENT"                            //  -58
+        , "CL_INVALID_OPERATION"                        //  -59
+        , "CL_INVALID_GL_OBJECT"                        //  -60
+        , "CL_INVALID_BUFFER_SIZE"                      //  -61
+        , "CL_INVALID_MIP_LEVEL"                        //  -62
+        , "CL_INVALID_GLOBAL_WORK_SIZE"                 //  -63
+    };
+
+    if  (   (error > 0)
+        ||  (error < -63)
+        )
+    {
+        return "unknown error code (no OpenCL driver?)";
+    }
+
+    return strings[-error];
+}
diff --git a/sc/source/core/opencl/clcc/clew.h b/sc/source/core/opencl/clcc/clew.h
new file mode 100644
index 0000000..64508a5
--- /dev/null
+++ b/sc/source/core/opencl/clcc/clew.h
@@ -0,0 +1,1318 @@
+#ifndef CLCC_CLEW_HPP_INCLUDED
+#define CLCC_CLEW_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////
+//  Copyright (c) 2009-2011 Organic Vectory B.V.
+//  Written by George van Venrooij
+//
+//  Distributed under the Boost Software License, Version 1.0.
+//  (See accompanying file license.txt)
+//////////////////////////////////////////////////////////////////////////
+
+//! \file clew.h
+//! \brief OpenCL run-time loader header
+//!
+//! This file contains a copy of the contents of CL.H and CL_PLATFORM.H from the
+//! official OpenCL spec. The purpose of this code is to load the OpenCL dynamic
+//! library at run-time and thus allow the executable to function on many
+//! platforms regardless of the vendor of the OpenCL driver actually installed.
+//! Some of the techniques used here were inspired by work done in the GLEW
+//! library (http://glew.sourceforge.net/)
+
+//  Run-time dynamic linking functionality based on concepts used in GLEW
+#ifdef  __OPENCL_CL_H
+#error cl.h included before clew.h
+#endif
+
+#ifdef  __OPENCL_CL_PLATFORM_H
+#error cl_platform.h included before clew.h
+#endif
+
+#ifndef CLCC_GENERATE_DOCUMENTATION
+//  Prevent cl.h inclusion
+#define __OPENCL_CL_H
+//  Prevent cl_platform.h inclusion
+#define __CL_PLATFORM_H
+#endif  //  CLCC_GENERATE_DOCUMENTATION
+
+/*******************************************************************************
+* Copyright (c) 2008-2009 The Khronos Group Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and/or associated documentation files (the
+* "Materials"), to deal in the Materials without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Materials, and to
+* permit persons to whom the Materials are furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Materials.
+*
+* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+******************************************************************************/
+#ifdef __APPLE__
+/* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
+#include <AvailabilityMacros.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CLCC_GENERATE_DOCUMENTATION
+
+#if defined(_WIN32)
+#define CL_API_ENTRY
+#define CL_API_CALL __stdcall
+#else
+#define CL_API_ENTRY
+#define CL_API_CALL
+#endif
+
+#if defined(__APPLE__)
+#define CL_API_SUFFIX__VERSION_1_0   AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
+#else
+#define CL_API_SUFFIX__VERSION_1_0
+#define CL_EXTENSION_WEAK_LINK
+#endif
+
+#if defined(_WIN32) && defined(_MSC_VER)
+
+/* scalar types  */
+typedef signed   __int8         cl_char;
+typedef unsigned __int8         cl_uchar;
+typedef signed   __int16        cl_short;
+typedef unsigned __int16        cl_ushort;
+typedef signed   __int32        cl_int;
+typedef unsigned __int32        cl_uint;
+typedef signed   __int64        cl_long;
+typedef unsigned __int64        cl_ulong;
+
+typedef unsigned __int16        cl_half;
+typedef float                   cl_float;
+typedef double                  cl_double;
+
+
+/*
+* Vector types
+*
+*  Note:   OpenCL requires that all types be naturally aligned.
+*          This means that vector types must be naturally aligned.
+*          For example, a vector of four floats must be aligned to
+*          a 16 byte boundary (calculated as 4 * the natural 4-byte
+*          alignment of the float).  The alignment qualifiers here
+*          will only function properly if your compiler supports them
+*          and if you don't actively work to defeat them.  For example,
+*          in order for a cl_float4 to be 16 byte aligned in a struct,
+*          the start of the struct must itself be 16-byte aligned.
+*
+*          Maintaining proper alignment is the user's responsibility.
+*/
+typedef signed   __int8          cl_char2[2];
+typedef signed   __int8          cl_char4[4];
+typedef signed   __int8          cl_char8[8];
+typedef signed   __int8          cl_char16[16];
+typedef unsigned __int8         cl_uchar2[2];
+typedef unsigned __int8         cl_uchar4[4];
+typedef unsigned __int8         cl_uchar8[8];
+typedef unsigned __int8         cl_uchar16[16];
+
+typedef signed   __int16         cl_short2[2];
+typedef signed   __int16         cl_short4[4];
+typedef signed   __int16         cl_short8[8];
+typedef signed   __int16         cl_short16[16];
+typedef unsigned __int16        cl_ushort2[2];
+typedef unsigned __int16        cl_ushort4[4];
+typedef unsigned __int16        cl_ushort8[8];
+typedef unsigned __int16        cl_ushort16[16];
+
+typedef signed   __int32         cl_int2[2];
+typedef signed   __int32         cl_int4[4];
+typedef signed   __int32         cl_int8[8];
+typedef signed   __int32         cl_int16[16];
+typedef unsigned __int32        cl_uint2[2];
+typedef unsigned __int32        cl_uint4[4];
+typedef unsigned __int32        cl_uint8[8];
+typedef unsigned __int32        cl_uint16[16];
+
+typedef signed   __int64         cl_long2[2];
+typedef signed   __int64         cl_long4[4];
+typedef signed   __int64         cl_long8[8];
+typedef signed   __int64         cl_long16[16];
+typedef unsigned __int64        cl_ulong2[2];
+typedef unsigned __int64        cl_ulong4[4];
+typedef unsigned __int64        cl_ulong8[8];
+typedef unsigned __int64        cl_ulong16[16];
+
+typedef float           cl_float2[2];
+typedef float           cl_float4[4];
+typedef float           cl_float8[8];
+typedef float           cl_float16[16];
+
+typedef double          cl_double2[2];
+typedef double          cl_double4[4];
+typedef double          cl_double8[8];
+typedef double          cl_double16[16];
+/* There are no vector types for half */
+
+#else
+
+#include <stdint.h>
+
+/* scalar types  */
+typedef int8_t          cl_char;
+typedef uint8_t         cl_uchar;
+typedef int16_t         cl_short    __attribute__((aligned(2)));
+typedef uint16_t        cl_ushort   __attribute__((aligned(2)));
+typedef int32_t         cl_int      __attribute__((aligned(4)));
+typedef uint32_t        cl_uint     __attribute__((aligned(4)));
+typedef int64_t         cl_long     __attribute__((aligned(8)));
+typedef uint64_t        cl_ulong    __attribute__((aligned(8)));
+
+typedef uint16_t        cl_half     __attribute__((aligned(2)));
+typedef float           cl_float    __attribute__((aligned(4)));
+typedef double          cl_double   __attribute__((aligned(8)));
+
+/*
+* Vector types
+*
+*  Note:   OpenCL requires that all types be naturally aligned.
+*          This means that vector types must be naturally aligned.
+*          For example, a vector of four floats must be aligned to
+*          a 16 byte boundary (calculated as 4 * the natural 4-byte
+*          alignment of the float).  The alignment qualifiers here
+*          will only function properly if your compiler supports them
+*          and if you don't actively work to defeat them.  For example,
+*          in order for a cl_float4 to be 16 byte aligned in a struct,
+*          the start of the struct must itself be 16-byte aligned.
+*
+*          Maintaining proper alignment is the user's responsibility.
+*/
+typedef int8_t          cl_char2[2]     __attribute__((aligned(2)));
+typedef int8_t          cl_char4[4]     __attribute__((aligned(4)));
+typedef int8_t          cl_char8[8]     __attribute__((aligned(8)));
+typedef int8_t          cl_char16[16]   __attribute__((aligned(16)));
+typedef uint8_t         cl_uchar2[2]    __attribute__((aligned(2)));
+typedef uint8_t         cl_uchar4[4]    __attribute__((aligned(4)));
+typedef uint8_t         cl_uchar8[8]    __attribute__((aligned(8)));
+typedef uint8_t         cl_uchar16[16]  __attribute__((aligned(16)));
+
+typedef int16_t         cl_short2[2]     __attribute__((aligned(4)));
+typedef int16_t         cl_short4[4]     __attribute__((aligned(8)));
+typedef int16_t         cl_short8[8]     __attribute__((aligned(16)));
+typedef int16_t         cl_short16[16]   __attribute__((aligned(32)));
+typedef uint16_t        cl_ushort2[2]    __attribute__((aligned(4)));
+typedef uint16_t        cl_ushort4[4]    __attribute__((aligned(8)));
+typedef uint16_t        cl_ushort8[8]    __attribute__((aligned(16)));
+typedef uint16_t        cl_ushort16[16]  __attribute__((aligned(32)));
+
+typedef int32_t         cl_int2[2]      __attribute__((aligned(8)));
+typedef int32_t         cl_int4[4]      __attribute__((aligned(16)));
+typedef int32_t         cl_int8[8]      __attribute__((aligned(32)));
+typedef int32_t         cl_int16[16]    __attribute__((aligned(64)));
+typedef uint32_t        cl_uint2[2]     __attribute__((aligned(8)));
+typedef uint32_t        cl_uint4[4]     __attribute__((aligned(16)));
+typedef uint32_t        cl_uint8[8]     __attribute__((aligned(32)));
+typedef uint32_t        cl_uint16[16]   __attribute__((aligned(64)));
+
+typedef int64_t         cl_long2[2]     __attribute__((aligned(16)));
+typedef int64_t         cl_long4[4]     __attribute__((aligned(32)));
+typedef int64_t         cl_long8[8]     __attribute__((aligned(64)));
+typedef int64_t         cl_long16[16]   __attribute__((aligned(128)));
+typedef uint64_t        cl_ulong2[2]    __attribute__((aligned(16)));
+typedef uint64_t        cl_ulong4[4]    __attribute__((aligned(32)));
+typedef uint64_t        cl_ulong8[8]    __attribute__((aligned(64)));
+typedef uint64_t        cl_ulong16[16]  __attribute__((aligned(128)));
+
+typedef float           cl_float2[2]    __attribute__((aligned(8)));
+typedef float           cl_float4[4]    __attribute__((aligned(16)));
+typedef float           cl_float8[8]    __attribute__((aligned(32)));
+typedef float           cl_float16[16]  __attribute__((aligned(64)));
+
+typedef double          cl_double2[2]   __attribute__((aligned(16)));
+typedef double          cl_double4[4]   __attribute__((aligned(32)));
+typedef double          cl_double8[8]   __attribute__((aligned(64)));
+typedef double          cl_double16[16] __attribute__((aligned(128)));
+
+/* There are no vector types for half */
+
+#endif
+
+/******************************************************************************/
+
+// Macro names and corresponding values defined by OpenCL
+
+#define CL_CHAR_BIT         8
+#define CL_SCHAR_MAX        127
+#define CL_SCHAR_MIN        (-127-1)
+#define CL_CHAR_MAX         CL_SCHAR_MAX
+#define CL_CHAR_MIN         CL_SCHAR_MIN
+#define CL_UCHAR_MAX        255
+#define CL_SHRT_MAX         32767
+#define CL_SHRT_MIN         (-32767-1)
+#define CL_USHRT_MAX        65535
+#define CL_INT_MAX          2147483647
+#define CL_INT_MIN          (-2147483647-1)
+#define CL_UINT_MAX         0xffffffffU
+#define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG          6
+#define CL_FLT_MANT_DIG     24
+#define CL_FLT_MAX_10_EXP   +38
+#define CL_FLT_MAX_EXP      +128
+#define CL_FLT_MIN_10_EXP   -37
+#define CL_FLT_MIN_EXP      -125
+#define CL_FLT_RADIX        2
+#if defined(_MSC_VER)
+// MSVC doesn't understand hex floats
+#define CL_FLT_MAX          3.402823466e+38F
+#define CL_FLT_MIN          1.175494351e-38F
+#define CL_FLT_EPSILON      1.192092896e-07F
+#else
+#define CL_FLT_MAX          0x1.fffffep127f
+#define CL_FLT_MIN          0x1.0p-126f
+#define CL_FLT_EPSILON      0x1.0p-23f
+#endif
+
+#define CL_DBL_DIG          15
+#define CL_DBL_MANT_DIG     53
+#define CL_DBL_MAX_10_EXP   +308
+#define CL_DBL_MAX_EXP      +1024
+#define CL_DBL_MIN_10_EXP   -307
+#define CL_DBL_MIN_EXP      -1021
+#define CL_DBL_RADIX        2
+#if defined(_MSC_VER)
+// MSVC doesn't understand hex floats
+#define CL_DBL_MAX          1.7976931348623158e+308
+#define CL_DBL_MIN          2.2250738585072014e-308
+#define CL_DBL_EPSILON      2.2204460492503131e-016
+#else
+#define CL_DBL_MAX          0x1.fffffffffffffp1023
+#define CL_DBL_MIN          0x1.0p-1022
+#define CL_DBL_EPSILON      0x1.0p-52
+#endif
+
+#include <stddef.h>
+
+
+//  CL.h contents
+/******************************************************************************/
+
+typedef struct _cl_platform_id *    cl_platform_id;
+typedef struct _cl_device_id *      cl_device_id;
+typedef struct _cl_context *        cl_context;
+typedef struct _cl_command_queue *  cl_command_queue;
+typedef struct _cl_mem *            cl_mem;
+typedef struct _cl_program *        cl_program;
+typedef struct _cl_kernel *         cl_kernel;
+typedef struct _cl_event *          cl_event;
+typedef struct _cl_sampler *        cl_sampler;
+
+typedef cl_uint             cl_bool;                     /* WARNING!  Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */
+typedef cl_ulong            cl_bitfield;
+typedef cl_bitfield         cl_device_type;
+typedef cl_uint             cl_platform_info;
+typedef cl_uint             cl_device_info;
+typedef cl_bitfield         cl_device_address_info;
+typedef cl_bitfield         cl_device_fp_config;
+typedef cl_uint             cl_device_mem_cache_type;
+typedef cl_uint             cl_device_local_mem_type;
+typedef cl_bitfield         cl_device_exec_capabilities;
+typedef cl_bitfield         cl_command_queue_properties;
+
+typedef intptr_t            cl_context_properties;
+typedef cl_uint             cl_context_info;
+typedef cl_uint             cl_command_queue_info;
+typedef cl_uint             cl_channel_order;
+typedef cl_uint             cl_channel_type;
+typedef cl_bitfield         cl_mem_flags;
+typedef cl_uint             cl_mem_object_type;
+typedef cl_uint             cl_mem_info;
+typedef cl_uint             cl_image_info;
+typedef cl_uint             cl_addressing_mode;
+typedef cl_uint             cl_filter_mode;
+typedef cl_uint             cl_sampler_info;
+typedef cl_bitfield         cl_map_flags;
+typedef cl_uint             cl_program_info;
+typedef cl_uint             cl_program_build_info;
+typedef cl_int              cl_build_status;
+typedef cl_uint             cl_kernel_info;
+typedef cl_uint             cl_kernel_work_group_info;
+typedef cl_uint             cl_event_info;
+typedef cl_uint             cl_command_type;
+typedef cl_uint             cl_profiling_info;
+
+typedef struct _cl_image_format {
+    cl_channel_order        image_channel_order;
+    cl_channel_type         image_channel_data_type;
+} cl_image_format;
+
+
+
+/******************************************************************************/
+
+// Error Codes
+#define CL_SUCCESS                                  0
+#define CL_DEVICE_NOT_FOUND                         -1
+#define CL_DEVICE_NOT_AVAILABLE                     -2
+#define CL_COMPILER_NOT_AVAILABLE                   -3
+#define CL_MEM_OBJECT_ALLOCATION_FAILURE            -4
+#define CL_OUT_OF_RESOURCES                         -5
+#define CL_OUT_OF_HOST_MEMORY                       -6
+#define CL_PROFILING_INFO_NOT_AVAILABLE             -7
+#define CL_MEM_COPY_OVERLAP                         -8
+#define CL_IMAGE_FORMAT_MISMATCH                    -9
+#define CL_IMAGE_FORMAT_NOT_SUPPORTED               -10
+#define CL_BUILD_PROGRAM_FAILURE                    -11
+#define CL_MAP_FAILURE                              -12
+
+#define CL_INVALID_VALUE                            -30
+#define CL_INVALID_DEVICE_TYPE                      -31
+#define CL_INVALID_PLATFORM                         -32
+#define CL_INVALID_DEVICE                           -33
+#define CL_INVALID_CONTEXT                          -34
+#define CL_INVALID_QUEUE_PROPERTIES                 -35
+#define CL_INVALID_COMMAND_QUEUE                    -36
+#define CL_INVALID_HOST_PTR                         -37
+#define CL_INVALID_MEM_OBJECT                       -38
+#define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR          -39
+#define CL_INVALID_IMAGE_SIZE                       -40
+#define CL_INVALID_SAMPLER                          -41
+#define CL_INVALID_BINARY                           -42
+#define CL_INVALID_BUILD_OPTIONS                    -43
+#define CL_INVALID_PROGRAM                          -44
+#define CL_INVALID_PROGRAM_EXECUTABLE               -45
+#define CL_INVALID_KERNEL_NAME                      -46
+#define CL_INVALID_KERNEL_DEFINITION                -47
+#define CL_INVALID_KERNEL                           -48
+#define CL_INVALID_ARG_INDEX                        -49
+#define CL_INVALID_ARG_VALUE                        -50
+#define CL_INVALID_ARG_SIZE                         -51
+#define CL_INVALID_KERNEL_ARGS                      -52
+#define CL_INVALID_WORK_DIMENSION                   -53
+#define CL_INVALID_WORK_GROUP_SIZE                  -54
+#define CL_INVALID_WORK_ITEM_SIZE                   -55
+#define CL_INVALID_GLOBAL_OFFSET                    -56
+#define CL_INVALID_EVENT_WAIT_LIST                  -57
+#define CL_INVALID_EVENT                            -58
+#define CL_INVALID_OPERATION                        -59
+#define CL_INVALID_GL_OBJECT                        -60
+#define CL_INVALID_BUFFER_SIZE                      -61
+#define CL_INVALID_MIP_LEVEL                        -62
+#define CL_INVALID_GLOBAL_WORK_SIZE                 -63
+
+// OpenCL Version
+#define CL_VERSION_1_0                              1
+
+// cl_bool
+#define CL_FALSE                                    0
+#define CL_TRUE                                     1
+
+// cl_platform_info
+#define CL_PLATFORM_PROFILE                         0x0900
+#define CL_PLATFORM_VERSION                         0x0901
+#define CL_PLATFORM_NAME                            0x0902
+#define CL_PLATFORM_VENDOR                          0x0903
+#define CL_PLATFORM_EXTENSIONS                      0x0904
+
+// cl_device_type - bitfield
+#define CL_DEVICE_TYPE_DEFAULT                      (1 << 0)
+#define CL_DEVICE_TYPE_CPU                          (1 << 1)
+#define CL_DEVICE_TYPE_GPU                          (1 << 2)
+#define CL_DEVICE_TYPE_ACCELERATOR                  (1 << 3)
+#define CL_DEVICE_TYPE_ALL                          0xFFFFFFFF
+
+// cl_device_info
+#define CL_DEVICE_TYPE                              0x1000
+#define CL_DEVICE_VENDOR_ID                         0x1001
+#define CL_DEVICE_MAX_COMPUTE_UNITS                 0x1002
+#define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS          0x1003
+#define CL_DEVICE_MAX_WORK_GROUP_SIZE               0x1004
+#define CL_DEVICE_MAX_WORK_ITEM_SIZES               0x1005
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR       0x1006
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT      0x1007
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT        0x1008
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG       0x1009
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT      0x100A
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE     0x100B
+#define CL_DEVICE_MAX_CLOCK_FREQUENCY               0x100C
+#define CL_DEVICE_ADDRESS_BITS                      0x100D
+#define CL_DEVICE_MAX_READ_IMAGE_ARGS               0x100E
+#define CL_DEVICE_MAX_WRITE_IMAGE_ARGS              0x100F
+#define CL_DEVICE_MAX_MEM_ALLOC_SIZE                0x1010
+#define CL_DEVICE_IMAGE2D_MAX_WIDTH                 0x1011
+#define CL_DEVICE_IMAGE2D_MAX_HEIGHT                0x1012
+#define CL_DEVICE_IMAGE3D_MAX_WIDTH                 0x1013
+#define CL_DEVICE_IMAGE3D_MAX_HEIGHT                0x1014
+#define CL_DEVICE_IMAGE3D_MAX_DEPTH                 0x1015
+#define CL_DEVICE_IMAGE_SUPPORT                     0x1016
+#define CL_DEVICE_MAX_PARAMETER_SIZE                0x1017
+#define CL_DEVICE_MAX_SAMPLERS                      0x1018
+#define CL_DEVICE_MEM_BASE_ADDR_ALIGN               0x1019
+#define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE          0x101A
+#define CL_DEVICE_SINGLE_FP_CONFIG                  0x101B
+#define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE             0x101C
+#define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE         0x101D
+#define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE             0x101E
+#define CL_DEVICE_GLOBAL_MEM_SIZE                   0x101F
+#define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE          0x1020
+#define CL_DEVICE_MAX_CONSTANT_ARGS                 0x1021
+#define CL_DEVICE_LOCAL_MEM_TYPE                    0x1022
+#define CL_DEVICE_LOCAL_MEM_SIZE                    0x1023
+#define CL_DEVICE_ERROR_CORRECTION_SUPPORT          0x1024
+#define CL_DEVICE_PROFILING_TIMER_RESOLUTION        0x1025
+#define CL_DEVICE_ENDIAN_LITTLE                     0x1026
+#define CL_DEVICE_AVAILABLE                         0x1027
+#define CL_DEVICE_COMPILER_AVAILABLE                0x1028
+#define CL_DEVICE_EXECUTION_CAPABILITIES            0x1029
+#define CL_DEVICE_QUEUE_PROPERTIES                  0x102A
+#define CL_DEVICE_NAME                              0x102B
+#define CL_DEVICE_VENDOR                            0x102C
+#define CL_DRIVER_VERSION                           0x102D
+#define CL_DEVICE_PROFILE                           0x102E
+#define CL_DEVICE_VERSION                           0x102F
+#define CL_DEVICE_EXTENSIONS                        0x1030
+#define CL_DEVICE_PLATFORM                          0x1031
+
+// cl_device_fp_config - bitfield
+#define CL_FP_DENORM                                (1 << 0)
+#define CL_FP_INF_NAN                               (1 << 1)
+#define CL_FP_ROUND_TO_NEAREST                      (1 << 2)
+#define CL_FP_ROUND_TO_ZERO                         (1 << 3)
+#define CL_FP_ROUND_TO_INF                          (1 << 4)
+#define CL_FP_FMA                                   (1 << 5)
+
+// cl_device_mem_cache_type
+#define CL_NONE                                     0x0
+#define CL_READ_ONLY_CACHE                          0x1
+#define CL_READ_WRITE_CACHE                         0x2
+
+// cl_device_local_mem_type
+#define CL_LOCAL                                    0x1
+#define CL_GLOBAL                                   0x2
+
+// cl_device_exec_capabilities - bitfield
+#define CL_EXEC_KERNEL                              (1 << 0)
+#define CL_EXEC_NATIVE_KERNEL                       (1 << 1)
+
+// cl_command_queue_properties - bitfield
+#define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE      (1 << 0)
+#define CL_QUEUE_PROFILING_ENABLE                   (1 << 1)
+
+// cl_context_info
+#define CL_CONTEXT_REFERENCE_COUNT                  0x1080
+#define CL_CONTEXT_DEVICES                          0x1081
+#define CL_CONTEXT_PROPERTIES                       0x1082
+#define CL_CONTEXT_NUM_DEVICES                      0x1083
+
+// cl_context_properties
+#define CL_CONTEXT_PLATFORM                         0x1084
+
+// cl_command_queue_info
+#define CL_QUEUE_CONTEXT                            0x1090
+#define CL_QUEUE_DEVICE                             0x1091
+#define CL_QUEUE_REFERENCE_COUNT                    0x1092
+#define CL_QUEUE_PROPERTIES                         0x1093
+
+// cl_mem_flags - bitfield
+#define CL_MEM_READ_WRITE                           (1 << 0)
+#define CL_MEM_WRITE_ONLY                           (1 << 1)
+#define CL_MEM_READ_ONLY                            (1 << 2)
+#define CL_MEM_USE_HOST_PTR                         (1 << 3)
+#define CL_MEM_ALLOC_HOST_PTR                       (1 << 4)
+#define CL_MEM_COPY_HOST_PTR                        (1 << 5)
+
+// cl_channel_order
+#define CL_R                                        0x10B0
+#define CL_A                                        0x10B1
+#define CL_RG                                       0x10B2
+#define CL_RA                                       0x10B3
+#define CL_RGB                                      0x10B4
+#define CL_RGBA                                     0x10B5
+#define CL_BGRA                                     0x10B6
+#define CL_ARGB                                     0x10B7
+#define CL_INTENSITY                                0x10B8
+#define CL_LUMINANCE                                0x10B9
+
+// cl_channel_type
+#define CL_SNORM_INT8                               0x10D0
+#define CL_SNORM_INT16                              0x10D1
+#define CL_UNORM_INT8                               0x10D2
+#define CL_UNORM_INT16                              0x10D3
+#define CL_UNORM_SHORT_565                          0x10D4
+#define CL_UNORM_SHORT_555                          0x10D5
+#define CL_UNORM_INT_101010                         0x10D6
+#define CL_SIGNED_INT8                              0x10D7
+#define CL_SIGNED_INT16                             0x10D8
+#define CL_SIGNED_INT32                             0x10D9
+#define CL_UNSIGNED_INT8                            0x10DA
+#define CL_UNSIGNED_INT16                           0x10DB
+#define CL_UNSIGNED_INT32                           0x10DC
+#define CL_HALF_FLOAT                               0x10DD
+#define CL_FLOAT                                    0x10DE
+
+// cl_mem_object_type
+#define CL_MEM_OBJECT_BUFFER                        0x10F0
+#define CL_MEM_OBJECT_IMAGE2D                       0x10F1
+#define CL_MEM_OBJECT_IMAGE3D                       0x10F2
+
+// cl_mem_info
+#define CL_MEM_TYPE                                 0x1100
+#define CL_MEM_FLAGS                                0x1101
+#define CL_MEM_SIZE                                 0x1102
+#define CL_MEM_HOST_PTR                             0x1103
+#define CL_MEM_MAP_COUNT                            0x1104
+#define CL_MEM_REFERENCE_COUNT                      0x1105
+#define CL_MEM_CONTEXT                              0x1106
+
+// cl_image_info
+#define CL_IMAGE_FORMAT                             0x1110
+#define CL_IMAGE_ELEMENT_SIZE                       0x1111
+#define CL_IMAGE_ROW_PITCH                          0x1112
+#define CL_IMAGE_SLICE_PITCH                        0x1113
+#define CL_IMAGE_WIDTH                              0x1114
+#define CL_IMAGE_HEIGHT                             0x1115
+#define CL_IMAGE_DEPTH                              0x1116
+
+// cl_addressing_mode
+#define CL_ADDRESS_NONE                             0x1130
+#define CL_ADDRESS_CLAMP_TO_EDGE                    0x1131
+#define CL_ADDRESS_CLAMP                            0x1132
+#define CL_ADDRESS_REPEAT                           0x1133
+
+// cl_filter_mode
+#define CL_FILTER_NEAREST                           0x1140
+#define CL_FILTER_LINEAR                            0x1141
+
+// cl_sampler_info
+#define CL_SAMPLER_REFERENCE_COUNT                  0x1150
+#define CL_SAMPLER_CONTEXT                          0x1151
+#define CL_SAMPLER_NORMALIZED_COORDS                0x1152
+#define CL_SAMPLER_ADDRESSING_MODE                  0x1153
+#define CL_SAMPLER_FILTER_MODE                      0x1154
+
+// cl_map_flags - bitfield
+#define CL_MAP_READ                                 (1 << 0)
+#define CL_MAP_WRITE                                (1 << 1)
+
+// cl_program_info
+#define CL_PROGRAM_REFERENCE_COUNT                  0x1160
+#define CL_PROGRAM_CONTEXT                          0x1161
+#define CL_PROGRAM_NUM_DEVICES                      0x1162
+#define CL_PROGRAM_DEVICES                          0x1163
+#define CL_PROGRAM_SOURCE                           0x1164
+#define CL_PROGRAM_BINARY_SIZES                     0x1165
+#define CL_PROGRAM_BINARIES                         0x1166
+
+// cl_program_build_info
+#define CL_PROGRAM_BUILD_STATUS                     0x1181
+#define CL_PROGRAM_BUILD_OPTIONS                    0x1182
+#define CL_PROGRAM_BUILD_LOG                        0x1183
+
+// cl_build_status
+#define CL_BUILD_SUCCESS                            0
+#define CL_BUILD_NONE                               -1
+#define CL_BUILD_ERROR                              -2
+#define CL_BUILD_IN_PROGRESS                        -3
+
+// cl_kernel_info
+#define CL_KERNEL_FUNCTION_NAME                     0x1190
+#define CL_KERNEL_NUM_ARGS                          0x1191
+#define CL_KERNEL_REFERENCE_COUNT                   0x1192
+#define CL_KERNEL_CONTEXT                           0x1193
+#define CL_KERNEL_PROGRAM                           0x1194
+
+// cl_kernel_work_group_info
+#define CL_KERNEL_WORK_GROUP_SIZE                   0x11B0
+#define CL_KERNEL_COMPILE_WORK_GROUP_SIZE           0x11B1
+#define CL_KERNEL_LOCAL_MEM_SIZE                    0x11B2
+
+// cl_event_info
+#define CL_EVENT_COMMAND_QUEUE                      0x11D0
+#define CL_EVENT_COMMAND_TYPE                       0x11D1
+#define CL_EVENT_REFERENCE_COUNT                    0x11D2
+#define CL_EVENT_COMMAND_EXECUTION_STATUS           0x11D3
+
+// cl_command_type
+#define CL_COMMAND_NDRANGE_KERNEL                   0x11F0
+#define CL_COMMAND_TASK                             0x11F1
+#define CL_COMMAND_NATIVE_KERNEL                    0x11F2
+#define CL_COMMAND_READ_BUFFER                      0x11F3
+#define CL_COMMAND_WRITE_BUFFER                     0x11F4
+#define CL_COMMAND_COPY_BUFFER                      0x11F5
+#define CL_COMMAND_READ_IMAGE                       0x11F6
+#define CL_COMMAND_WRITE_IMAGE                      0x11F7
+#define CL_COMMAND_COPY_IMAGE                       0x11F8
+#define CL_COMMAND_COPY_IMAGE_TO_BUFFER             0x11F9
+#define CL_COMMAND_COPY_BUFFER_TO_IMAGE             0x11FA
+#define CL_COMMAND_MAP_BUFFER                       0x11FB
+#define CL_COMMAND_MAP_IMAGE                        0x11FC
+#define CL_COMMAND_UNMAP_MEM_OBJECT                 0x11FD
+#define CL_COMMAND_MARKER                           0x11FE
+#define CL_COMMAND_ACQUIRE_GL_OBJECTS               0x11FF
+#define CL_COMMAND_RELEASE_GL_OBJECTS               0x1200
+
+// command execution status
+#define CL_COMPLETE                                 0x0
+#define CL_RUNNING                                  0x1
+#define CL_SUBMITTED                                0x2
+#define CL_QUEUED                                   0x3
+
+// cl_profiling_info
+#define CL_PROFILING_COMMAND_QUEUED                 0x1280
+#define CL_PROFILING_COMMAND_SUBMIT                 0x1281
+#define CL_PROFILING_COMMAND_START                  0x1282
+#define CL_PROFILING_COMMAND_END                    0x1283
+
+/********************************************************************************************************/
+
+/********************************************************************************************************/
+
+//  Function signature typedef's
+
+// Platform API
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETPLATFORMIDS)(cl_uint          /* num_entries */,
+                 cl_platform_id * /* platforms */,
+                 cl_uint *        /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETPLATFORMINFO)(cl_platform_id   /* platform */,
+                  cl_platform_info /* param_name */,
+                  size_t           /* param_value_size */,
+                  void *           /* param_value */,
+                  size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+// Device APIs
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETDEVICEIDS)(cl_platform_id   /* platform */,
+               cl_device_type   /* device_type */,
+               cl_uint          /* num_entries */,
+               cl_device_id *   /* devices */,
+               cl_uint *        /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETDEVICEINFO)(cl_device_id    /* device */,
+                cl_device_info  /* param_name */,
+                size_t          /* param_value_size */,
+                void *          /* param_value */,
+                size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+// Context APIs
+typedef CL_API_ENTRY cl_context (CL_API_CALL *
+PFNCLCREATECONTEXT)(const cl_context_properties * /* properties */,
+                cl_uint                       /* num_devices */,
+                const cl_device_id *          /* devices */,
+                void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
+                void *                        /* user_data */,
+                cl_int *                      /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_context (CL_API_CALL *
+PFNCLCREATECONTEXTFROMTYPE)(const cl_context_properties * /* properties */,
+                        cl_device_type                /* device_type */,
+                        void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
+                        void *                        /* user_data */,
+                        cl_int *                      /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLRETAINCONTEXT)(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLRELEASECONTEXT)(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETCONTEXTINFO)(cl_context         /* context */,
+                 cl_context_info    /* param_name */,
+                 size_t             /* param_value_size */,
+                 void *             /* param_value */,
+                 size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+// Command Queue APIs
+typedef CL_API_ENTRY cl_command_queue (CL_API_CALL *
+PFNCLCREATECOMMANDQUEUE)(cl_context                     /* context */,
+                     cl_device_id                   /* device */,
+                     cl_command_queue_properties    /* properties */,
+                     cl_int *                       /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLRETAINCOMMANDQUEUE)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLRELEASECOMMANDQUEUE)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETCOMMANDQUEUEINFO)(cl_command_queue      /* command_queue */,
+                      cl_command_queue_info /* param_name */,
+                      size_t                /* param_value_size */,
+                      void *                /* param_value */,
+                      size_t *              /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLSETCOMMANDQUEUEPROPERTY)(cl_command_queue              /* command_queue */,
+                          cl_command_queue_properties   /* properties */,
+                          cl_bool                        /* enable */,
+                          cl_command_queue_properties * /* old_properties */) CL_API_SUFFIX__VERSION_1_0;
+
+// Memory Object APIs
+typedef CL_API_ENTRY cl_mem (CL_API_CALL *
+PFNCLCREATEBUFFER)(cl_context   /* context */,
+               cl_mem_flags /* flags */,
+               size_t       /* size */,
+               void *       /* host_ptr */,
+               cl_int *     /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_mem (CL_API_CALL *
+PFNCLCREATEIMAGE2D)(cl_context              /* context */,
+                cl_mem_flags            /* flags */,
+                const cl_image_format * /* image_format */,
+                size_t                  /* image_width */,
+                size_t                  /* image_height */,
+                size_t                  /* image_row_pitch */,
+                void *                  /* host_ptr */,
+                cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_mem (CL_API_CALL *
+PFNCLCREATEIMAGE3D)(cl_context              /* context */,
+                cl_mem_flags            /* flags */,
+                const cl_image_format * /* image_format */,
+                size_t                  /* image_width */,
+                size_t                  /* image_height */,
+                size_t                  /* image_depth */,
+                size_t                  /* image_row_pitch */,
+                size_t                  /* image_slice_pitch */,
+                void *                  /* host_ptr */,
+                cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLRETAINMEMOBJECT)(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLRELEASEMEMOBJECT)(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETSUPPORTEDIMAGEFORMATS)(cl_context           /* context */,
+                           cl_mem_flags         /* flags */,
+                           cl_mem_object_type   /* image_type */,
+                           cl_uint              /* num_entries */,
+                           cl_image_format *    /* image_formats */,
+                           cl_uint *            /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETMEMOBJECTINFO)(cl_mem           /* memobj */,
+                   cl_mem_info      /* param_name */,
+                   size_t           /* param_value_size */,
+                   void *           /* param_value */,
+                   size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETIMAGEINFO)(cl_mem           /* image */,
+               cl_image_info    /* param_name */,
+               size_t           /* param_value_size */,
+               void *           /* param_value */,
+               size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+// Sampler APIs
+typedef CL_API_ENTRY cl_sampler (CL_API_CALL *
+PFNCLCREATESAMPLER)(cl_context          /* context */,
+                cl_bool             /* normalized_coords */,
+                cl_addressing_mode  /* addressing_mode */,
+                cl_filter_mode      /* filter_mode */,
+                cl_int *            /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLRETAINSAMPLER)(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLRELEASESAMPLER)(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+PFNCLGETSAMPLERINFO)(cl_sampler         /* sampler */,
+                 cl_sampler_info    /* param_name */,
+                 size_t             /* param_value_size */,
+                 void *             /* param_value */,

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list