VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
HardwareInfo.hpp
1#pragma once
2#include <array>
3#include <cstdint>
4#include <string>
5
6#ifdef _MSC_VER
7 #include <windows.h>
8 #include <intrin.h>
9#else
10 #include <unistd.h>
11 #include <cpuid.h>
12#endif
13
14namespace vex {
17 bool multiDraw = false;
18 bool indirectDraw = false;
19 bool bindlessTextures = false;
20 bool shaderDrawParameters = false;
21 };
22
25 public:
28 static std::string GetCPUName();
29
32 static std::string GetSystemMemory();
33
36 static bool HasAVX2();
37
42 static void SetGPUInfo(const std::string& name, uint32_t vendorID, uint32_t driverVersion);
43
46 static std::string GetGPUName();
47
50 static std::string GetDriverVersion();
51
55 static void SetVulkanVersions(const std::string& deviceVer, const std::string& requestedVer);
56
59 static std::string GetVulkanDeviceVersion();
60
63 static std::string GetVulkanRequestedVersion();
64
67 static void SetVulkanFeatures(const VulkanFeatures& features);
68
72
75 static void PrintCrashDump(int fd);
76 private:
77 static std::string CPUName;
78 static std::string SystemMemory;
79
80 static std::string GPUName;
81 static std::string DriverVersion;
82 static std::string VulkanDeviceVersion;
83 static std::string VulkanRequestedVersion;
84 static VulkanFeatures GPUFeatures;
85
86 static void CpuId(int info[4], int function_id) {
87 #ifdef _MSC_VER
88 __cpuidex(info, function_id, 0);
89 #else
90 unsigned int eax, ebx, ecx, edx;
91 __cpuid_count(function_id, 0, eax, ebx, ecx, edx);
92 info[0] = static_cast<int>(eax);
93 info[1] = static_cast<int>(ebx);
94 info[2] = static_cast<int>(ecx);
95 info[3] = static_cast<int>(edx);
96 #endif
97 }
98
99 static void DetectCPUName();
100 static void DetectSystemMemory();
101
102 static bool CheckHardwareSupport();
103 };
104}
Utility class for retrieving and storing hardware and driver information.
static std::string GetVulkanDeviceVersion()
Retrieves the Vulkan version supported by the device.
static std::string GetCPUName()
Retrieves the name of the CPU.
static void SetVulkanVersions(const std::string &deviceVer, const std::string &requestedVer)
Sets the Vulkan API versions.
static bool HasAVX2()
Checks if the CPU supports the AVX2 instruction set.
static std::string GetVulkanRequestedVersion()
Retrieves the Vulkan version requested by the engine.
static void SetVulkanFeatures(const VulkanFeatures &features)
Sets the active Vulkan features.
static void SetGPUInfo(const std::string &name, uint32_t vendorID, uint32_t driverVersion)
Sets the stored GPU information.
static void PrintCrashDump(int fd)
Prints hardware information to a crash dump file descriptor.
static VulkanFeatures GetVulkanFeatures()
Retrieves the active Vulkan features.
static std::string GetGPUName()
Retrieves the name of the GPU.
static std::string GetDriverVersion()
Retrieves the GPU driver version.
static std::string GetSystemMemory()
Retrieves the total amount of system memory.
Holds the status of various Vulkan features.
bool indirectDraw
Indicates if indirect draw calls are supported.
bool shaderDrawParameters
Indicates if VK_KHR_shader_draw_parameters is supported.
bool multiDraw
Indicates if VK_EXT_multi_draw is supported.
bool bindlessTextures
Indicates if bindless textures (descriptor indexing) are supported.