From dcf6c06cfbc85e7992148c1462390553edb5e130 Mon Sep 17 00:00:00 2001 From: Danilo Date: Thu, 25 Apr 2024 14:51:33 -0300 Subject: [PATCH] =?UTF-8?q?Implementa=20recursos=20gr=C3=A1ficos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/enums.hpp | 6 +- framework/graphics/blendstate.hpp | 9 +- framework/graphics/depthstencilstate.hpp | 10 +- framework/graphics/rasterizerstate.hpp | 3 +- framework/graphics/shader.hpp | 2 +- framework/graphics/swapchain.hpp | 2 +- framework/platform/blendstate-dx.cpp | 36 +-- framework/platform/blendstate-dx.hpp | 19 +- framework/platform/depthstencilstate-dx.cpp | 52 ++-- framework/platform/depthstencilstate-dx.hpp | 309 +++++++++++--------- framework/platform/device-dx.cpp | 7 +- framework/platform/rasterizerstate-dx.cpp | 57 +++- framework/platform/rasterizerstate-dx.hpp | 97 ++---- framework/platform/samplerstate-dx.hpp | 92 +----- framework/platform/shader-dx.cpp | 12 +- framework/platform/shader-dx.hpp | 15 +- framework/platform/spritebatch-dx.cpp | 7 +- framework/platform/spritebatch-dx.hpp | 22 +- framework/platform/swapchain-dx.cpp | 18 +- framework/platform/swapchain-dx.hpp | 9 +- framework/xna.cpp | 12 - framework/xnaerror.hpp | 3 +- 22 files changed, 356 insertions(+), 443 deletions(-) diff --git a/framework/enums.hpp b/framework/enums.hpp index 9a0a85b..d807eb2 100644 --- a/framework/enums.hpp +++ b/framework/enums.hpp @@ -166,9 +166,9 @@ namespace xna { }; enum class FillMode - { - Solid, + { WireFrame, + Solid, }; enum class GamePadCapabilitiesType @@ -446,8 +446,8 @@ namespace xna { enum class TextureAddressMode { Wrap, - Clamp, Mirror, + Clamp, Border, MirrorOnce }; diff --git a/framework/graphics/blendstate.hpp b/framework/graphics/blendstate.hpp index 6dfa9db..b851270 100644 --- a/framework/graphics/blendstate.hpp +++ b/framework/graphics/blendstate.hpp @@ -9,17 +9,12 @@ namespace xna { class IBlendState { public: virtual ~IBlendState() {} - virtual bool Initialize(GraphicsDevice& device, xna_error_nullarg) = 0; + virtual bool Initialize(xna_error_nullarg) = 0; virtual void AlphaToCoverageEnable(bool value) = 0; virtual void IndependentBlendEnable(bool value) = 0; virtual void RenderTargets(std::vector const& value) = 0; - virtual bool Apply(GraphicsDevice& device, xna_error_nullarg) = 0; - - static PBlendState Opaque(); - static PBlendState AlphaBlend(); - static PBlendState Additive(); - static PBlendState NonPremultiplied(); + virtual bool Apply(xna_error_nullarg) = 0; }; } diff --git a/framework/graphics/depthstencilstate.hpp b/framework/graphics/depthstencilstate.hpp index 3592bb7..b9c31ef 100644 --- a/framework/graphics/depthstencilstate.hpp +++ b/framework/graphics/depthstencilstate.hpp @@ -7,8 +7,8 @@ namespace xna { class IDepthStencilState { public: virtual ~IDepthStencilState(){} - virtual bool Initialize(GraphicsDevice& device, xna_error_nullarg) = 0; - virtual bool Apply(GraphicsDevice& device, xna_error_ptr_arg) = 0; + virtual bool Initialize(xna_error_nullarg) = 0; + virtual bool Apply(xna_error_ptr_arg) = 0; virtual void DepthEnabled(bool value) = 0; virtual void DepthWriteEnabled(bool value) = 0; @@ -38,11 +38,7 @@ namespace xna { virtual StencilOperation StencilBackFacePass() = 0; virtual StencilOperation StencilBackFaceFail() = 0; virtual StencilOperation StencilBackFaceDepthFail() = 0; - virtual ComparisonFunction StencilBackFaceCompare() = 0; - - static PDepthStencilState None(); - static PDepthStencilState Default(); - static PDepthStencilState DepthRead(); + virtual ComparisonFunction StencilBackFaceCompare() = 0; }; } diff --git a/framework/graphics/rasterizerstate.hpp b/framework/graphics/rasterizerstate.hpp index ef099dc..0528c9b 100644 --- a/framework/graphics/rasterizerstate.hpp +++ b/framework/graphics/rasterizerstate.hpp @@ -7,7 +7,8 @@ namespace xna { class IRasterizerState { public: virtual ~IRasterizerState() {} - virtual bool Initialize(GraphicsDevice& device, xna_error_nullarg) = 0; + virtual bool Initialize(xna_error_nullarg) = 0; + virtual bool Apply(xna_error_nullarg) = 0; virtual xna::CullMode CullMode() const = 0; virtual void CullMode(xna::CullMode value) = 0; virtual xna::FillMode FillMode() const = 0; diff --git a/framework/graphics/shader.hpp b/framework/graphics/shader.hpp index f6d0db7..ba91705 100644 --- a/framework/graphics/shader.hpp +++ b/framework/graphics/shader.hpp @@ -7,7 +7,7 @@ namespace xna { class IShader { public: virtual ~IShader() {} - virtual bool Initialize(GraphicsDevice& device, DataBuffer& buffer, xna_error_nullarg) = 0; + virtual bool Initialize(DataBuffer& buffer, xna_error_nullarg) = 0; }; } diff --git a/framework/graphics/swapchain.hpp b/framework/graphics/swapchain.hpp index 3ba999b..0211166 100644 --- a/framework/graphics/swapchain.hpp +++ b/framework/graphics/swapchain.hpp @@ -8,7 +8,7 @@ namespace xna { class ISwapChain { public: virtual ~ISwapChain() {} - virtual bool Initialize(GraphicsDevice& device, GameWindow const& gameWindow) = 0; + virtual bool Initialize(GameWindow const& gameWindow, xna_error_nullarg) = 0; }; } diff --git a/framework/platform/blendstate-dx.cpp b/framework/platform/blendstate-dx.cpp index 319418b..f2b1a5e 100644 --- a/framework/platform/blendstate-dx.cpp +++ b/framework/platform/blendstate-dx.cpp @@ -2,10 +2,10 @@ #include "device-dx.hpp" namespace xna { - bool BlendState::Initialize(GraphicsDevice& device, xna_error_ptr_arg) + bool BlendState::Initialize(xna_error_ptr_arg) { - if (!device._device) { - xna_error_apply(err, XnaErrorCode::ARGUMENT_IS_NULL); + if (!m_device || !m_device->_device) { + xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); return false; } @@ -14,7 +14,7 @@ namespace xna { dxBlendState = nullptr; } - const auto hr = device._device->CreateBlendState(&dxDescription, &dxBlendState); + const auto hr = m_device->_device->CreateBlendState(&dxDescription, &dxBlendState); if (FAILED(hr)) { xna_error_apply(err, XnaErrorCode::FAILED_OPERATION); @@ -24,24 +24,24 @@ namespace xna { return true; } - bool BlendState::Apply(GraphicsDevice& device, xna_error_ptr_arg) { - if (!device._context) { - xna_error_apply(err, XnaErrorCode::ARGUMENT_IS_NULL); + bool BlendState::Apply(xna_error_ptr_arg) { + if (!m_device || !m_device->_context) { + xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); return false; } if (!dxBlendState) { - const auto init = Initialize(device, err); - if (!init) return false; + xna_error_apply(err, XnaErrorCode::UNINTIALIZED_RESOURCE); + return false; } - device._context->OMSetBlendState(dxBlendState, blendFactor, sampleMask); + m_device->_context->OMSetBlendState(dxBlendState, blendFactor, sampleMask); return true; } - PBlendState IBlendState::Opaque() { - auto blendState = New(); + uptr BlendState::Opaque() { + auto blendState = std::unique_ptr(new BlendState()); blendState->dxDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE; blendState->dxDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ZERO; blendState->dxDescription.RenderTarget[0].DestBlend = D3D11_BLEND_DEST_ALPHA; @@ -50,8 +50,8 @@ namespace xna { return blendState; } - PBlendState IBlendState::AlphaBlend() { - auto blendState = New(); + uptr BlendState::AlphaBlend() { + auto blendState = std::unique_ptr(new BlendState()); blendState->dxDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE; blendState->dxDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; blendState->dxDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; @@ -60,8 +60,8 @@ namespace xna { return blendState; } - PBlendState IBlendState::Additive() { - auto blendState = New(); + uptr BlendState::Additive() { + auto blendState = std::unique_ptr(new BlendState()); blendState->dxDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; blendState->dxDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; blendState->dxDescription.RenderTarget[0].DestBlend = D3D11_BLEND_ONE; @@ -70,8 +70,8 @@ namespace xna { return blendState; } - PBlendState IBlendState::NonPremultiplied() { - auto blendState = New(); + uptr BlendState::NonPremultiplied() { + auto blendState = std::unique_ptr(new BlendState()); blendState->dxDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; blendState->dxDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; blendState->dxDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; diff --git a/framework/platform/blendstate-dx.hpp b/framework/platform/blendstate-dx.hpp index dfadf37..fcd3e99 100644 --- a/framework/platform/blendstate-dx.hpp +++ b/framework/platform/blendstate-dx.hpp @@ -2,6 +2,7 @@ #define XNA_PLATFORM_BLENDSTATE_HPP #include "../graphics/blendstate.hpp" +#include "../graphics/gresource.hpp" #include "dxheaders.hpp" namespace xna { @@ -18,9 +19,9 @@ namespace xna { constexpr BlendRenderTarget() = default; }; - class BlendState : public IBlendState { + class BlendState : public IBlendState, public GraphicsResource { public: - BlendState() = default; + BlendState(GraphicsDevice* device) : GraphicsResource(device) {}; virtual ~BlendState() override { if (dxBlendState) { @@ -28,7 +29,7 @@ namespace xna { dxBlendState = nullptr; } } - virtual bool Initialize(GraphicsDevice& device, xna_error_nullarg) override; + virtual bool Initialize(xna_error_nullarg) override; virtual constexpr void AlphaToCoverageEnable(bool value) override { dxDescription.AlphaToCoverageEnable = value; @@ -51,13 +52,21 @@ namespace xna { } } - virtual bool Apply(GraphicsDevice& device, xna_error_nullarg) override; + virtual bool Apply(xna_error_nullarg) override; + + static uptr Opaque(); + static uptr AlphaBlend(); + static uptr Additive(); + static uptr NonPremultiplied(); public: ID3D11BlendState* dxBlendState{ nullptr }; D3D11_BLEND_DESC dxDescription{}; float blendFactor[4] { 1.0F, 1.0F, 1.0F, 1.0F }; - UINT sampleMask{ 0xffffffff }; + UINT sampleMask{ 0xffffffff }; + + private: + BlendState() : GraphicsResource(nullptr){} public: static constexpr D3D11_BLEND ConvertBlend(Blend blend) { diff --git a/framework/platform/depthstencilstate-dx.cpp b/framework/platform/depthstencilstate-dx.cpp index 7c09755..4471777 100644 --- a/framework/platform/depthstencilstate-dx.cpp +++ b/framework/platform/depthstencilstate-dx.cpp @@ -2,19 +2,19 @@ #include "device-dx.hpp" namespace xna { - bool DepthStencilState::Initialize(GraphicsDevice& device, xna_error_ptr_arg) + bool DepthStencilState::Initialize(xna_error_ptr_arg) { - if (!device._device) { - xna_error_apply(err, XnaErrorCode::ARGUMENT_IS_NULL); + if (!m_device || !m_device->_device) { + xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); return false; } - if (_depthStencil) { - _depthStencil->Release(); - _depthStencil = nullptr; + if (dxDepthStencil) { + dxDepthStencil->Release(); + dxDepthStencil = nullptr; } - const auto hr = device._device->CreateDepthStencilState(&_description, &_depthStencil); + const auto hr = m_device->_device->CreateDepthStencilState(&dxDescription, &dxDepthStencil); if (FAILED(hr)) { xna_error_apply(err, XnaErrorCode::FAILED_OPERATION); @@ -24,43 +24,43 @@ namespace xna { return true; } - bool DepthStencilState::Apply(GraphicsDevice& device, xna_error_ptr_arg) + bool DepthStencilState::Apply(xna_error_ptr_arg) { - if (!device._context) { - xna_error_apply(err, XnaErrorCode::ARGUMENT_IS_NULL); + if (!m_device || !m_device->_context) { + xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); return false; } - if (!_depthStencil) { - const auto init = Initialize(device, err); - if (!init) return false; + if (!dxDepthStencil) { + xna_error_apply(err, XnaErrorCode::UNINTIALIZED_RESOURCE); + return false; } - device._context->OMSetDepthStencilState(_depthStencil, 0); + m_device->_context->OMSetDepthStencilState(dxDepthStencil, 0); return true; } - PDepthStencilState IDepthStencilState::None() { - auto stencil = New(); - stencil->_description.DepthEnable = false; - stencil->_description.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; + uptr DepthStencilState::None() { + auto stencil = std::unique_ptr(new DepthStencilState()); + stencil->dxDescription.DepthEnable = false; + stencil->dxDescription.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; return stencil; } - PDepthStencilState IDepthStencilState::Default() { - auto stencil = New(); - stencil->_description.DepthEnable = true; - stencil->_description.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; + uptr DepthStencilState::Default() { + auto stencil = std::unique_ptr(new DepthStencilState()); + stencil->dxDescription.DepthEnable = true; + stencil->dxDescription.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; return stencil; } - PDepthStencilState IDepthStencilState::DepthRead() { - auto stencil = New(); - stencil->_description.DepthEnable = true; - stencil->_description.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; + uptr DepthStencilState::DepthRead() { + auto stencil = std::unique_ptr(new DepthStencilState()); + stencil->dxDescription.DepthEnable = true; + stencil->dxDescription.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; return stencil; } diff --git a/framework/platform/depthstencilstate-dx.hpp b/framework/platform/depthstencilstate-dx.hpp index fa70a31..4126faa 100644 --- a/framework/platform/depthstencilstate-dx.hpp +++ b/framework/platform/depthstencilstate-dx.hpp @@ -2,16 +2,175 @@ #define XNA_PLATFORM_DEPTHSTENCILSTATE_DX_HPP #include "../graphics/depthstencilstate.hpp" +#include "../graphics/gresource.hpp" #include "dxheaders.hpp" namespace xna { - class DepthStencilState : public IDepthStencilState { + class DepthStencilState : public IDepthStencilState, public GraphicsResource { public: - DepthStencilState() { + DepthStencilState(GraphicsDevice* device) : GraphicsResource(device) { + dxDescription = defaultDesc(); + } + + virtual ~DepthStencilState() override { + if (dxDepthStencil) { + dxDepthStencil->Release(); + dxDepthStencil = nullptr; + } + } + + virtual bool Initialize(xna_error_nullarg) override; + virtual bool Apply(xna_error_ptr_arg) override; + + virtual constexpr void DepthEnabled(bool value) override { + dxDescription.DepthEnable = value; + } + + virtual constexpr void DepthWriteEnabled(bool value) override { + dxDescription.DepthWriteMask = static_cast(value); + } + + virtual constexpr void DepthCompareFunction(ComparisonFunction value) override { + const auto _value = static_cast(value) + 1; + dxDescription.DepthFunc = static_cast(_value); + } + + virtual constexpr void StencilEnabled(bool value) override { + dxDescription.StencilEnable = value; + } + + virtual constexpr void StencilReadMask(int value) override { + dxDescription.StencilReadMask = static_cast(value); + } + + virtual constexpr void StencilWriteMask(int value) override { + dxDescription.StencilWriteMask = static_cast(value); + } + + virtual constexpr void StencilFrontFacePass(StencilOperation value) override { + const auto _value = static_cast(value) + 1; + dxDescription.FrontFace.StencilPassOp = static_cast(_value); + } + + virtual constexpr void StencilFrontFaceFail(StencilOperation value) override { + const auto _value = static_cast(value) + 1; + dxDescription.FrontFace.StencilFailOp = static_cast(_value); + } + + virtual constexpr void StencilFrontFaceDepthFail(StencilOperation value) override { + const auto _value = static_cast(value) + 1; + dxDescription.FrontFace.StencilDepthFailOp = static_cast(_value); + } + + virtual constexpr void StencilFrontFaceCompare(ComparisonFunction value) override { + const auto _value = static_cast(value) + 1; + dxDescription.FrontFace.StencilFunc = static_cast(_value); + } + + virtual constexpr void StencilBackFacePass(StencilOperation value) override { + const auto _value = static_cast(value) + 1; + dxDescription.BackFace.StencilPassOp = static_cast(_value); + } + + virtual constexpr void StencilBackFaceFail(StencilOperation value) override { + const auto _value = static_cast(value) + 1; + dxDescription.BackFace.StencilFailOp = static_cast(_value); + } + + virtual constexpr void StencilBackFaceDepthFail(StencilOperation value) override { + const auto _value = static_cast(value) + 1; + dxDescription.BackFace.StencilDepthFailOp = static_cast(_value); + } + + virtual constexpr void StencilBackFaceCompare(ComparisonFunction value) override { + const auto _value = static_cast(value) + 1; + dxDescription.BackFace.StencilFunc = static_cast(_value); + } + + virtual constexpr bool DepthEnabled() override { + return dxDescription.DepthEnable; + } + + virtual constexpr bool DepthWriteEnabled() override { + return static_cast(dxDescription.DepthWriteMask); + } + + virtual constexpr ComparisonFunction DepthCompareFunction() override { + const auto _value = static_cast(dxDescription.DepthFunc) - 1; + return static_cast(_value); + } + + virtual constexpr bool StencilEnabled() override { + return dxDescription.StencilEnable; + } + + virtual constexpr int StencilReadMask() override { + return static_cast(dxDescription.StencilReadMask); + } + + virtual constexpr int StencilWriteMask() override { + return static_cast(dxDescription.StencilWriteMask); + } + + virtual constexpr StencilOperation StencilFrontFacePass() override { + const auto _value = static_cast(dxDescription.FrontFace.StencilPassOp) - 1; + return static_cast(_value); + } + + virtual constexpr StencilOperation StencilFrontFaceFail() override { + const auto _value = static_cast(dxDescription.FrontFace.StencilFailOp) - 1; + return static_cast(_value); + } + + virtual constexpr StencilOperation StencilFrontFaceDepthFail() override { + const auto _value = static_cast(dxDescription.FrontFace.StencilDepthFailOp) - 1; + return static_cast(_value); + } + + virtual constexpr ComparisonFunction StencilFrontFaceCompare() override { + const auto _value = static_cast(dxDescription.FrontFace.StencilFunc) - 1; + return static_cast(_value); + } + + virtual constexpr StencilOperation StencilBackFacePass() override { + const auto _value = static_cast(dxDescription.BackFace.StencilPassOp) - 1; + return static_cast(_value); + } + + virtual constexpr StencilOperation StencilBackFaceFail() override { + const auto _value = static_cast(dxDescription.BackFace.StencilFailOp) - 1; + return static_cast(_value); + } + + virtual constexpr StencilOperation StencilBackFaceDepthFail() override { + const auto _value = static_cast(dxDescription.BackFace.StencilDepthFailOp) - 1; + return static_cast(_value); + } + + virtual constexpr ComparisonFunction StencilBackFaceCompare() override { + const auto _value = static_cast(dxDescription.BackFace.StencilFunc) - 1; + return static_cast(_value); + } + + static uptr None(); + static uptr Default(); + static uptr DepthRead(); + + public: + ID3D11DepthStencilState* dxDepthStencil = nullptr; + D3D11_DEPTH_STENCIL_DESC dxDescription{}; + + private: + DepthStencilState() : GraphicsResource(nullptr) { + dxDescription = defaultDesc(); + } + + static D3D11_DEPTH_STENCIL_DESC defaultDesc() { + D3D11_DEPTH_STENCIL_DESC _description{}; _description.DepthEnable = true; _description.StencilEnable = true; _description.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; - + _description.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; _description.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; _description.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; @@ -25,151 +184,9 @@ namespace xna { _description.StencilReadMask = 0; _description.StencilWriteMask = 0; _description.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; - } - virtual ~DepthStencilState() override { - if (_depthStencil) { - _depthStencil->Release(); - _depthStencil = nullptr; - } + return _description; } - - virtual bool Initialize(GraphicsDevice& device, xna_error_nullarg) override; - virtual bool Apply(GraphicsDevice& device, xna_error_ptr_arg) override; - - virtual constexpr void DepthEnabled(bool value) override { - _description.DepthEnable = value; - } - - virtual constexpr void DepthWriteEnabled(bool value) override { - _description.DepthWriteMask = static_cast(value); - } - - virtual constexpr void DepthCompareFunction(ComparisonFunction value) override { - const auto _value = static_cast(value) + 1; - _description.DepthFunc = static_cast(_value); - } - - virtual constexpr void StencilEnabled(bool value) override { - _description.StencilEnable = value; - } - - virtual constexpr void StencilReadMask(int value) override { - _description.StencilReadMask = static_cast(value); - } - - virtual constexpr void StencilWriteMask(int value) override { - _description.StencilWriteMask = static_cast(value); - } - - virtual constexpr void StencilFrontFacePass(StencilOperation value) override { - const auto _value = static_cast(value) + 1; - _description.FrontFace.StencilPassOp = static_cast(_value); - } - - virtual constexpr void StencilFrontFaceFail(StencilOperation value) override { - const auto _value = static_cast(value) + 1; - _description.FrontFace.StencilFailOp = static_cast(_value); - } - - virtual constexpr void StencilFrontFaceDepthFail(StencilOperation value) override { - const auto _value = static_cast(value) + 1; - _description.FrontFace.StencilDepthFailOp = static_cast(_value); - } - - virtual constexpr void StencilFrontFaceCompare(ComparisonFunction value) override { - const auto _value = static_cast(value) + 1; - _description.FrontFace.StencilFunc = static_cast(_value); - } - - virtual constexpr void StencilBackFacePass(StencilOperation value) override { - const auto _value = static_cast(value) + 1; - _description.BackFace.StencilPassOp = static_cast(_value); - } - - virtual constexpr void StencilBackFaceFail(StencilOperation value) override { - const auto _value = static_cast(value) + 1; - _description.BackFace.StencilFailOp = static_cast(_value); - } - - virtual constexpr void StencilBackFaceDepthFail(StencilOperation value) override { - const auto _value = static_cast(value) + 1; - _description.BackFace.StencilDepthFailOp = static_cast(_value); - } - - virtual constexpr void StencilBackFaceCompare(ComparisonFunction value) override { - const auto _value = static_cast(value) + 1; - _description.BackFace.StencilFunc = static_cast(_value); - } - - virtual constexpr bool DepthEnabled() override { - return _description.DepthEnable; - } - - virtual constexpr bool DepthWriteEnabled() override { - return static_cast(_description.DepthWriteMask); - } - - virtual constexpr ComparisonFunction DepthCompareFunction() override { - const auto _value = static_cast(_description.DepthFunc) - 1; - return static_cast(_value); - } - - virtual constexpr bool StencilEnabled() override { - return _description.StencilEnable; - } - - virtual constexpr int StencilReadMask() override { - return static_cast(_description.StencilReadMask); - } - - virtual constexpr int StencilWriteMask() override { - return static_cast(_description.StencilWriteMask); - } - - virtual constexpr StencilOperation StencilFrontFacePass() override { - const auto _value = static_cast(_description.FrontFace.StencilPassOp) - 1; - return static_cast(_value); - } - - virtual constexpr StencilOperation StencilFrontFaceFail() override { - const auto _value = static_cast(_description.FrontFace.StencilFailOp) - 1; - return static_cast(_value); - } - - virtual constexpr StencilOperation StencilFrontFaceDepthFail() override { - const auto _value = static_cast(_description.FrontFace.StencilDepthFailOp) - 1; - return static_cast(_value); - } - - virtual constexpr ComparisonFunction StencilFrontFaceCompare() override { - const auto _value = static_cast(_description.FrontFace.StencilFunc) - 1; - return static_cast(_value); - } - - virtual constexpr StencilOperation StencilBackFacePass() override { - const auto _value = static_cast(_description.BackFace.StencilPassOp) - 1; - return static_cast(_value); - } - - virtual constexpr StencilOperation StencilBackFaceFail() override { - const auto _value = static_cast(_description.BackFace.StencilFailOp) - 1; - return static_cast(_value); - } - - virtual constexpr StencilOperation StencilBackFaceDepthFail() override { - const auto _value = static_cast(_description.BackFace.StencilDepthFailOp) - 1; - return static_cast(_value); - } - - virtual constexpr ComparisonFunction StencilBackFaceCompare() override { - const auto _value = static_cast(_description.BackFace.StencilFunc) - 1; - return static_cast(_value); - } - - public: - ID3D11DepthStencilState* _depthStencil = nullptr; - D3D11_DEPTH_STENCIL_DESC _description{}; }; } diff --git a/framework/platform/device-dx.cpp b/framework/platform/device-dx.cpp index 97dab66..97848fe 100644 --- a/framework/platform/device-dx.cpp +++ b/framework/platform/device-dx.cpp @@ -35,6 +35,7 @@ namespace xna { if (_blendState == nullptr) _blendState = BlendState::NonPremultiplied(); + _blendState->Bind(this); _createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; @@ -66,9 +67,9 @@ namespace xna { _backgroundColor[3] = 1.0f; if (!_swapChain) - _swapChain = New(); + _swapChain = New(this); - _swapChain->Initialize(*this, gameWindow); + _swapChain->Initialize(gameWindow); if FAILED(_factory->MakeWindowAssociation(gameWindow.WindowHandle(), DXGI_MWA_NO_ALT_ENTER)) return false; @@ -92,7 +93,7 @@ namespace xna { _context->RSSetViewports(1, &view); - _blendState->Apply(*this); + _blendState->Apply(); return true; } diff --git a/framework/platform/rasterizerstate-dx.cpp b/framework/platform/rasterizerstate-dx.cpp index 286e4a9..3bb2dec 100644 --- a/framework/platform/rasterizerstate-dx.cpp +++ b/framework/platform/rasterizerstate-dx.cpp @@ -2,15 +2,64 @@ #include "device-dx.hpp" namespace xna { - bool RasterizerState::Initialize(GraphicsDevice& device, xna_error_ptr_arg) + bool RasterizerState::Initialize(xna_error_ptr_arg) { - const auto hr = device._device->CreateRasterizerState(&_description, &_rasterizerState); - - if (FAILED(hr)) { + if (!m_device || !m_device->_device) { xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); return false; } + const auto hr = m_device->_device->CreateRasterizerState(&dxDescription, &dxRasterizerState); + + if (FAILED(hr)) { + xna_error_apply(err, XnaErrorCode::FAILED_OPERATION); + return false; + } + + return true; + } + + bool RasterizerState::Apply(xna_error_ptr_arg) + { + if (!m_device || !m_device->_context) { + xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); + return false; + } + + if (!dxRasterizerState) { + xna_error_apply(err, XnaErrorCode::UNINTIALIZED_RESOURCE); + return false; + } + + m_device->_context->RSSetState(dxRasterizerState); + return true; } + + uptr RasterizerState::CullNone() + { + auto raster = std::unique_ptr(new RasterizerState()); + raster->dxDescription.FillMode = D3D11_FILL_SOLID; + raster->dxDescription.CullMode = D3D11_CULL_MODE::D3D11_CULL_NONE; + raster->dxDescription.DepthClipEnable = true; + return raster; + } + + uptr RasterizerState::CullClockwise() + { + auto raster = std::unique_ptr(new RasterizerState()); + raster->dxDescription.FillMode = D3D11_FILL_SOLID; + raster->dxDescription.CullMode = D3D11_CULL_MODE::D3D11_CULL_FRONT; + raster->dxDescription.DepthClipEnable = true; + return raster; + } + + uptr RasterizerState::CullCounterClockwise() + { + auto raster = std::unique_ptr(new RasterizerState()); + raster->dxDescription.FillMode = D3D11_FILL_SOLID; + raster->dxDescription.CullMode = D3D11_CULL_MODE::D3D11_CULL_BACK; + raster->dxDescription.DepthClipEnable = true; + return raster; + } } diff --git a/framework/platform/rasterizerstate-dx.hpp b/framework/platform/rasterizerstate-dx.hpp index 344e107..33f088e 100644 --- a/framework/platform/rasterizerstate-dx.hpp +++ b/framework/platform/rasterizerstate-dx.hpp @@ -2,107 +2,50 @@ #define XNA_PLATFORM_RASTERIZERSTATE_DX_HPP #include "../graphics/rasterizerstate.hpp" +#include "../graphics/gresource.hpp" #include "dxheaders.hpp" namespace xna { - class RasterizerState : public IRasterizerState { + class RasterizerState : public IRasterizerState, public GraphicsResource { public: - RasterizerState(){} + RasterizerState(GraphicsDevice* device) : GraphicsResource(device){} virtual ~RasterizerState() override { - if (_rasterizerState) { - _rasterizerState->Release(); - _rasterizerState = nullptr; + if (dxRasterizerState) { + dxRasterizerState->Release(); + dxRasterizerState = nullptr; } } - virtual bool Initialize(GraphicsDevice& device, xna_error_nullarg) override; + virtual bool Initialize(xna_error_nullarg) override; + virtual bool Apply(xna_error_nullarg) override; virtual constexpr xna::CullMode CullMode() const override { - switch (_description.CullMode) - { - case D3D11_CULL_NONE: - return xna::CullMode::None; - case D3D11_CULL_FRONT: - return xna::CullMode::CullClockwiseFace; - case D3D11_CULL_BACK: - return xna::CullMode::CullCounterClockwiseFace; - default: - return xna::CullMode::None; - } + return static_cast(static_cast(dxDescription.CullMode) - 1); } virtual constexpr void CullMode(xna::CullMode value) override { - switch (value) - { - case xna::CullMode::None: - _description.CullMode = D3D11_CULL_NONE; - break; - case xna::CullMode::CullClockwiseFace: - _description.CullMode = D3D11_CULL_FRONT; - break; - case xna::CullMode::CullCounterClockwiseFace: - _description.CullMode = D3D11_CULL_BACK; - break; - default: - _description.CullMode = D3D11_CULL_NONE; - break; - } + dxDescription.CullMode = static_cast(static_cast(value) + 1); } virtual constexpr xna::FillMode FillMode() const override { - switch (_description.FillMode) { - case D3D11_FILL_SOLID: - return xna::FillMode::Solid; - case D3D11_FILL_WIREFRAME: - return xna::FillMode::WireFrame; - default: - return xna::FillMode::Solid; - } + return static_cast(static_cast(dxDescription.FillMode) - 2); } virtual constexpr void FillMode(xna::FillMode value) override { - switch (value) - { - case xna::FillMode::Solid: - _description.FillMode = D3D11_FILL_SOLID; - break; - case xna::FillMode::WireFrame: - _description.FillMode = D3D11_FILL_WIREFRAME; - break; - default: - _description.FillMode = D3D11_FILL_SOLID; - break; - } + dxDescription.FillMode = static_cast(static_cast(value) + 2); } - static PRasterizerState CullNone() { - auto raster = New(); - raster->_description.FillMode = D3D11_FILL_SOLID; - raster->_description.CullMode = D3D11_CULL_MODE::D3D11_CULL_NONE; - raster->_description.DepthClipEnable = true; - return raster; - } - - static PRasterizerState CullClockwise() { - auto raster = New(); - raster->_description.FillMode = D3D11_FILL_SOLID; - raster->_description.CullMode = D3D11_CULL_MODE::D3D11_CULL_FRONT; - raster->_description.DepthClipEnable = true; - return raster; - } - - static PRasterizerState CullCounterClockwise() { - auto raster = New(); - raster->_description.FillMode = D3D11_FILL_SOLID; - raster->_description.CullMode = D3D11_CULL_MODE::D3D11_CULL_BACK; - raster->_description.DepthClipEnable = true; - return raster; - } + static uptr CullNone(); + static uptr CullClockwise(); + static uptr CullCounterClockwise(); public: - ID3D11RasterizerState* _rasterizerState = nullptr; - D3D11_RASTERIZER_DESC _description{}; + ID3D11RasterizerState* dxRasterizerState = nullptr; + D3D11_RASTERIZER_DESC dxDescription{}; + + private: + RasterizerState() : GraphicsResource(nullptr){} }; } diff --git a/framework/platform/samplerstate-dx.hpp b/framework/platform/samplerstate-dx.hpp index c045877..8f34e22 100644 --- a/framework/platform/samplerstate-dx.hpp +++ b/framework/platform/samplerstate-dx.hpp @@ -68,36 +68,7 @@ namespace xna { } virtual constexpr void Comparison(ComparisonFunction value) override { - switch (value) - { - case xna::ComparisonFunction::Never: - _description.ComparisonFunc = D3D11_COMPARISON_NEVER; - break; - case xna::ComparisonFunction::Less: - _description.ComparisonFunc = D3D11_COMPARISON_LESS; - break; - case xna::ComparisonFunction::Equal: - _description.ComparisonFunc = D3D11_COMPARISON_EQUAL; - break; - case xna::ComparisonFunction::LessEquals: - _description.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL; - break; - case xna::ComparisonFunction::Greater: - _description.ComparisonFunc = D3D11_COMPARISON_GREATER; - break; - case xna::ComparisonFunction::NotEqual: - _description.ComparisonFunc = D3D11_COMPARISON_NOT_EQUAL; - break; - case xna::ComparisonFunction::GreaterEqual: - _description.ComparisonFunc = D3D11_COMPARISON_GREATER_EQUAL; - break; - case xna::ComparisonFunction::Always: - _description.ComparisonFunc = D3D11_COMPARISON_ALWAYS; - break; - default: - _description.ComparisonFunc = D3D11_COMPARISON_NEVER; - break; - } + _description.ComparisonFunc = static_cast(static_cast(value) + 1); } virtual constexpr void MipLODBias(float value) override { @@ -161,27 +132,7 @@ namespace xna { } virtual ComparisonFunction Comparison() const override { - switch (_description.ComparisonFunc) - { - case D3D11_COMPARISON_NEVER : - return xna::ComparisonFunction::Never; - case D3D11_COMPARISON_LESS: - return xna::ComparisonFunction::Less; - case D3D11_COMPARISON_EQUAL: - return xna::ComparisonFunction::Equal; - case D3D11_COMPARISON_LESS_EQUAL: - return xna::ComparisonFunction::LessEquals; - case D3D11_COMPARISON_GREATER: - return xna::ComparisonFunction::Greater; - case D3D11_COMPARISON_NOT_EQUAL: - return xna::ComparisonFunction::NotEqual; - case D3D11_COMPARISON_GREATER_EQUAL: - return xna::ComparisonFunction::GreaterEqual; - case D3D11_COMPARISON_ALWAYS: - return xna::ComparisonFunction::Always; - default: - return xna::ComparisonFunction::Never; - } + return static_cast(_description.ComparisonFunc - 1); } virtual constexpr float MipLODBias() const override { @@ -206,46 +157,11 @@ namespace xna { public: static constexpr void ConvertAddressMode(TextureAddressMode value, D3D11_TEXTURE_ADDRESS_MODE& target) { - switch (value) - { - case xna::TextureAddressMode::Wrap: - target = D3D11_TEXTURE_ADDRESS_WRAP; - break; - case xna::TextureAddressMode::Clamp: - target = D3D11_TEXTURE_ADDRESS_CLAMP; - break; - case xna::TextureAddressMode::Mirror: - target = D3D11_TEXTURE_ADDRESS_MIRROR; - break; - case xna::TextureAddressMode::Border: - target = D3D11_TEXTURE_ADDRESS_BORDER; - break; - case xna::TextureAddressMode::MirrorOnce: - target = D3D11_TEXTURE_ADDRESS_MIRROR_ONCE; - break; - default: - target = D3D11_TEXTURE_ADDRESS_WRAP; - break; - } + target = static_cast(static_cast(value) + 1); } static constexpr void ConvertAddressMode(D3D11_TEXTURE_ADDRESS_MODE value, TextureAddressMode& target) { - switch (value) - { - case D3D11_TEXTURE_ADDRESS_WRAP: - target = TextureAddressMode::Wrap; - case D3D11_TEXTURE_ADDRESS_CLAMP: - target = TextureAddressMode::Clamp; - case D3D11_TEXTURE_ADDRESS_MIRROR: - target = TextureAddressMode::Mirror; - case D3D11_TEXTURE_ADDRESS_BORDER: - target = TextureAddressMode::Border; - case D3D11_TEXTURE_ADDRESS_MIRROR_ONCE: - target = TextureAddressMode::MirrorOnce; - default: - target = TextureAddressMode::Wrap; - break; - } + target = static_cast(value - 1); } }; } diff --git a/framework/platform/shader-dx.cpp b/framework/platform/shader-dx.cpp index df04e59..d60595a 100644 --- a/framework/platform/shader-dx.cpp +++ b/framework/platform/shader-dx.cpp @@ -47,9 +47,9 @@ namespace xna { return hr; } - bool VertexShader::Initialize(GraphicsDevice& device, DataBuffer& buffer, xna_error_ptr_arg) + bool VertexShader::Initialize(DataBuffer& buffer, xna_error_ptr_arg) { - if (!device._device || !buffer._blob) { + if (!m_device || !m_device->_device || !buffer._blob) { xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); return false; } @@ -59,7 +59,7 @@ namespace xna { _vertexShader = nullptr; } - const auto hr = device._device->CreateVertexShader( + const auto hr = m_device->_device->CreateVertexShader( buffer._blob->GetBufferPointer(), buffer._blob->GetBufferSize(), NULL, @@ -73,9 +73,9 @@ namespace xna { return true; } - bool PixelShader::Initialize(GraphicsDevice& device, DataBuffer& buffer, xna_error_ptr_arg) + bool PixelShader::Initialize(DataBuffer& buffer, xna_error_ptr_arg) { - if (!device._device || !buffer._blob) { + if (!m_device || !m_device->_device || !buffer._blob) { xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); return false; } @@ -85,7 +85,7 @@ namespace xna { _pixelShader = nullptr; } - const auto hr = device._device->CreatePixelShader( + const auto hr = m_device->_device->CreatePixelShader( buffer._blob->GetBufferPointer(), buffer._blob->GetBufferSize(), NULL, diff --git a/framework/platform/shader-dx.hpp b/framework/platform/shader-dx.hpp index 3a8e948..c0842e0 100644 --- a/framework/platform/shader-dx.hpp +++ b/framework/platform/shader-dx.hpp @@ -2,23 +2,24 @@ #define XNA_PLATFORM_SHADER_DX_HPP #include "../graphics/shader.hpp" +#include "../graphics/gresource.hpp" #include "dxheaders.hpp" namespace xna { - class Shader : public IShader { + class Shader : public IShader, public GraphicsResource { public: - Shader() = default; + Shader(GraphicsDevice* device) : GraphicsResource(device){} virtual ~Shader() override {} - virtual bool Initialize(GraphicsDevice& device, DataBuffer& buffer, xna_error_nullarg) override {} + virtual bool Initialize(DataBuffer& buffer, xna_error_nullarg) override {} static HRESULT CompileFromFile(_In_ LPCWSTR srcFile, _In_ LPCSTR entryPoint, _In_ LPCSTR profile, _Outptr_ ID3DBlob** blob); }; class VertexShader : public Shader { public: - VertexShader() = default; + VertexShader(GraphicsDevice* device) : Shader(device){} virtual ~VertexShader() override { if (_vertexShader) { @@ -27,7 +28,7 @@ namespace xna { } } - virtual bool Initialize(GraphicsDevice& device, DataBuffer& buffer, xna_error_nullarg) override; + virtual bool Initialize(DataBuffer& buffer, xna_error_nullarg) override; public: ID3D11VertexShader* _vertexShader = nullptr; @@ -35,7 +36,7 @@ namespace xna { class PixelShader : public Shader { public: - PixelShader() = default; + PixelShader(GraphicsDevice* device) : Shader(device) {} virtual ~PixelShader() override { if (_pixelShader) { @@ -44,7 +45,7 @@ namespace xna { } } - virtual bool Initialize(GraphicsDevice& device, DataBuffer& buffer, xna_error_nullarg) override; + virtual bool Initialize(DataBuffer& buffer, xna_error_nullarg) override; public: ID3D11PixelShader* _pixelShader = nullptr; diff --git a/framework/platform/spritebatch-dx.cpp b/framework/platform/spritebatch-dx.cpp index 325854d..f4d0fbb 100644 --- a/framework/platform/spritebatch-dx.cpp +++ b/framework/platform/spritebatch-dx.cpp @@ -17,6 +17,9 @@ using DirectX::GXMVECTOR; namespace xna { SpriteBatch::SpriteBatch(GraphicsDevice& device) { + if (!device._context) + return; + _dxspriteBatch = New(device._context); Viewport(device.Viewport()); @@ -42,8 +45,8 @@ namespace xna { sort, blendState ? blendState->dxBlendState : nullptr, samplerState ? samplerState->_samplerState : nullptr, - depthStencil ? depthStencil->_depthStencil : nullptr, - rasterizerState ? rasterizerState->_rasterizerState : nullptr, + depthStencil ? depthStencil->dxDepthStencil : nullptr, + rasterizerState ? rasterizerState->dxRasterizerState : nullptr, nullptr, matrix ); diff --git a/framework/platform/spritebatch-dx.hpp b/framework/platform/spritebatch-dx.hpp index 984ed1c..767ebee 100644 --- a/framework/platform/spritebatch-dx.hpp +++ b/framework/platform/spritebatch-dx.hpp @@ -44,27 +44,7 @@ namespace xna { public: static constexpr void ConvertSpriteSort(SpriteSortMode value, DirectX::SpriteSortMode& target) { - switch (value) - { - case xna::SpriteSortMode::Deferred: - target = DirectX::SpriteSortMode_Deferred; - break; - case xna::SpriteSortMode::Immediate: - target = DirectX::SpriteSortMode_Immediate; - break; - case xna::SpriteSortMode::Texture: - target = DirectX::SpriteSortMode_Texture; - break; - case xna::SpriteSortMode::BackToFront: - target = DirectX::SpriteSortMode_BackToFront; - break; - case xna::SpriteSortMode::FrontToBack: - target = DirectX::SpriteSortMode_FrontToBack; - break; - default: - target = DirectX::SpriteSortMode_Deferred; - break; - } + target = static_cast(static_cast(value)); } public: diff --git a/framework/platform/swapchain-dx.cpp b/framework/platform/swapchain-dx.cpp index a5136a7..e11d550 100644 --- a/framework/platform/swapchain-dx.cpp +++ b/framework/platform/swapchain-dx.cpp @@ -37,7 +37,12 @@ namespace xna { return true; } - bool SwapChain::Initialize(GraphicsDevice& device, GameWindow const& gameWindow) { + bool SwapChain::Initialize(GameWindow const& gameWindow, xna_error_ptr_arg) { + if (!m_device || !m_device->_device) { + xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); + return false; + } + const auto bounds = gameWindow.ClientBounds(); dxDescription.Width = static_cast(bounds.Width); @@ -56,14 +61,19 @@ namespace xna { dxFullScreenDescription.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; dxFullScreenDescription.Windowed = gameWindow.Mode() != GameWindowMode::Fullscreen; - return internalInit(device, gameWindow, dxSwapChain, dxDescription, dxFullScreenDescription); + return internalInit(*m_device, gameWindow, dxSwapChain, dxDescription, dxFullScreenDescription); } - bool SwapChain::Initialize(GraphicsDevice& device, GameWindow const& gameWindow, DXGI_SWAP_CHAIN_DESC1 const& desc, DXGI_SWAP_CHAIN_FULLSCREEN_DESC const& fullScreenDesc) + bool SwapChain::Initialize(GameWindow const& gameWindow, DXGI_SWAP_CHAIN_DESC1 const& desc, DXGI_SWAP_CHAIN_FULLSCREEN_DESC const& fullScreenDesc, xna_error_ptr_arg) { + if (!m_device || !m_device->_device) { + xna_error_apply(err, XnaErrorCode::INVALID_OPERATION); + return false; + } + dxDescription = desc; dxFullScreenDescription = fullScreenDesc; - return internalInit(device, gameWindow, dxSwapChain, dxDescription, dxFullScreenDescription); + return internalInit(*m_device, gameWindow, dxSwapChain, dxDescription, dxFullScreenDescription); } bool SwapChain::GetBackBuffer(ID3D11Texture2D*& texture2D) { diff --git a/framework/platform/swapchain-dx.hpp b/framework/platform/swapchain-dx.hpp index 2217649..95785da 100644 --- a/framework/platform/swapchain-dx.hpp +++ b/framework/platform/swapchain-dx.hpp @@ -4,10 +4,13 @@ #include "../graphics/swapchain.hpp" #include "window-dx.hpp" #include "dxheaders.hpp" +#include "../graphics/gresource.hpp" namespace xna { - class SwapChain : public ISwapChain{ + class SwapChain : public ISwapChain, public GraphicsResource { public: + SwapChain(GraphicsDevice* device): GraphicsResource(device){} + virtual ~SwapChain() override { if (dxSwapChain) { dxSwapChain->Release(); @@ -15,8 +18,8 @@ namespace xna { } } - virtual bool Initialize(GraphicsDevice& device, GameWindow const& gameWindow) override; - bool Initialize(GraphicsDevice& device, GameWindow const& gameWindow, DXGI_SWAP_CHAIN_DESC1 const& desc, DXGI_SWAP_CHAIN_FULLSCREEN_DESC const& fullScreenDesc); + virtual bool Initialize(GameWindow const& gameWindow, xna_error_nullarg) override; + bool Initialize(GameWindow const& gameWindow, DXGI_SWAP_CHAIN_DESC1 const& desc, DXGI_SWAP_CHAIN_FULLSCREEN_DESC const& fullScreenDesc, xna_error_nullarg); bool GetBackBuffer(ID3D11Texture2D*& texture2D); diff --git a/framework/xna.cpp b/framework/xna.cpp index 14a365f..f46add4 100644 --- a/framework/xna.cpp +++ b/framework/xna.cpp @@ -26,18 +26,6 @@ namespace xna { XnaErrorCode err; texture = Texture2D::FromStream(*_graphicsDevice, "D:\\sprite.jpg", &err); - - std::vector data(3); - data[0] = VertexPositionColor(Vector3(0.0F, 0.5F, 0.5F), Colors::AliceBlue); - data[0] = VertexPositionColor(Vector3(0.5F, -0.5F, 0.5F), Colors::Red); - data[0] = VertexPositionColor(Vector3(-0.5F, -0.5F, 0.5F), Colors::AliceBlue); - - VertexBuffer vbuffer(_graphicsDevice.get(), data); - vbuffer.Initialize(&err); - - D3D11_BUFFER_DESC desc; - vbuffer.dxBuffer->GetDesc(&desc); - Game::LoadContent(); } diff --git a/framework/xnaerror.hpp b/framework/xnaerror.hpp index ea401c9..8c32ec7 100644 --- a/framework/xnaerror.hpp +++ b/framework/xnaerror.hpp @@ -11,7 +11,8 @@ namespace xna { OVERFLOW_OPERATION, NULL_CAST, BAD_CAST, - STREAM_ERROR + STREAM_ERROR, + UNINTIALIZED_RESOURCE }; inline void xna_error_apply(XnaErrorCode* source, XnaErrorCode const& value) {