mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
Improve clGetDeviceIDs
Change-Id: If7df41e0c2bae5c615f6fea286baf5d7e740cfc7 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
904c158377
commit
a7d66b0365
@@ -177,8 +177,8 @@ cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform,
|
||||
break;
|
||||
}
|
||||
|
||||
Device **allDevs = pPlatform->getDevices();
|
||||
DEBUG_BREAK_IF(allDevs == nullptr);
|
||||
Device *device = pPlatform->getDevice(0);
|
||||
DEBUG_BREAK_IF(device == nullptr);
|
||||
|
||||
if (deviceType == CL_DEVICE_TYPE_ALL) {
|
||||
/* According to Spec, set it to all except TYPE_CUSTOM. */
|
||||
@@ -190,18 +190,12 @@ cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform,
|
||||
}
|
||||
|
||||
cl_uint retNum = 0;
|
||||
for (cl_uint i = 0; i < numDev; i++) {
|
||||
if (deviceType & allDevs[i]->getDeviceInfo().deviceType) {
|
||||
if (devices) {
|
||||
devices[retNum] = allDevs[i];
|
||||
}
|
||||
|
||||
retNum++;
|
||||
if (numEntries > 0 && retNum >= numEntries) {
|
||||
/* find enough, get out. */
|
||||
break;
|
||||
}
|
||||
if (deviceType & device->getDeviceInfo().deviceType) {
|
||||
if (devices) {
|
||||
devices[retNum] = device;
|
||||
}
|
||||
retNum++;
|
||||
}
|
||||
|
||||
if (DebugManager.flags.LimitAmountOfReturnedDevices.get()) {
|
||||
|
||||
Reference in New Issue
Block a user