summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-11-22 04:29:18 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-11-22 04:29:18 +0000
commit70084d044f03d9dca3a14869b596763e42440123 (patch)
tree70d74ae5edcfdddaf2383f5d02d99f7dd58e5838 /Graphics/GraphicsEngineD3D11
parentAttempt #2 to fix linux build (diff)
downloadDiligentCore-70084d044f03d9dca3a14869b596763e42440123.tar.gz
DiligentCore-70084d044f03d9dca3a14869b596763e42440123.zip
Fixed issue with state transitions in d3d11 backend
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h8
-rw-r--r--Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h8
2 files changed, 14 insertions, 2 deletions
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<RESOURCE_STATE>(m_State | State);}
- void ClearState(RESOURCE_STATE State){m_State = static_cast<RESOURCE_STATE>(m_State & ~static_cast<Uint32>(State));}
+ void ClearState(RESOURCE_STATE State)
+ {
+ VERIFY_EXPR(IsInKnownState());
+ m_State = static_cast<RESOURCE_STATE>(m_State & ~static_cast<Uint32>(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<RESOURCE_STATE>(m_State | State);}
- void ClearState(RESOURCE_STATE State){m_State = static_cast<RESOURCE_STATE>(m_State & ~static_cast<Uint32>(State));}
+ void ClearState(RESOURCE_STATE State)
+ {
+ VERIFY_EXPR(IsInKnownState());
+ m_State = static_cast<RESOURCE_STATE>(m_State & ~static_cast<Uint32>(State));
+ if (!IsInKnownState())
+ SetState(RESOURCE_STATE_UNDEFINED);
+ }
protected:
void CreateViewInternal( const struct TextureViewDesc &ViewDesc, ITextureView **ppView, bool bIsDefaultView )override final;