mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Corrige IGraphicsAdapter
This commit is contained in:
parent
689ef1f199
commit
1e96338617
@ -9,47 +9,17 @@
|
||||
namespace xna {
|
||||
class IGraphicsAdapter {
|
||||
public:
|
||||
virtual ~IGraphicsAdapter() {
|
||||
}
|
||||
|
||||
static PGraphicsAdapter DefaultAdapter() {
|
||||
if (_adaptersList.empty())
|
||||
return nullptr;
|
||||
|
||||
if (_defaultAdapterIndex >= _adaptersList.size())
|
||||
return nullptr;
|
||||
|
||||
return _adaptersList[_defaultAdapterIndex];
|
||||
}
|
||||
|
||||
static constexpr void DefaultAdapter(size_t index) {
|
||||
_defaultAdapterIndex = index;
|
||||
}
|
||||
|
||||
static constexpr std::vector<PGraphicsAdapter> Adapters() {
|
||||
return _adaptersList;
|
||||
}
|
||||
virtual ~IGraphicsAdapter() {}
|
||||
|
||||
virtual String Description() const = 0;
|
||||
virtual Uint DeviceId() const = 0;
|
||||
virtual String DeviceName() const = 0;
|
||||
|
||||
constexpr bool IsDefaultAdapter() const {
|
||||
return _index == _defaultAdapterIndex;
|
||||
}
|
||||
|
||||
virtual bool IsDefaultAdapter() const = 0;
|
||||
virtual intptr_t MonitorHandle() const = 0;
|
||||
virtual Uint Revision() const = 0;
|
||||
virtual Uint SubSystemId() const = 0;
|
||||
virtual Uint VendorId() const = 0;
|
||||
|
||||
virtual PDisplayModeCollection SupportedDisplayModes() const = 0;
|
||||
|
||||
protected:
|
||||
Uint _index{ 0 };
|
||||
inline static size_t _defaultAdapterIndex = 0;
|
||||
static std::vector<PGraphicsAdapter> getAllAdapters();
|
||||
inline static std::vector<PGraphicsAdapter> _adaptersList = getAllAdapters();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,16 @@
|
||||
|
||||
namespace xna {
|
||||
|
||||
PGraphicsAdapter GraphicsAdapter::DefaultAdapter() {
|
||||
if (_adaptersList.empty())
|
||||
return nullptr;
|
||||
|
||||
if (_defaultAdapterIndex >= _adaptersList.size())
|
||||
return nullptr;
|
||||
|
||||
return _adaptersList[_defaultAdapterIndex];
|
||||
}
|
||||
|
||||
String GraphicsAdapter::Description() const {
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
_adapter->GetDesc1(&desc);
|
||||
@ -112,7 +122,7 @@ namespace xna {
|
||||
return New<DisplayModeCollection>();
|
||||
}
|
||||
|
||||
std::vector<PGraphicsAdapter> IGraphicsAdapter::getAllAdapters() {
|
||||
std::vector<PGraphicsAdapter> GraphicsAdapter::getAllAdapters() {
|
||||
IDXGIFactory1* pFactory = nullptr;
|
||||
|
||||
if FAILED(CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&pFactory)) {
|
||||
|
@ -24,11 +24,28 @@ namespace xna {
|
||||
virtual Uint Revision() const override;
|
||||
virtual Uint SubSystemId() const override;
|
||||
virtual Uint VendorId() const override;
|
||||
virtual PDisplayModeCollection SupportedDisplayModes() const override;
|
||||
virtual PDisplayModeCollection SupportedDisplayModes() const override;
|
||||
virtual constexpr bool IsDefaultAdapter() const { return _index == _defaultAdapterIndex; }
|
||||
|
||||
static PGraphicsAdapter DefaultAdapter();
|
||||
|
||||
static constexpr void DefaultAdapter(size_t index) {
|
||||
_defaultAdapterIndex = index;
|
||||
}
|
||||
|
||||
static constexpr std::vector<PGraphicsAdapter> Adapters() {
|
||||
return _adaptersList;
|
||||
}
|
||||
|
||||
public:
|
||||
IDXGIAdapter1* _adapter{ nullptr };
|
||||
};
|
||||
|
||||
private:
|
||||
Uint _index{ 0 };
|
||||
inline static size_t _defaultAdapterIndex = 0;
|
||||
static std::vector<PGraphicsAdapter> getAllAdapters();
|
||||
inline static std::vector<PGraphicsAdapter> _adaptersList = getAllAdapters();
|
||||
};
|
||||
|
||||
struct SurfaceFormatMapper {
|
||||
static constexpr DXGI_FORMAT ParseToDXGI(SurfaceFormat format)
|
||||
|
Loading…
x
Reference in New Issue
Block a user