pickBestDevice return is ignored
so might as well return the BestDeviceIndex instead of passing it by ref Change-Id: Ic92fa3b5bfe3d319ff9fcb61b7f5404b5a624be5 Reviewed-on: https://gerrit.libreoffice.org/84971 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
c544432c04
commit
ef8674a488
@ -333,11 +333,11 @@ ds_status profileDevices(std::unique_ptr<ds_profile> const & pProfile, std::uniq
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Pick best device */
|
/* Pick best device */
|
||||||
ds_status pickBestDevice(std::unique_ptr<ds_profile> const & profile, int& rBestDeviceIndex)
|
int pickBestDevice(std::unique_ptr<ds_profile> const & profile)
|
||||||
{
|
{
|
||||||
double bestScore = DBL_MAX;
|
double bestScore = DBL_MAX;
|
||||||
|
|
||||||
rBestDeviceIndex = -1;
|
int nBestDeviceIndex = -1;
|
||||||
|
|
||||||
for (std::vector<ds_device>::size_type d = 0; d < profile->devices.size();
|
for (std::vector<ds_device>::size_type d = 0; d < profile->devices.size();
|
||||||
d++)
|
d++)
|
||||||
@ -390,18 +390,18 @@ ds_status pickBestDevice(std::unique_ptr<ds_profile> const & profile, int& rBest
|
|||||||
if (fScore < bestScore)
|
if (fScore < bestScore)
|
||||||
{
|
{
|
||||||
bestScore = fScore;
|
bestScore = fScore;
|
||||||
rBestDeviceIndex = d;
|
nBestDeviceIndex = d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rBestDeviceIndex != -1 && profile->devices[rBestDeviceIndex].eType == DeviceType::OpenCLDevice)
|
if (nBestDeviceIndex != -1 && profile->devices[nBestDeviceIndex].eType == DeviceType::OpenCLDevice)
|
||||||
{
|
{
|
||||||
SAL_INFO("opencl.device", "Selected Device[" << rBestDeviceIndex << "]: " << profile->devices[rBestDeviceIndex].sDeviceName << "(OpenCL).");
|
SAL_INFO("opencl.device", "Selected Device[" << nBestDeviceIndex << "]: " << profile->devices[nBestDeviceIndex].sDeviceName << "(OpenCL).");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SAL_INFO("opencl.device", "Selected Device[" << rBestDeviceIndex << "]: CPU (Native).");
|
SAL_INFO("opencl.device", "Selected Device[" << nBestDeviceIndex << "]: CPU (Native).");
|
||||||
}
|
}
|
||||||
return DS_SUCCESS;
|
return nBestDeviceIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return device ID for matching device name */
|
/* Return device ID for matching device name */
|
||||||
@ -566,8 +566,7 @@ ds_device const & getDeviceSelection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Pick best device */
|
/* Pick best device */
|
||||||
int bestDeviceIdx;
|
int bestDeviceIdx = pickBestDevice(aProfile);
|
||||||
pickBestDevice(aProfile, bestDeviceIdx);
|
|
||||||
|
|
||||||
/* Override if necessary */
|
/* Override if necessary */
|
||||||
char* overrideDeviceStr = getenv("SC_OPENCL_DEVICE_OVERRIDE");
|
char* overrideDeviceStr = getenv("SC_OPENCL_DEVICE_OVERRIDE");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user