Skip to content

Conversation

@aquadran
Copy link
Contributor

feat(nvapi): implement NvAPI_EnumPhysicalGPUs, NvAPI_EnumLogicalGPUs, NvAPI_GetPhysicalGPUsFromDisplay

Comment on lines 269 to 277
auto devices = WMT::CopyAllDevices();
auto adapter_count = devices.count();
if (adapter_count > 0) {
*pGpuCount = adapter_count;
for (unsigned i = 0; i < adapter_count; i++) {
nvGPUHandle[i] = (NvPhysicalGpuHandle)devices.object(i).registryID();
}
} else {
return NVAPI_NVIDIA_DEVICE_NOT_FOUND;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: short-circuit first for better readability

if (adapter_count == 0)
    return NVAPI_NVIDIA_DEVICE_NOT_FOUND;

*pGpuCount = adapter_count;
for (unsigned i = 0; i < adapter_count; i++) {
  nvGPUHandle[i] = (NvPhysicalGpuHandle)devices.object(i).registryID();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants