Files
fastfetch/src/modules/opencl.c
T

40 lines
1.2 KiB
C
Raw Normal View History

2022-06-05 00:18:40 +02:00
#include "fastfetch.h"
#include "common/printing.h"
2023-04-25 19:03:20 +08:00
#include "detection/opencl/opencl.h"
2022-06-05 00:18:40 +02:00
#define FF_OPENCL_MODULE_NAME "OpenCL"
#define FF_OPENCL_NUM_FORMAT_ARGS 3
2023-04-25 19:03:20 +08:00
void ffPrintOpenCL(FFinstance* instance)
2022-06-05 00:18:40 +02:00
{
2023-04-25 19:03:20 +08:00
FFOpenCLResult opencl;
ffStrbufInit(&opencl.version);
ffStrbufInit(&opencl.device);
ffStrbufInit(&opencl.vendor);
2022-06-05 00:18:40 +02:00
2023-04-25 19:03:20 +08:00
const char* error = ffDetectOpenCL(instance, &opencl);
2022-08-28 17:39:01 +02:00
2023-04-25 19:03:20 +08:00
if(error != NULL)
ffPrintError(instance, FF_OPENCL_MODULE_NAME, 0, &instance->config.openCL, "%s", error);
2022-06-05 00:18:40 +02:00
else
{
2023-04-25 19:03:20 +08:00
if(instance->config.openCL.outputFormat.length == 0)
{
ffPrintLogoAndKey(instance, FF_OPENCL_MODULE_NAME, 0, &instance->config.openCL.key);
ffStrbufPutTo(&opencl.version, stdout);
}
else
{
ffPrintFormat(instance, FF_OPENCL_MODULE_NAME, 0, &instance->config.openCL, FF_OPENCL_NUM_FORMAT_ARGS, (FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &opencl.version},
{FF_FORMAT_ARG_TYPE_STRBUF, &opencl.device},
{FF_FORMAT_ARG_TYPE_STRBUF, &opencl.vendor},
});
}
2022-06-05 00:18:40 +02:00
}
2023-04-25 19:03:20 +08:00
ffStrbufDestroy(&opencl.version);
ffStrbufDestroy(&opencl.device);
ffStrbufDestroy(&opencl.vendor);
2022-06-05 00:18:40 +02:00
}