| 761 | } |
| 762 | |
| 763 | NVAPI_INTERFACE |
| 764 | NvAPI_GPU_GetLogicalGpuInfo(NvLogicalGpuHandle hLogicalGpu, NV_LOGICAL_GPU_DATA *pLogicalGpuData) { |
| 765 | if (!pLogicalGpuData) |
| 766 | return NVAPI_INVALID_ARGUMENT; |
| 767 | |
| 768 | auto registry_id = uint64_t(hLogicalGpu); |
| 769 | auto devices = WMT::CopyAllDevices(); |
| 770 | auto adapter_count = devices.count(); |
| 771 | if (adapter_count == 0) |
| 772 | return NVAPI_NVIDIA_DEVICE_NOT_FOUND; |
| 773 | |
| 774 | WMT::Device target_device{}; |
| 775 | for (unsigned i = 0; i < adapter_count; i++) { |
| 776 | if (registry_id == devices.object(i).registryID()) { |
| 777 | target_device = devices.object(i); |
| 778 | break; |
| 779 | } |
| 780 | } |
| 781 | if (!target_device) |
| 782 | return NVAPI_NVIDIA_DEVICE_NOT_FOUND; |
| 783 | |
| 784 | switch (pLogicalGpuData->version) { |
| 785 | case NV_LOGICAL_GPU_DATA_VER1: |
| 786 | pLogicalGpuData->physicalGpuCount = 1; |
| 787 | memset(pLogicalGpuData->physicalGpuHandles, 0, sizeof(pLogicalGpuData->physicalGpuHandles)); |
| 788 | pLogicalGpuData->physicalGpuHandles[0] = (NvPhysicalGpuHandle)registry_id; |
| 789 | *reinterpret_cast<LUID *>(pLogicalGpuData->pOSAdapterId) = GetAdapterLuid(target_device); |
| 790 | break; |
| 791 | default: |
| 792 | return NVAPI_INCOMPATIBLE_STRUCT_VERSION; |
| 793 | } |
| 794 | |
| 795 | return NVAPI_OK; |
| 796 | } |
| 797 | |
| 798 | extern "C" __cdecl void *nvapi_QueryInterface(NvU32 id) { |
| 799 | switch (id) { |
nothing calls this directly
no test coverage detected