Kaydet (Commit) 3bdee649 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Avoid pointless thin wrapper layer

Also works around some warnings from our Clang plug-ins.

Change-Id: Ic9d2bbafefac345b6319300514735143f92dd196
üst 66884ac6
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SC_SOURCE_CORE_INC_FORMULAGROUPCL_HXX
#define INCLUDED_SC_SOURCE_CORE_INC_FORMULAGROUPCL_HXX
#include "formulagroup.hxx"
namespace sc { namespace opencl {
class FormulaGroupInterpreterOpenCL : public FormulaGroupInterpreter
{
public:
FormulaGroupInterpreterOpenCL() :
FormulaGroupInterpreter()
{
}
virtual ~FormulaGroupInterpreterOpenCL()
{
}
virtual ScMatrixRef inverseMatrix( const ScMatrix& rMat ) SAL_OVERRIDE;
virtual CompiledFormula* createCompiledFormula( ScDocument& rDoc,
const ScAddress& rTopPos,
ScFormulaCellGroup& rGroup,
ScTokenArray& rCode ) SAL_OVERRIDE;
virtual bool interpret( ScDocument& rDoc, const ScAddress& rTopPos,
ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode ) SAL_OVERRIDE;
};
}} // namespace sc::opencl
#endif // INCLUDED_SC_SOURCE_CORE_INC_FORMULAGROUPCL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -4,7 +4,7 @@
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file license.txt)
#include "clew.h"
#include "clcc/clew.h"
//! \file clew.c
//! \brief OpenCL run-time loader source
......
......@@ -8,6 +8,7 @@
*/
#include "formulagroup.hxx"
#include "formulagroupcl.hxx"
#include "clkernelthread.hxx"
#include "grouptokenconverter.hxx"
#include "document.hxx"
......@@ -3510,26 +3511,6 @@ const DynamicKernelArgument* SymbolTable::DeclRefArg(
}
}
class FormulaGroupInterpreterOpenCL : public FormulaGroupInterpreter
{
public:
FormulaGroupInterpreterOpenCL() :
FormulaGroupInterpreter()
{
}
virtual ~FormulaGroupInterpreterOpenCL()
{
}
virtual ScMatrixRef inverseMatrix( const ScMatrix& rMat ) SAL_OVERRIDE;
virtual CompiledFormula* createCompiledFormula( ScDocument& rDoc,
const ScAddress& rTopPos,
ScFormulaCellGroup& rGroup,
ScTokenArray& rCode ) SAL_OVERRIDE;
virtual bool interpret( ScDocument& rDoc, const ScAddress& rTopPos,
ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode ) SAL_OVERRIDE;
};
ScMatrixRef FormulaGroupInterpreterOpenCL::inverseMatrix( const ScMatrix& )
{
return NULL;
......@@ -3730,41 +3711,4 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
}} // namespace sc::opencl
extern "C" {
sc::FormulaGroupInterpreter*
createFormulaGroupOpenCLInterpreter()
{
return new sc::opencl::FormulaGroupInterpreterOpenCL();
}
size_t getOpenCLPlatformCount()
{
return sc::opencl::getOpenCLPlatformCount();
}
void fillOpenCLInfo(
sc::OpenCLPlatformInfo* pInfos, size_t nInfoSize )
{
const std::vector<sc::OpenCLPlatformInfo>& rPlatforms =
sc::opencl::fillOpenCLInfo();
size_t n = std::min(rPlatforms.size(), nInfoSize);
for (size_t i = 0; i < n; ++i)
pInfos[i] = rPlatforms[i];
}
bool switchOpenCLDevice(
const OUString* pDeviceId, bool bAutoSelect,
bool bForceEvaluation )
{
return sc::opencl::switchOpenCLDevice(pDeviceId, bAutoSelect, bForceEvaluation);
}
void getOpenCLDeviceInfo( size_t* pDeviceId, size_t* pPlatformId )
{
sc::opencl::getOpenCLDeviceInfo(*pDeviceId, *pPlatformId);
}
} // extern "C"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -10,6 +10,7 @@
#include <config_features.h>
#include "formulagroup.hxx"
#include "formulagroupcl.hxx"
#include "document.hxx"
#include "formulacell.hxx"
#include "tokenarray.hxx"
......@@ -31,11 +32,7 @@
#if HAVE_FEATURE_OPENCL
extern "C" size_t getOpenCLPlatformCount(void);
extern "C" void fillOpenCLInfo(sc::OpenCLPlatformInfo*, size_t);
extern "C" bool switchOpenCLDevice(const OUString*, bool, bool);
extern "C" sc::FormulaGroupInterpreter* createFormulaGroupOpenCLInterpreter();
extern "C" void getOpenCLDeviceInfo(size_t*, size_t*);
#include "openclwrapper.hxx"
#endif
......@@ -543,13 +540,14 @@ void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rP
#if !HAVE_FEATURE_OPENCL
(void) rPlatforms;
#else
size_t nPlatforms = ::getOpenCLPlatformCount();
size_t nPlatforms = sc::opencl::getOpenCLPlatformCount();
if (!nPlatforms)
return;
std::vector<OpenCLPlatformInfo> aPlatforms(nPlatforms);
::fillOpenCLInfo(&aPlatforms[0], aPlatforms.size());
rPlatforms.swap(aPlatforms);
const std::vector<sc::OpenCLPlatformInfo>& rPlatformsFromWrapper =
sc::opencl::fillOpenCLInfo();
rPlatforms.assign(rPlatformsFromWrapper.begin(), rPlatformsFromWrapper.end());
#endif
}
......@@ -571,7 +569,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
return true;
}
#if HAVE_FEATURE_OPENCL
bool bSuccess = ::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation);
bool bSuccess = sc::opencl::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation);
if(!bSuccess)
return false;
#else
......@@ -584,7 +582,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
#if HAVE_FEATURE_OPENCL
if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled )
{
msInstance = ::createFormulaGroupOpenCLInterpreter();
msInstance = new sc::opencl::FormulaGroupInterpreterOpenCL();
return msInstance != NULL;
}
#else
......@@ -606,7 +604,7 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3
size_t aDeviceId = static_cast<size_t>(-1);
size_t aPlatformId = static_cast<size_t>(-1);
::getOpenCLDeviceInfo(&aDeviceId, &aPlatformId);
sc::opencl::getOpenCLDeviceInfo(aDeviceId, aPlatformId);
rDeviceId = aDeviceId;
rPlatformId = aPlatformId;
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment