From 126a424a24dc85e05f4469759c5422e8c0af7292 Mon Sep 17 00:00:00 2001 From: Danilo Date: Wed, 5 Jun 2024 21:09:35 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=B5es=20em=20GraphicsDevice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/platform-dx/device.cpp | 10 ++-------- inc/xna/enums.hpp | 8 ++++++++ inc/xna/graphics/device.hpp | 3 ++- inc/xna/platform-dx/implementations.hpp | 7 +++++++ 4 files changed, 19 insertions(+), 9 deletions(-) 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{};