SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
GraphicsAdapter.h
1#pragma once
2
3#include "spark/render/Export.h"
4
5#include "spark/lib/Uuid.h"
6
7#include <format>
8#include <string>
9
10namespace spark::render
11{
15 enum class GraphicsAdapterType
16 {
18 None = 0x00000000,
19
21 GPU = 0x00000001,
22
24 CPU = 0x00000002,
25
27 Other = 0x7FFFFFFF
28 };
29
36 class SPARK_RENDER_EXPORT IGraphicsAdapter
37 {
38 public:
39 virtual ~IGraphicsAdapter() noexcept = default;
40
45 [[nodiscard]] virtual std::string name() const noexcept = 0;
46
51 [[nodiscard]] virtual lib::Uuid uuid() const noexcept = 0;
52
57 [[nodiscard]] virtual unsigned int vendorId() const noexcept = 0;
58
63 [[nodiscard]] virtual unsigned int deviceId() const noexcept = 0;
64
69 [[nodiscard]] virtual GraphicsAdapterType type() const noexcept = 0;
70
75 [[nodiscard]] virtual unsigned int driverVersion() const noexcept = 0;
76
81 [[nodiscard]] virtual unsigned int apiVersion() const noexcept = 0;
82
87 [[nodiscard]] virtual unsigned long long int dedicatedVideoMemory() const noexcept = 0;
88 };
89};
90
91template <>
92struct std::formatter<spark::render::GraphicsAdapterType>
93{
94 static constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
95
96 static constexpr auto format(const spark::render::GraphicsAdapterType adapter, auto& ctx)
97 {
98 switch (adapter) // NOLINT(clang-diagnostic-switch-enum): Other is handled after the switch statement.
99 {
100 case spark::render::GraphicsAdapterType::None:
101 return std::format_to(ctx.out(), "None");
102 case spark::render::GraphicsAdapterType::GPU:
103 return std::format_to(ctx.out(), "Gpu");
104 case spark::render::GraphicsAdapterType::CPU:
105 return std::format_to(ctx.out(), "Cpu");
106 default:
107 break;
108 }
109 return std::format_to(ctx.out(), "Other");
110 }
111};
Represents a physical graphics adapter.
Definition GraphicsAdapter.h:37
virtual std::string name() const noexcept=0
Gets the name of the graphics adapter.