1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/includes/xna/graphics/adapter.hpp

101 lines
3.3 KiB
C++
Raw Normal View History

2024-03-18 15:41:46 -03:00
#ifndef XNA_GRAPHICS_ADAPTER_HPP
#define XNA_GRAPHICS_ADAPTER_HPP
2024-04-24 11:44:41 -03:00
#include "../default.hpp"
2024-07-19 22:11:57 -03:00
#include "displaymode.hpp"
2024-03-18 15:41:46 -03:00
namespace xna {
2024-06-22 22:05:35 -03:00
//Provides methods to retrieve and manipulate graphics adapters.
2024-05-19 17:52:27 -03:00
class GraphicsAdapter {
2024-03-18 15:41:46 -03:00
public:
2024-07-19 22:11:57 -03:00
//Collection of available adapters on the system.
static void Adapters(std::vector<uptr<GraphicsAdapter>>& adapters);
//Gets the current display mode.
2024-07-20 19:08:40 -03:00
inline sptr<DisplayMode> CurrentDisplayMode() const { return currentDisplayMode; }
2024-07-19 22:11:57 -03:00
//Gets the default adapter.
static uptr<GraphicsAdapter> DefaultAdapter();
2024-06-22 22:05:35 -03:00
//Retrieves a string used for presentation to the user.
2024-07-19 22:11:57 -03:00
constexpr String Description() const { return description; }
2024-06-22 22:05:35 -03:00
//Retrieves a value that is used to help identify a particular chip set.
2024-07-19 22:11:57 -03:00
constexpr Uint DeviceId() const { return deviceId; }
2024-06-22 22:05:35 -03:00
//Retrieves a string that contains the device name.
2024-07-19 22:11:57 -03:00
constexpr String DeviceName() const { return deviceName; }
2024-06-22 22:05:35 -03:00
//Determines if this instance of GraphicsAdapter is the default adapter.
2024-07-19 22:11:57 -03:00
constexpr bool IsDefaultAdapter() const { return isDefault; }
//Determines if the graphics adapter is in widescreen mode.
2024-07-20 19:08:40 -03:00
inline bool IsWideScreen() const {
return currentDisplayMode->AspectRatio() > 1.6000000238418579;
}
2024-07-19 22:11:57 -03:00
2024-06-22 22:05:35 -03:00
//Retrieves the handle of the monitor
2024-07-19 22:11:57 -03:00
constexpr intptr_t MonitorHandle() const { return monitorHandle; }
2024-06-22 22:05:35 -03:00
//Retrieves a value used to help identify the revision level of a particular chip set.
2024-07-19 22:11:57 -03:00
constexpr Uint Revision() const { return revision; }
2024-06-22 22:05:35 -03:00
//Retrieves a value used to identify the subsystem.
2024-07-19 22:11:57 -03:00
constexpr Uint SubSystemId() const { return subSystemId; }
2024-06-23 23:14:06 -03:00
//Returns a collection of supported display modes for the current adapter.
2024-07-20 22:20:18 -03:00
inline sptr<DisplayModeCollection> SupportedDisplayModes() const { return supportedDisplayModes; }
2024-04-21 16:06:22 -03:00
2024-07-19 22:11:57 -03:00
//Retrieves a value used to identify the manufacturer.
constexpr Uint VendorId() const { return vendorId; }
2024-07-20 23:44:10 -03:00
//Gets or sets a NULL device.
static bool UseNullDevice() { return useNullDevice; }
//Gets or sets a NULL device.
static void UseNullDevice(bool value) { useNullDevice = value; }
//Gets or sets a reference device.
constexpr static bool UseReferenceDevice() { return useReferenceDevice; }
//Gets or sets a reference device.
constexpr static void UseReferenceDevice(bool value) { useReferenceDevice = value; }
2024-07-19 22:11:57 -03:00
//Tests to see if the adapter supports the requested profile.
bool IsProfileSupported(GraphicsProfile graphicsProfile) {
2024-07-20 23:44:10 -03:00
return true;
}
2024-07-19 22:11:57 -03:00
//Queries the adapter for support for the requested back buffer format.
bool QueryBackBufferFormat(
GraphicsProfile graphicsProfile,
SurfaceFormat format,
DepthFormat depthFormat,
Int multiSampleCount,
SurfaceFormat& selectedFormat,
DepthFormat& selectedDepthFormat,
Int& selectedMultiSampleCount
2024-07-21 20:37:16 -03:00
) const;
2024-07-19 22:11:57 -03:00
private:
String description;
Uint deviceId{0};
String deviceName;
bool isDefault{ false };
intptr_t monitorHandle{ 0 };
Uint revision{ 0 };
Uint subSystemId{ 0 };
Uint vendorId{ 0 };
sptr<DisplayMode> currentDisplayMode{ nullptr };
2024-07-20 22:20:18 -03:00
sptr<DisplayModeCollection> supportedDisplayModes{ nullptr };
2024-05-19 17:52:27 -03:00
2024-07-20 23:44:10 -03:00
inline static bool useNullDevice = false;
inline static bool useReferenceDevice = false;
2024-07-20 19:08:40 -03:00
GraphicsAdapter();
2024-05-19 17:52:27 -03:00
public:
struct PlatformImplementation;
uptr<PlatformImplementation> impl = nullptr;
2024-03-18 15:41:46 -03:00
};
}
#endif