2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-02-22 16:28:27 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/context/context.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
template <typename Sharing>
|
|
|
|
void Context::registerSharing(Sharing *sharing) {
|
2018-07-04 17:38:43 +08:00
|
|
|
UNRECOVERABLE_IF(!sharing);
|
2017-12-21 07:45:38 +08:00
|
|
|
this->sharingFunctions[Sharing::sharingId].reset(sharing);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename Sharing>
|
|
|
|
Sharing *Context::getSharing() {
|
2018-04-11 23:30:33 +08:00
|
|
|
if (Sharing::sharingId >= sharingFunctions.size()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
return reinterpret_cast<Sharing *>(sharingFunctions[Sharing::sharingId].get());
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|