Add get_api_name() and get_api_version_string()
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
#include <nova/render/render_device.h>
|
#include <nova/render/render_device.h>
|
||||||
#include <nova/types.h>
|
#include <nova/types.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace Nova {
|
namespace Nova {
|
||||||
class NOVA_API RenderDriver {
|
class NOVA_API RenderDriver {
|
||||||
public:
|
public:
|
||||||
@@ -18,6 +20,8 @@ namespace Nova {
|
|||||||
|
|
||||||
[[nodiscard]] virtual RenderAPI get_api() const = 0;
|
[[nodiscard]] virtual RenderAPI get_api() const = 0;
|
||||||
[[nodiscard]] virtual u32 get_api_version() const = 0;
|
[[nodiscard]] virtual u32 get_api_version() const = 0;
|
||||||
|
[[nodiscard]] virtual std::string get_api_name() const = 0;
|
||||||
|
[[nodiscard]] virtual std::string get_api_version_string() const = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual u32 get_device_count() const = 0;
|
[[nodiscard]] virtual u32 get_device_count() const = 0;
|
||||||
[[nodiscard]] virtual const RenderDevice& get_device(u32 index) const = 0;
|
[[nodiscard]] virtual const RenderDevice& get_device(u32 index) const = 0;
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
#include <nova/version.h>
|
#include <nova/version.h>
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
|
#include <format>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
|
||||||
|
|
||||||
#define VALIDATION_LAYER "VK_LAYER_KHRONOS_validation"
|
#define VALIDATION_LAYER "VK_LAYER_KHRONOS_validation"
|
||||||
|
|
||||||
@@ -48,6 +48,21 @@ u32 VulkanRenderDriver::get_api_version() const {
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string VulkanRenderDriver::get_api_name() const {
|
||||||
|
return "Vulkan";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string VulkanRenderDriver::get_api_version_string() const {
|
||||||
|
const u32 version = get_api_version();
|
||||||
|
return std::format(
|
||||||
|
"{}.{}.{}-{}",
|
||||||
|
VK_API_VERSION_MAJOR(version),
|
||||||
|
VK_API_VERSION_MINOR(version),
|
||||||
|
VK_API_VERSION_PATCH(version),
|
||||||
|
VK_API_VERSION_VARIANT(version)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
u32 VulkanRenderDriver::get_device_count() const {
|
u32 VulkanRenderDriver::get_device_count() const {
|
||||||
return m_devices.size();
|
return m_devices.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace Nova {
|
|||||||
|
|
||||||
[[nodiscard]] RenderAPI get_api() const override;
|
[[nodiscard]] RenderAPI get_api() const override;
|
||||||
[[nodiscard]] u32 get_api_version() const override;
|
[[nodiscard]] u32 get_api_version() const override;
|
||||||
|
[[nodiscard]] std::string get_api_name() const override;
|
||||||
|
[[nodiscard]] std::string get_api_version_string() const override;
|
||||||
|
|
||||||
[[nodiscard]] u32 get_device_count() const override;
|
[[nodiscard]] u32 get_device_count() const override;
|
||||||
[[nodiscard]] const RenderDevice& get_device(u32 index) const override;
|
[[nodiscard]] const RenderDevice& get_device(u32 index) const override;
|
||||||
|
|||||||
Reference in New Issue
Block a user