mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-28 15:53:51 +01:00
GPU: clean up GPU index detection code
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FF_GPU_NUM_FORMAT_ARGS 12
|
||||
#define FF_GPU_NUM_FORMAT_ARGS 13
|
||||
|
||||
static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResult* gpu)
|
||||
{
|
||||
@@ -103,6 +103,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
FF_FORMAT_ARG(sUsed, "shared-used"),
|
||||
FF_FORMAT_ARG(gpu->platformApi, "platform-api"),
|
||||
FF_FORMAT_ARG(frequency, "frequency"),
|
||||
FF_FORMAT_ARG(index, "index"),
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -323,13 +324,10 @@ void ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
{
|
||||
yyjson_mut_val* obj = yyjson_mut_arr_add_obj(doc, arr);
|
||||
|
||||
if (gpu->index != FF_GPU_INDEX_UNSET){
|
||||
yyjson_mut_obj_add_uint(doc, obj, "index", (uint64_t)gpu->index);
|
||||
}
|
||||
if (gpu->index != FF_GPU_INDEX_UNSET)
|
||||
yyjson_mut_obj_add_uint(doc, obj, "index", gpu->index);
|
||||
else
|
||||
{
|
||||
yyjson_mut_obj_add_null(doc, obj, "index");
|
||||
}
|
||||
|
||||
if (gpu->coreCount != FF_GPU_CORE_COUNT_UNSET)
|
||||
yyjson_mut_obj_add_int(doc, obj, "coreCount", gpu->coreCount);
|
||||
@@ -411,6 +409,7 @@ void ffPrintGPUHelpFormat(void)
|
||||
"GPU used shared memory - shared-used",
|
||||
"The platform API used when detecting the GPU - platform-api",
|
||||
"Current frequency in GHz - frequency",
|
||||
"GPU vendor specific index - index",
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user