mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 04:12:57 +08:00
-Create a structure for adapter specific data -Store an array of adapter data in the execution environment Related-To: NEO-3857 Change-Id: Ia5b52a7bfa53198f0ca5124bcaa0669dd3601faf Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
71 lines
2.3 KiB
C++
71 lines
2.3 KiB
C++
/*
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include "runtime/device/device.h"
|
|
#include "runtime/os_interface/debug_settings_manager.h"
|
|
#include "runtime/os_interface/device_factory.h"
|
|
#include "runtime/os_interface/windows/os_interface.h"
|
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
|
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
|
|
|
|
namespace NEO {
|
|
|
|
extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
|
|
|
|
size_t DeviceFactory::numDevices = 0;
|
|
|
|
bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
|
|
numDevices = 0;
|
|
|
|
auto totalDeviceCount = 1u;
|
|
if (DebugManager.flags.CreateMultipleRootDevices.get()) {
|
|
totalDeviceCount = DebugManager.flags.CreateMultipleRootDevices.get();
|
|
}
|
|
|
|
executionEnvironment.rootDeviceEnvironments = std::make_unique<RootDeviceEnvironment[]>(totalDeviceCount);
|
|
|
|
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
|
|
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
|
if (!wddm->init(*hardwareInfo)) {
|
|
return false;
|
|
}
|
|
|
|
executionEnvironment.memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm.get());
|
|
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
|
executionEnvironment.osInterface->get()->setWddm(wddm.release());
|
|
|
|
numDevices = totalDeviceCount;
|
|
DeviceFactory::numDevices = numDevices;
|
|
|
|
return true;
|
|
}
|
|
|
|
void DeviceFactory::releaseDevices() {
|
|
DeviceFactory::numDevices = 0;
|
|
}
|
|
|
|
void Device::appendOSExtensions(std::string &deviceExtensions) {
|
|
deviceExtensions += "cl_intel_simultaneous_sharing ";
|
|
|
|
simultaneousInterops = {CL_GL_CONTEXT_KHR,
|
|
CL_WGL_HDC_KHR,
|
|
CL_CONTEXT_ADAPTER_D3D9_KHR,
|
|
CL_CONTEXT_D3D9_DEVICE_INTEL,
|
|
CL_CONTEXT_ADAPTER_D3D9EX_KHR,
|
|
CL_CONTEXT_D3D9EX_DEVICE_INTEL,
|
|
CL_CONTEXT_ADAPTER_DXVA_KHR,
|
|
CL_CONTEXT_DXVA_DEVICE_INTEL,
|
|
CL_CONTEXT_D3D10_DEVICE_KHR,
|
|
CL_CONTEXT_D3D11_DEVICE_KHR,
|
|
0};
|
|
}
|
|
} // namespace NEO
|
|
|
|
#endif
|