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

104 lines
3.2 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-05-19 17:52:27 -03:00
uptr<DisplayModeCollection> SupportedDisplayModes() const;
2024-06-23 23:14:06 -03:00
//Returns a collection of supported display modes for the current adapter.
2024-05-19 17:52:27 -03:00
uptr<DisplayModeCollection> SupportedDisplayModes(SurfaceFormat surfaceFormat) const;
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; }
//Tests to see if the adapter supports the requested profile.
bool IsProfileSupported(GraphicsProfile graphicsProfile) {
return false;
}
//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
) {
return false;
}
//Queries the adapter for support for the requested render target format.
bool QueryRenderTargetFormat(
GraphicsProfile graphicsProfile,
SurfaceFormat format,
DepthFormat depthFormat,
Int multiSampleCount,
SurfaceFormat& selectedFormat,
DepthFormat& selectedDepthFormat,
int& selectedMultiSampleCount
) {
return false;
}
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-05-19 17:52:27 -03:00
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