MCPcopy Create free account
hub / github.com/3Shain/dxmt / NvAPI_GPU_GetLogicalGpuInfo

Function NvAPI_GPU_GetLogicalGpuInfo

src/nvapi/nvapi.cpp:763–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763NVAPI_INTERFACE
764NvAPI_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
798extern "C" __cdecl void *nvapi_QueryInterface(NvU32 id) {
799 switch (id) {

Callers

nothing calls this directly

Calls 5

CopyAllDevicesFunction · 0.85
countMethod · 0.80
registryIDMethod · 0.80
objectMethod · 0.80
GetAdapterLuidFunction · 0.70

Tested by

no test coverage detected