TachyonUI
1.1.0
High-performance UI for building tools.
Toggle main menu visibility
Loading...
Searching...
No Matches
gui_graphics_api.h
Go to the documentation of this file.
1
#pragma once
2
3
// The graphics APIs a backend can render with, and what a backend hands an app that draws a
4
// scene (GraphicsContext::RenderScene). Light, for headers that only name them.
5
6
#include <cstdint>
7
#include <string_view>
8
9
namespace
tachyon
10
{
13
enum class
GraphicsAPI
: uint8_t
14
{
15
None
,
16
Vulkan
,
17
D3D12
,
18
SDLGPU
,
19
Metal
,
20
};
21
24
constexpr
std::string_view
GraphicsAPIName
(
GraphicsAPI
api)
25
{
26
switch
(api)
27
{
28
case
GraphicsAPI::Vulkan
:
return
"Vulkan"
;
29
case
GraphicsAPI::D3D12
:
return
"Direct3D 12"
;
30
case
GraphicsAPI::SDLGPU
:
return
"SDL GPU"
;
31
case
GraphicsAPI::Metal
:
return
"Metal"
;
32
default
:
return
"No GPU"
;
33
}
34
}
35
40
class
ScenePayload
41
{
42
public
:
43
ScenePayload
() =
default
;
44
template
<
class
T>
45
explicit
ScenePayload
(
const
T& state) : m_api(T::kAPI), m_state(&state) {}
46
47
GraphicsAPI
API
()
const
{
return
m_api; }
48
49
template
<
class
T>
50
const
T*
As
()
const
{
return
m_api == T::kAPI ?
static_cast<
const
T*
>
(m_state) :
nullptr
; }
51
52
private
:
53
GraphicsAPI
m_api =
GraphicsAPI::None
;
54
const
void
* m_state =
nullptr
;
55
};
56
}
tachyon::ScenePayload::ScenePayload
ScenePayload(const T &state)
Definition
gui_graphics_api.h:45
tachyon::ScenePayload::API
GraphicsAPI API() const
Definition
gui_graphics_api.h:47
tachyon::ScenePayload::ScenePayload
ScenePayload()=default
tachyon::ScenePayload::As
const T * As() const
Definition
gui_graphics_api.h:50
tachyon::ElementFlags::None
@ None
Definition
gui_element_flags.h:18
tachyon
Definition
gui_logging.h:24
tachyon::GraphicsAPI
GraphicsAPI
The graphics API a backend presents with; window backends create their windows to match (SDL: SDL_WIN...
Definition
gui_graphics_api.h:14
tachyon::GraphicsAPI::Vulkan
@ Vulkan
Definition
gui_graphics_api.h:16
tachyon::GraphicsAPI::None
@ None
nothing is presented (NullGraphicsContext)
Definition
gui_graphics_api.h:15
tachyon::GraphicsAPI::SDLGPU
@ SDLGPU
SDL3's GPU API, over Vulkan, Direct3D 12 or Metal as SDL picks.
Definition
gui_graphics_api.h:18
tachyon::GraphicsAPI::Metal
@ Metal
Metal, on macOS.
Definition
gui_graphics_api.h:19
tachyon::GraphicsAPI::D3D12
@ D3D12
Direct3D 12, on Windows.
Definition
gui_graphics_api.h:17
tachyon::GraphicsAPIName
constexpr std::string_view GraphicsAPIName(GraphicsAPI api)
The API's name as shown to people: "Vulkan", "Direct3D 12", "SDL GPU", "Metal", or "NoGPU" for None.
Definition
gui_graphics_api.h:24
gui_core
graphics
gui_graphics_api.h
Generated by
1.18.0