Skip to content

Commit

Permalink
nvapi-gpu: Do not loose struct version
Browse files Browse the repository at this point in the history
  • Loading branch information
jp7677 committed Aug 25, 2024
1 parent 656fd60 commit ab85625
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/nvapi_gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ extern "C" {
return InsufficientBuffer(n);
}

switch (pDisplayIds->version) {
auto version = pDisplayIds->version;
switch (version) {
case NV_GPU_DISPLAYIDS_VER1: // Both versions use the same NV_GPU_DISPLAYIDS struct
case NV_GPU_DISPLAYIDS_VER2: {
*pDisplayIds = {};
pDisplayIds->version = version;
for (auto i = 0U; i < count; i++) {
auto output = nvapiAdapterRegistry->GetOutput(adapter, i);
pDisplayIds[i].displayId = output->GetId();
Expand Down Expand Up @@ -693,10 +695,12 @@ extern "C" {
case NV_GPU_INFO_VER1: {
auto pGpuInfoV1 = reinterpret_cast<NV_GPU_INFO_V1*>(pGpuInfo);
*pGpuInfoV1 = {};
pGpuInfoV1->version = NV_GPU_INFO_VER1;
break;
}
case NV_GPU_INFO_VER2:
*pGpuInfo = {};
pGpuInfo->version = NV_GPU_INFO_VER2;
if (architectureId >= NV_GPU_ARCHITECTURE_TU100) {
// Values are taken from RTX4080
pGpuInfo->rayTracingCores = 76;
Expand Down

0 comments on commit ab85625

Please sign in to comment.