Check surface support when choosing device

This commit is contained in:
2025-04-12 20:27:30 +10:00
parent 6cbf8df17a
commit 930bba636e
5 changed files with 58 additions and 16 deletions

View File

@@ -9,12 +9,16 @@
#include <nova/api.h>
#include <nova/types.h>
#include <initializer_list>
#include <span>
#include <string>
#include <vector>
namespace Nova {
struct RenderDevice {
static constexpr u32 AUTO = static_cast<u32>(-1);
using SurfaceID = uptr;
class RenderDriver;
struct NOVA_API RenderDevice {
enum class Vendor { UNKNOWN = 0, INTEL = 0x8086, AMD = 0x1002, NVIDIA = 0x10de };
enum class Type { OTHER = 0, INTEGRATED = 1, DISCRETE = 2, VIRTUAL = 3, CPU = 4 };
@@ -24,6 +28,12 @@ namespace Nova {
u32 deviceID;
void* handle;
NOVA_API static u32 choose_device(const std::vector<RenderDevice>& devices);
static u32 choose_device(RenderDriver* driver, std::span<const SurfaceID> surfaces = {});
static u32 choose_device(RenderDriver* driver, std::initializer_list<SurfaceID> surfaces) {
return choose_device(driver, {surfaces.begin(), surfaces.end()});
}
static u32 choose_device(RenderDriver* driver, SurfaceID surface) {
return choose_device(driver, {surface});
}
};
} // namespace Nova