diff --git a/framework/platform-dx/device.cpp b/framework/platform-dx/device.cpp index 18961cd..59fd5be 100644 --- a/framework/platform-dx/device.cpp +++ b/framework/platform-dx/device.cpp @@ -178,13 +178,7 @@ namespace xna { if (!impl) return nullptr; return impl->_adapter; - } - - void GraphicsDevice::Adapter(sptr const& adapter) { - if (!impl) return; - - impl->_adapter = adapter; - } + } xna::Viewport GraphicsDevice::Viewport() const { if (!impl) return {}; @@ -202,5 +196,5 @@ namespace xna { if (!impl) return; impl->_usevsync = use; - } + } } \ No newline at end of file diff --git a/inc/xna/enums.hpp b/inc/xna/enums.hpp index 83d09f9..2d94369 100644 --- a/inc/xna/enums.hpp +++ b/inc/xna/enums.hpp @@ -450,6 +450,14 @@ namespace xna { Immediate }; + enum class PrimitiveType + { + TriangleList, + TriangleStrip, + LineList, + LineStrip, + }; + enum RenderTargetUsage { DiscardContents, PreserveContents, diff --git a/inc/xna/graphics/device.hpp b/inc/xna/graphics/device.hpp index b3c7ea4..ae70e06 100644 --- a/inc/xna/graphics/device.hpp +++ b/inc/xna/graphics/device.hpp @@ -14,11 +14,12 @@ namespace xna { bool Initialize(); bool Present(); sptr Adapter() const; - void Adapter(sptr const& adapter); xna::Viewport Viewport() const; void Viewport(xna::Viewport const& viewport); void UseVSync(bool use); + //void DrawPrimitives(PrimitiveType primitiveType, Int startVertex, Int primitiveCount); + public: struct PlatformImplementation; uptr impl = nullptr; diff --git a/inc/xna/platform-dx/implementations.hpp b/inc/xna/platform-dx/implementations.hpp index 5228b4f..12a5bde 100644 --- a/inc/xna/platform-dx/implementations.hpp +++ b/inc/xna/platform-dx/implementations.hpp @@ -246,6 +246,13 @@ namespace xna { }; struct SwapChain::PlatformImplementation { + ~PlatformImplementation() { + if (dxSwapChain) { + dxSwapChain->Release(); + dxSwapChain = nullptr; + } + } + IDXGISwapChain1* dxSwapChain{ nullptr }; DXGI_SWAP_CHAIN_DESC1 dxDescription{}; DXGI_SWAP_CHAIN_FULLSCREEN_DESC dxFullScreenDescription{};