diff --git a/Source/Core/VideoBackends/D3D/D3D.vcxproj b/Source/Core/VideoBackends/D3D/D3D.vcxproj
index ee77521420..41e1c18529 100644
--- a/Source/Core/VideoBackends/D3D/D3D.vcxproj
+++ b/Source/Core/VideoBackends/D3D/D3D.vcxproj
@@ -38,10 +38,10 @@
+
-
@@ -50,7 +50,6 @@
-
@@ -61,10 +60,10 @@
+
-
@@ -73,7 +72,6 @@
-
@@ -93,4 +91,4 @@
-
+
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/D3D/D3D.vcxproj.filters b/Source/Core/VideoBackends/D3D/D3D.vcxproj.filters
index 58b26f0ea9..a552f47216 100644
--- a/Source/Core/VideoBackends/D3D/D3D.vcxproj.filters
+++ b/Source/Core/VideoBackends/D3D/D3D.vcxproj.filters
@@ -1,4 +1,4 @@
-
+
@@ -24,7 +24,7 @@
D3D
-
+
D3D
@@ -67,9 +67,6 @@
Render
-
- Render
-
@@ -87,7 +84,7 @@
D3D
-
+
D3D
@@ -132,8 +129,5 @@
-
- Render
-
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/D3D/D3DBase.cpp b/Source/Core/VideoBackends/D3D/D3DBase.cpp
index cde40490a4..f7426da03a 100644
--- a/Source/Core/VideoBackends/D3D/D3DBase.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DBase.cpp
@@ -4,8 +4,8 @@
#include "Common/StringUtil.h"
#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DState.h"
#include "VideoBackends/D3D/D3DTexture.h"
-#include "VideoBackends/D3D/GfxState.h"
#include "VideoCommon/VideoConfig.h"
namespace DX11
diff --git a/Source/Core/VideoBackends/D3D/StateCache.cpp b/Source/Core/VideoBackends/D3D/D3DState.cpp
similarity index 81%
rename from Source/Core/VideoBackends/D3D/StateCache.cpp
rename to Source/Core/VideoBackends/D3D/D3DState.cpp
index ace05f0709..67436df56f 100644
--- a/Source/Core/VideoBackends/D3D/StateCache.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DState.cpp
@@ -2,11 +2,81 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoBackends/D3D/StateCache.h"
+#include "Common/Logging/Log.h"
+
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DState.h"
namespace DX11
{
+namespace D3D
+{
+
+StateManager* stateman;
+
+
+template AutoState::AutoState(const T* object) : state(object)
+{
+ ((IUnknown*)state)->AddRef();
+}
+
+template AutoState::AutoState(const AutoState &source)
+{
+ state = source.GetPtr();
+ ((T*)state)->AddRef();
+}
+
+template AutoState::~AutoState()
+{
+ if (state) ((T*)state)->Release();
+ state = nullptr;
+}
+
+StateManager::StateManager() : cur_blendstate(nullptr), cur_depthstate(nullptr), cur_raststate(nullptr) {}
+
+void StateManager::PushBlendState(const ID3D11BlendState* state) { blendstates.push(AutoBlendState(state)); }
+void StateManager::PushDepthState(const ID3D11DepthStencilState* state) { depthstates.push(AutoDepthStencilState(state)); }
+void StateManager::PushRasterizerState(const ID3D11RasterizerState* state) { raststates.push(AutoRasterizerState(state)); }
+void StateManager::PopBlendState() { blendstates.pop(); }
+void StateManager::PopDepthState() { depthstates.pop(); }
+void StateManager::PopRasterizerState() { raststates.pop(); }
+
+void StateManager::Apply()
+{
+ if (!blendstates.empty())
+ {
+ if (cur_blendstate != blendstates.top().GetPtr())
+ {
+ cur_blendstate = (ID3D11BlendState*)blendstates.top().GetPtr();
+ D3D::context->OMSetBlendState(cur_blendstate, nullptr, 0xFFFFFFFF);
+ }
+ }
+ else ERROR_LOG(VIDEO, "Tried to apply without blend state!");
+
+ if (!depthstates.empty())
+ {
+ if (cur_depthstate != depthstates.top().GetPtr())
+ {
+ cur_depthstate = (ID3D11DepthStencilState*)depthstates.top().GetPtr();
+ D3D::context->OMSetDepthStencilState(cur_depthstate, 0);
+ }
+ }
+ else ERROR_LOG(VIDEO, "Tried to apply without depth state!");
+
+ if (!raststates.empty())
+ {
+ if (cur_raststate != raststates.top().GetPtr())
+ {
+ cur_raststate = (ID3D11RasterizerState*)raststates.top().GetPtr();
+ D3D::context->RSSetState(cur_raststate);
+ }
+ }
+ else ERROR_LOG(VIDEO, "Tried to apply without rasterizer state!");
+}
+
+} // namespace D3D
+
ID3D11SamplerState* StateCache::Get(SamplerState state)
{
auto it = m_sampler.find(state.packed);
diff --git a/Source/Core/VideoBackends/D3D/StateCache.h b/Source/Core/VideoBackends/D3D/D3DState.h
similarity index 55%
rename from Source/Core/VideoBackends/D3D/StateCache.h
rename to Source/Core/VideoBackends/D3D/D3DState.h
index 53745899bb..8c7ee75776 100644
--- a/Source/Core/VideoBackends/D3D/StateCache.h
+++ b/Source/Core/VideoBackends/D3D/D3DState.h
@@ -4,6 +4,7 @@
#pragma once
+#include
#include
#include "Common/BitField.h"
@@ -11,6 +12,10 @@
#include "VideoBackends/D3D/D3DBase.h"
#include "VideoCommon/BPMemory.h"
+struct ID3D11BlendState;
+struct ID3D11DepthStencilState;
+struct ID3D11RasterizerState;
+
namespace DX11
{
@@ -71,4 +76,55 @@ private:
};
-}
+namespace D3D
+{
+
+template class AutoState
+{
+public:
+ AutoState(const T* object);
+ AutoState(const AutoState &source);
+ ~AutoState();
+
+ const inline T* GetPtr() const { return state; }
+
+private:
+ const T* state;
+};
+
+typedef AutoState AutoBlendState;
+typedef AutoState AutoDepthStencilState;
+typedef AutoState AutoRasterizerState;
+
+class StateManager
+{
+public:
+ StateManager();
+
+ // call any of these to change the affected states
+ void PushBlendState(const ID3D11BlendState* state);
+ void PushDepthState(const ID3D11DepthStencilState* state);
+ void PushRasterizerState(const ID3D11RasterizerState* state);
+
+ // call these after drawing
+ void PopBlendState();
+ void PopDepthState();
+ void PopRasterizerState();
+
+ // call this before any drawing operation if states could have changed meanwhile
+ void Apply();
+
+private:
+ std::stack blendstates;
+ std::stack depthstates;
+ std::stack raststates;
+ ID3D11BlendState* cur_blendstate;
+ ID3D11DepthStencilState* cur_depthstate;
+ ID3D11RasterizerState* cur_raststate;
+};
+
+extern StateManager* stateman;
+
+} // namespace
+
+} // namespace DX11
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/D3D/D3DUtil.cpp b/Source/Core/VideoBackends/D3D/D3DUtil.cpp
index f8d91df952..ad37d4f419 100644
--- a/Source/Core/VideoBackends/D3D/D3DUtil.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DUtil.cpp
@@ -8,8 +8,8 @@
#include "VideoBackends/D3D/D3DBase.h"
#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/D3DState.h"
#include "VideoBackends/D3D/D3DUtil.h"
-#include "VideoBackends/D3D/GfxState.h"
#include "VideoBackends/D3D/PixelShaderCache.h"
#include "VideoBackends/D3D/VertexShaderCache.h"
diff --git a/Source/Core/VideoBackends/D3D/GfxState.cpp b/Source/Core/VideoBackends/D3D/GfxState.cpp
deleted file mode 100644
index b14ecec8fc..0000000000
--- a/Source/Core/VideoBackends/D3D/GfxState.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2013 Dolphin Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#include "Common/Logging/Log.h"
-
-#include "VideoBackends/D3D/D3DBase.h"
-#include "VideoBackends/D3D/GfxState.h"
-
-namespace DX11
-{
-
-namespace D3D
-{
-
-StateManager* stateman;
-
-
-template AutoState::AutoState(const T* object) : state(object)
-{
- ((IUnknown*)state)->AddRef();
-}
-
-template AutoState::AutoState(const AutoState &source)
-{
- state = source.GetPtr();
- ((T*)state)->AddRef();
-}
-
-template AutoState::~AutoState()
-{
- if (state) ((T*)state)->Release();
- state = nullptr;
-}
-
-StateManager::StateManager() : cur_blendstate(nullptr), cur_depthstate(nullptr), cur_raststate(nullptr) {}
-
-void StateManager::PushBlendState(const ID3D11BlendState* state) { blendstates.push(AutoBlendState(state)); }
-void StateManager::PushDepthState(const ID3D11DepthStencilState* state) { depthstates.push(AutoDepthStencilState(state)); }
-void StateManager::PushRasterizerState(const ID3D11RasterizerState* state) { raststates.push(AutoRasterizerState(state)); }
-void StateManager::PopBlendState() { blendstates.pop(); }
-void StateManager::PopDepthState() { depthstates.pop(); }
-void StateManager::PopRasterizerState() { raststates.pop(); }
-
-void StateManager::Apply()
-{
- if (!blendstates.empty())
- {
- if (cur_blendstate != blendstates.top().GetPtr())
- {
- cur_blendstate = (ID3D11BlendState*)blendstates.top().GetPtr();
- D3D::context->OMSetBlendState(cur_blendstate, nullptr, 0xFFFFFFFF);
- }
- }
- else ERROR_LOG(VIDEO, "Tried to apply without blend state!");
-
- if (!depthstates.empty())
- {
- if (cur_depthstate != depthstates.top().GetPtr())
- {
- cur_depthstate = (ID3D11DepthStencilState*)depthstates.top().GetPtr();
- D3D::context->OMSetDepthStencilState(cur_depthstate, 0);
- }
- }
- else ERROR_LOG(VIDEO, "Tried to apply without depth state!");
-
- if (!raststates.empty())
- {
- if (cur_raststate != raststates.top().GetPtr())
- {
- cur_raststate = (ID3D11RasterizerState*)raststates.top().GetPtr();
- D3D::context->RSSetState(cur_raststate);
- }
- }
- else ERROR_LOG(VIDEO, "Tried to apply without rasterizer state!");
-}
-
-} // namespace
-
-} // namespace DX11
diff --git a/Source/Core/VideoBackends/D3D/GfxState.h b/Source/Core/VideoBackends/D3D/GfxState.h
deleted file mode 100644
index 977b53dab6..0000000000
--- a/Source/Core/VideoBackends/D3D/GfxState.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2013 Dolphin Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include
-
-struct ID3D11BlendState;
-struct ID3D11DepthStencilState;
-struct ID3D11RasterizerState;
-
-namespace DX11
-{
-
-namespace D3D
-{
-
-template class AutoState
-{
-public:
- AutoState(const T* object);
- AutoState(const AutoState &source);
- ~AutoState();
-
- const inline T* GetPtr() const { return state; }
-
-private:
- const T* state;
-};
-
-typedef AutoState AutoBlendState;
-typedef AutoState AutoDepthStencilState;
-typedef AutoState AutoRasterizerState;
-
-class StateManager
-{
-public:
- StateManager();
-
- // call any of these to change the affected states
- void PushBlendState(const ID3D11BlendState* state);
- void PushDepthState(const ID3D11DepthStencilState* state);
- void PushRasterizerState(const ID3D11RasterizerState* state);
-
- // call these after drawing
- void PopBlendState();
- void PopDepthState();
- void PopRasterizerState();
-
- // call this before any drawing operation if states could have changed meanwhile
- void Apply();
-
-private:
- std::stack blendstates;
- std::stack depthstates;
- std::stack raststates;
- ID3D11BlendState* cur_blendstate;
- ID3D11DepthStencilState* cur_depthstate;
- ID3D11RasterizerState* cur_raststate;
-};
-
-extern StateManager* stateman;
-
-} // namespace
-
-} // namespace DX11
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp
index fd1bd8a76d..fe1f134635 100644
--- a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp
+++ b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp
@@ -5,8 +5,8 @@
#include "Core/HW/Memmap.h"
#include "VideoBackends/D3D/D3DBase.h"
#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/D3DState.h"
#include "VideoBackends/D3D/FramebufferManager.h"
-#include "VideoBackends/D3D/GfxState.h"
#include "VideoBackends/D3D/PSTextureEncoder.h"
#include "VideoBackends/D3D/Render.h"
#include "VideoBackends/D3D/TextureCache.h"
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp
index d3bd091017..a947a8c99e 100644
--- a/Source/Core/VideoBackends/D3D/Render.cpp
+++ b/Source/Core/VideoBackends/D3D/Render.cpp
@@ -16,12 +16,11 @@
#include "Core/Movie.h"
#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DState.h"
#include "VideoBackends/D3D/D3DUtil.h"
#include "VideoBackends/D3D/FramebufferManager.h"
-#include "VideoBackends/D3D/GfxState.h"
#include "VideoBackends/D3D/PixelShaderCache.h"
#include "VideoBackends/D3D/Render.h"
-#include "VideoBackends/D3D/StateCache.h"
#include "VideoBackends/D3D/Television.h"
#include "VideoBackends/D3D/TextureCache.h"
#include "VideoBackends/D3D/VertexShaderCache.h"
diff --git a/Source/Core/VideoBackends/D3D/XFBEncoder.cpp b/Source/Core/VideoBackends/D3D/XFBEncoder.cpp
index 215a7e911f..50524d8a3d 100644
--- a/Source/Core/VideoBackends/D3D/XFBEncoder.cpp
+++ b/Source/Core/VideoBackends/D3D/XFBEncoder.cpp
@@ -5,8 +5,8 @@
#include "VideoBackends/D3D/D3DBase.h"
#include "VideoBackends/D3D/D3DBlob.h"
#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/D3DState.h"
#include "VideoBackends/D3D/FramebufferManager.h"
-#include "VideoBackends/D3D/GfxState.h"
#include "VideoBackends/D3D/Render.h"
#include "VideoBackends/D3D/XFBEncoder.h"