From c7bf471e295b96efba22ade01c784311e551139e Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Tue, 26 Jul 2022 18:18:14 +0200 Subject: [PATCH] Refactor: move vulkan detection to own header --- src/detection/vulkan.c | 1 + src/detection/vulkan.h | 26 ++++++++++++++++++++++++++ src/fastfetch.h | 23 ----------------------- src/modules/gpu.c | 1 + src/modules/vulkan.c | 1 + 5 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 src/detection/vulkan.h diff --git a/src/detection/vulkan.c b/src/detection/vulkan.c index 7918103d8..1c61ee30b 100644 --- a/src/detection/vulkan.c +++ b/src/detection/vulkan.c @@ -1,4 +1,5 @@ #include "fastfetch.h" +#include "detection/vulkan.h" #include diff --git a/src/detection/vulkan.h b/src/detection/vulkan.h new file mode 100644 index 000000000..e4a9a4889 --- /dev/null +++ b/src/detection/vulkan.h @@ -0,0 +1,26 @@ +#pragma once + +#ifndef FF_INCLUDED_detection_vulkan +#define FF_INCLUDED_detection_vulkan + +#include "fastfetch.h" + +typedef struct FFGPUResult +{ + FFstrbuf vendor; + FFstrbuf name; + FFstrbuf driver; + double temperature; +} FFGPUResult; + +typedef struct FFVulkanResult +{ + FFstrbuf driver; + FFstrbuf apiVersion; + FFstrbuf conformanceVersion; + FFlist devices; //List of FFGPUResult +} FFVulkanResult; + +const FFVulkanResult* ffDetectVulkan(const FFinstance* instance); + +#endif diff --git a/src/fastfetch.h b/src/fastfetch.h index 1e5b007c0..6fd8db956 100644 --- a/src/fastfetch.h +++ b/src/fastfetch.h @@ -173,22 +173,6 @@ typedef struct FFinstance FFstate state; } FFinstance; -typedef struct FFGPUResult -{ - FFstrbuf vendor; - FFstrbuf name; - FFstrbuf driver; - double temperature; -} FFGPUResult; - -typedef struct FFVulkanResult -{ - FFstrbuf driver; - FFstrbuf apiVersion; - FFstrbuf conformanceVersion; - FFlist devices; //List of FFGPUResult -} FFVulkanResult; - ////////////////////// // Init functions // ////////////////////// @@ -212,13 +196,6 @@ void ffLogoBuiltinPrint(FFinstance* instance); void ffLogoBuiltinList(); void ffLogoBuiltinListAutocompletion(); -///////////////////////// -// Detection functions // -///////////////////////// - -//detection/vulkan.c -const FFVulkanResult* ffDetectVulkan(const FFinstance* instance); - ////////////////////// // Module functions // ////////////////////// diff --git a/src/modules/gpu.c b/src/modules/gpu.c index cf134b89e..016e5e418 100644 --- a/src/modules/gpu.c +++ b/src/modules/gpu.c @@ -3,6 +3,7 @@ #include "common/caching.h" #include "common/parsing.h" #include "detection/temps.h" +#include "detection/vulkan.h" #include diff --git a/src/modules/vulkan.c b/src/modules/vulkan.c index c116c1bc6..b73c7fd58 100644 --- a/src/modules/vulkan.c +++ b/src/modules/vulkan.c @@ -1,5 +1,6 @@ #include "fastfetch.h" #include "common/printing.h" +#include "detection/vulkan.h" #define FF_VULKAN_MODULE_NAME "Vulkan" #define FF_VULKAN_NUM_FORMAT_ARGS 3