mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Simplify platform initialize.
- Remove not required parameters - move the logic to ult directories Change-Id: I913f1048489137a61220d96fa9f2798572cd4f56
This commit is contained in:

committed by
sys_ocldev

parent
6540a9c96b
commit
5c0a562a6b
@ -106,11 +106,9 @@ const std::string &Platform::peekCompilerExtensions() const {
|
||||
return compilerExtensions;
|
||||
}
|
||||
|
||||
bool Platform::initialize(size_t numDevices,
|
||||
const HardwareInfo **devices) {
|
||||
bool Platform::initialize() {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
size_t numDevicesReturned = 0;
|
||||
const HardwareInfo **hwInfoConst = nullptr;
|
||||
|
||||
TakeOwnershipWrapper<Platform> platformOwnership(*this);
|
||||
|
||||
@ -124,15 +122,12 @@ bool Platform::initialize(size_t numDevices,
|
||||
return false;
|
||||
}
|
||||
|
||||
hwInfoConst = (hwInfo != nullptr) ? const_cast<const HardwareInfo **>(&hwInfo) : devices;
|
||||
numDevicesReturned = (hwInfo != nullptr) ? numDevicesReturned : numDevices;
|
||||
|
||||
DEBUG_BREAK_IF(this->platformInfo);
|
||||
this->platformInfo = new PlatformInfo;
|
||||
|
||||
this->devices.resize(numDevicesReturned);
|
||||
for (size_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) {
|
||||
auto pDevice = Device::create<OCLRT::Device>(hwInfoConst[deviceOrdinal]);
|
||||
auto pDevice = Device::create<OCLRT::Device>(&hwInfo[deviceOrdinal]);
|
||||
DEBUG_BREAK_IF(!pDevice);
|
||||
if (pDevice) {
|
||||
this->devices[deviceOrdinal] = pDevice;
|
||||
|
@ -54,8 +54,7 @@ class Platform : public BaseObject<_cl_platform_id> {
|
||||
|
||||
const std::string &peekCompilerExtensions() const;
|
||||
|
||||
bool initialize(size_t numDevices,
|
||||
const HardwareInfo **devices);
|
||||
bool initialize();
|
||||
bool isInitialized();
|
||||
void shutdown();
|
||||
|
||||
|
Reference in New Issue
Block a user