From 70084d044f03d9dca3a14869b596763e42440123 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Wed, 21 Nov 2018 20:29:18 -0800 Subject: Fixed issue with state transitions in d3d11 backend --- Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h | 8 +++++++- Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h index c0d47666..2e6510dd 100644 --- a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h @@ -69,7 +69,13 @@ public: virtual void* GetNativeHandle()override final { return GetD3D11Buffer(); } void AddState (RESOURCE_STATE State){m_State = static_cast(m_State | State);} - void ClearState(RESOURCE_STATE State){m_State = static_cast(m_State & ~static_cast(State));} + void ClearState(RESOURCE_STATE State) + { + VERIFY_EXPR(IsInKnownState()); + m_State = static_cast(m_State & ~static_cast(State)); + if (!IsInKnownState()) + SetState(RESOURCE_STATE_UNDEFINED); + } private: virtual void CreateViewInternal( const struct BufferViewDesc &ViewDesc, IBufferView **ppView, bool bIsDefaultView )override; diff --git a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h index f17bba70..7bb89a7e 100644 --- a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h @@ -81,7 +81,13 @@ public: Uint32 DstZ); void AddState (RESOURCE_STATE State){m_State = static_cast(m_State | State);} - void ClearState(RESOURCE_STATE State){m_State = static_cast(m_State & ~static_cast(State));} + void ClearState(RESOURCE_STATE State) + { + VERIFY_EXPR(IsInKnownState()); + m_State = static_cast(m_State & ~static_cast(State)); + if (!IsInKnownState()) + SetState(RESOURCE_STATE_UNDEFINED); + } protected: void CreateViewInternal( const struct TextureViewDesc &ViewDesc, ITextureView **ppView, bool bIsDefaultView )override final; -- cgit v1.2.3