Topaz 5.0
Topaz Game Engine
Loading...
Searching...
No Matches
hardware.hpp
1#ifndef TZ_GPU_HARDWARE_HPP
2#define TZ_GPU_HARDWARE_HPP
3#include "tz/core/handle.hpp"
4#include "tz/core/error.hpp"
5#include <string>
6#include <span>
7#include <cstddef>
8
9namespace tz::gpu
10{
21 enum class hardware_type
22 {
24 gpu,
28 cpu,
31 };
32
48
54 {
56 ideal,
60 poor,
61 _count
62 };
63
64 using hardware_handle = tz::handle<hardware_type>;
65
72 struct hardware
73 {
75 std::string name;
77 std::uint64_t vram_size_mib;
84
85 struct internals_t
86 {
88 std::uint32_t i1;
89 } internals;
90
91 bool operator==(const hardware& rhs) const
92 {
93 return this->internals.i0 == rhs.internals.i0;
94 }
95
96 bool operator!=(const hardware& rhs) const
97 {
98 return this->internals.i0 != rhs.internals.i0;
99 }
100 };
101
117 error_code iterate_hardware(std::span<hardware> hardwares, std::size_t* hardware_count = nullptr);
146 bool hardware_in_use();
147}
148
149#endif // TZ_GPU_HARDWARE_HPP
Represents a generic opaque handle.
Definition handle.hpp:32
error_code
Error codes for Topaz.
Definition error.hpp:14
hardware get_used_hardware()
Retrieve the hardware that's currently being used.
error_code iterate_hardware(std::span< hardware > hardwares, std::size_t *hardware_count=nullptr)
Retrieve information about all detected rendering hardware currently available on the machine.
hardware_feature_coverage
Describes to what extent the rendering hardware supports all the features that Topaz requires.
Definition hardware.hpp:54
hardware_type
Describes a specific type of rendering hardware.
Definition hardware.hpp:22
hardware_capabilities
Describes what kind of GPU operations a rendering hardware can carry out when used.
Definition hardware.hpp:38
hardware find_best_hardware()
Retrieve the "best" hardware hardware on your machine.
error_code use_hardware(hardware hw)
Select a piece of hardware to use for future graphical operations.
@ insufficient
The hardware does not support all features, and as such could crash.
@ poor
The hardware does not come close to supporting all required features, and as such should not be attem...
@ ideal
The hardware supports everything Topaz needs to do to support all GPU Library features.
@ gpu
A discrete GPU, the most ideal hardware for graphics/compute. Typically seen on desktop PCs.
@ integrated_gpu
An integrated GPU, typically seen on laptops.
@ unknown
Your graphics driver failed to identify the hardware, or Topaz does not support whatever it is....
@ cpu
A CPU. One should expect subpar performance, but there may be reasons to use a CPU.
@ graphics_only
Graphics only. Attempting to carry out compute work on this hardware will fail.
@ compute_only
Compute only. Attempting to carry out graphics work (rasterisation) on this hardware will fail.
@ graphics_compute
Both graphics and compute. These are always preferred.
@ neither
The hardware is useless for Topaz. You should not attempt to create a hardware using this hardware.
Contains some basic information about a particular piece of hardware on the machine that the driver t...
Definition hardware.hpp:73
std::string name
User-facing name of the hardware. In most cases this should be the name of your graphics card....
Definition hardware.hpp:75
hardware_capabilities caps
Describes which sort of GPU operations this hardware is capable of doing.
Definition hardware.hpp:83
hardware_type type
Describes which type of hardware this is (e.g a discrete GPU, or a CPU).
Definition hardware.hpp:79
hardware_feature_coverage features
Describes whether this hardware is suited to Topaz rendering based upon the GPU features it supports.
Definition hardware.hpp:81
std::uint64_t vram_size_mib
Estimated size of the biggest heap, in MiB. If the hardware is not a discrete GPU,...
Definition hardware.hpp:77