Skip to content

Commit

Permalink
fix - Fixed garbage values!
Browse files Browse the repository at this point in the history
---

We've fixed garbage values from the spdx_query function. Now, we just need to do some minor tweaks before it's ready.

---

Type: fix
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Jul 31, 2024
1 parent fbb3cd2 commit 70101cd
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Binary file modified SpecProbe.Native/runtimes/win-x64/native/libdxhelper.dll
Binary file not shown.
Binary file modified SpecProbe.Native/runtimes/win-x86/native/libdxhelper.dll
Binary file not shown.
14 changes: 7 additions & 7 deletions interop/libdxhelper/libdxhelper/spdx_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern "C" struct
extern "C" __declspec(dllexport) BOOL
spdx_get_gpus
(
spdx_gpu_info**& devices,
spdx_gpu_info*& devices,
UINT& length
)
/*
Expand All @@ -69,7 +69,7 @@ extern "C" __declspec(dllexport) BOOL
*/
{
// Create a list
std::vector<spdx_gpu_info*> devicesList = {};
std::vector<spdx_gpu_info> devicesList = {};

// Create the DXGI factory
IDXGIFactory* factory;
Expand All @@ -95,10 +95,10 @@ extern "C" __declspec(dllexport) BOOL
}

// Install info
spdx_gpu_info* device = new spdx_gpu_info();
device->vendorId = desc.VendorId;
device->deviceId = desc.DeviceId;
wcscpy_s(device->name, desc.Description);
spdx_gpu_info device = spdx_gpu_info();
device.vendorId = desc.VendorId;
device.deviceId = desc.DeviceId;
wcscpy_s(device.name, desc.Description);

// Add this device to the array vector
devicesList.push_back(device);
Expand All @@ -107,7 +107,7 @@ extern "C" __declspec(dllexport) BOOL

// Indicate success
factory->Release();
devices = new spdx_gpu_info * [devicesList.size()];
devices = new spdx_gpu_info[devicesList.size()];
std::copy(std::begin(devicesList), std::end(devicesList), devices);
length = i - 1;
return (i > 0);
Expand Down
2 changes: 1 addition & 1 deletion interop/libdxhelper/libdxhelper/spdx_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct
extern "C" __declspec(dllexport) BOOL
spdx_get_gpus
(
spdx_gpu_info**& devices,
spdx_gpu_info*& devices,
UINT& length
);

Expand Down
10 changes: 5 additions & 5 deletions interop/libdxhelper/libdxhelper/test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
int main()
{
printf("spdx_query test...\n");
spdx_gpu_info** gpus = nullptr;
spdx_gpu_info* gpus = nullptr;
UINT length = 0;
BOOL result = spdx_get_gpus(gpus, length);
if (!result || length == 0)
Expand All @@ -36,10 +36,10 @@ int main()
}
for (int i = 0; i < length; i++)
{
spdx_gpu_info* info = gpus[i];
printf("info->vendorId: %i\n", info->vendorId);
printf("info->deviceId: %i\n", info->deviceId);
printf("info->name: %ws\n", info->name);
spdx_gpu_info info = gpus[i];
printf("info->vendorId: %i\n", info.vendorId);
printf("info->deviceId: %i\n", info.deviceId);
printf("info->name: %ws\n", info.name);
}
}

Expand Down

0 comments on commit 70101cd

Please sign in to comment.