Device now adds dependencies on ExecutionEnvironment

- This allows for ExecutionEnvironment to live longer then platform after
its global destruction
- Device adds references to ExecutionEnvironment after creation
- When device is destroyed it removes the dependency causing the cleanup
- Platform upon destruction no longer destroys the device, but decrements
the internal ref count.

Change-Id: I22593ea44b2b50e3416575a9e97e3ce0a1f8b5c0
This commit is contained in:
Mrozek, Michal
2018-06-27 11:35:37 +02:00
committed by sys_ocldev
parent bc7aa63a37
commit a95cca71e4
6 changed files with 50 additions and 4 deletions

View File

@ -161,6 +161,7 @@ bool Platform::initialize() {
}
compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(pDevice->getDeviceInfo().deviceExtensions);
pDevice->connectToExecutionEnvironment(this->executionEnvironment);
} else {
return false;
}
@ -191,7 +192,9 @@ void Platform::shutdown() {
}
for (auto dev : this->devices) {
delete dev;
if (dev) {
dev->decRefInternal();
}
}
devices.clear();
state = StateNone;
@ -199,7 +202,6 @@ void Platform::shutdown() {
delete platformInfo;
platformInfo = nullptr;
DeviceFactory::releaseDevices();
std::string().swap(compilerExtensions);
gtpinNotifyPlatformShutdown();