mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +01:00
Vulkan: print instance version if no vulkan drivers found
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/thread.h"
|
||||
#include "detection/gpu/gpu.h"
|
||||
#include "detection/vulkan/vulkan.h"
|
||||
|
||||
@@ -8,7 +7,7 @@
|
||||
#include "common/io/io.h"
|
||||
#include "common/parsing.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
@@ -211,14 +210,8 @@ static const char* detectVulkan(FFVulkanResult* result)
|
||||
continue;
|
||||
}
|
||||
|
||||
//If the highest device version is lower than the instance version, use it as our vulkan version
|
||||
//otherwise the instance version is the vulkan version
|
||||
if(ffVersionCompare(&instanceVersion, &maxDeviceApiVersion) > 0)
|
||||
ffVersionToPretty(&maxDeviceApiVersion, &result->apiVersion);
|
||||
else
|
||||
ffVersionToPretty(&instanceVersion, &result->apiVersion);
|
||||
|
||||
//Use the highest device conformace version as our conformance version
|
||||
ffVersionToPretty(&instanceVersion, &result->instanceVersion);
|
||||
ffVersionToPretty(&maxDeviceApiVersion, &result->apiVersion);
|
||||
ffVersionToPretty(&maxDeviceConformanceVersion, &result->conformanceVersion);
|
||||
|
||||
ffvkDestroyInstance(vkInstance, NULL);
|
||||
@@ -236,6 +229,7 @@ FFVulkanResult* ffDetectVulkan(void)
|
||||
ffStrbufInit(&result.driver);
|
||||
ffStrbufInit(&result.apiVersion);
|
||||
ffStrbufInit(&result.conformanceVersion);
|
||||
ffStrbufInit(&result.instanceVersion);
|
||||
ffListInit(&result.gpus, sizeof(FFGPUResult));
|
||||
|
||||
#ifdef FF_HAVE_VULKAN
|
||||
|
||||
@@ -7,6 +7,7 @@ typedef struct FFVulkanResult
|
||||
FFstrbuf driver;
|
||||
FFstrbuf apiVersion;
|
||||
FFstrbuf conformanceVersion;
|
||||
FFstrbuf instanceVersion;
|
||||
FFlist gpus; //List of FFGPUResult, see detection/gpu/gpu.h
|
||||
const char* error;
|
||||
} FFVulkanResult;
|
||||
|
||||
@@ -17,16 +17,17 @@ void ffPrintVulkan(FFVulkanOptions* options)
|
||||
return;
|
||||
}
|
||||
|
||||
if (vulkan->apiVersion.length == 0 && vulkan->driver.length == 0)
|
||||
{
|
||||
ffPrintError(FF_VULKAN_MODULE_NAME, 0, &options->moduleArgs, "No Vulkan drivers found");
|
||||
return;
|
||||
}
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(FF_VULKAN_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
|
||||
if (vulkan->apiVersion.length == 0 && vulkan->driver.length == 0)
|
||||
{
|
||||
ffStrbufWriteTo(&vulkan->instanceVersion, stdout);
|
||||
puts(" [Software only]");
|
||||
return;
|
||||
}
|
||||
|
||||
if(vulkan->apiVersion.length > 0)
|
||||
{
|
||||
ffStrbufWriteTo(&vulkan->apiVersion, stdout);
|
||||
@@ -145,7 +146,8 @@ void ffPrintVulkanHelpFormat(void)
|
||||
ffPrintModuleFormatHelp(FF_VULKAN_MODULE_NAME, "{2} - {1}", FF_VULKAN_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Driver name",
|
||||
"API version",
|
||||
"Conformance version"
|
||||
"Conformance version",
|
||||
"Instance version",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user